Subject: Re: [Simple] triggers in filter-format drafts selecting multiple elements - problem?

From: Hisham Khartabil <[email-masked]>
Date: Thu, 23 Feb 2006 17:11:46 +0100

On Feb 23, 2006, at 4:30 PM, <[email-masked]> wrote:

> Hello,
>
> I've been thinking about the triggers for some time and there are still
> some issues unclear to me. You wrote:
>
>>> There is only one <status> element in a tuple, so I don't see how
> this
>>> would happen in this case. But I say if a trigger filter selects 2
>>> elements, then its an error.
>
> However I found following parts in the drafts which show that trigger
> selecting 2 elements is not an error:
> 1/ from draft-ietf-simple-filter-format-05:
>
> The <added> element triggers content delivery when the XML element it
>    identifies has been added to the document being filtered (that is,
>    this instance of that element appears in the current document, but
>    not the previous document).  It can be used, for example,  to learn
>    of new services and/or capabilities subscribed to by the user, or
>    services and/or capabilities that the user has now allowed the
>    subscriber to see.
>
> According to this, the trigger in <added> element may select multiple
> elements if more than one tuple is added.

This is all implementation issues. The draft cannot state every 
possible scenario that a filter can combine. The entity processing the 
filter needs to examine the filter content and reject it if it does not 
make sense and accept it if it does.

The <added> example: it doesnt matter if 1 or 2 or 10 elements were 
added, as long as they are added.

>
> 2/ Example from the draft-ietf-simple-event-filter-funct-05 (7.3.1):
>
> SUBSCRIBE ...
>
> <?xml version="1.0" encoding="UTF-8"?>
>    <filter-set xmlns="urn:ietf:params:xml:ns:simple-filter">
>      <ns-bindings>
>        <ns-binding prefix="pidf" urn="urn:ietf:params:xml:ns:pidf"/>
>      </ns-bindings>
>      <filter id="123" uri="sip:[email-masked]">
>        <trigger>
>          <changed from="closed" to="open">
>            /pidf:presence/pidf:tuple/pidf:status/pidf:basic
>          </changed>
>        </trigger>
>      </filter>
>    </filter-set>
>
>
>
> The presence document:
>
>    <?xml version="1.0" encoding="UTF-8"?>
>          <presence xmlns="urn:ietf:params:xml:ns:pidf"
>                            xmlns:rpid="urn:ietf:params:ns:rpid-tuple"
>                            entity="sip:[email-masked]">
>             <tuple id="432sd">
>                <status>
>                   <basic>closed</basic>
>                </status>
>                <rpid:class>im</rpid:class>
>                <contact>im:[email-masked]</contact>
>             </tuple>
>             <tuple id="thr76jk">
>                <status>
>                   <basic>closed</basic>
>                </status>
>                <rpid:class>voice</rpid:class>
>                <contact>tel:[email-masked]</contact>
>             </tuple>
>          </presence>
>
> So the trigger selects 2 elements.

Yes, this selects 2 elements since the filter does not specify which 
tuple. The entity handling the filter can decide if this is an error or 
just apply the filter to all tuples. Again, this is implementation 
issue.

> In the example, the "im" tuple is
> changed to "open" and the notification is sent:
>
>    <?xml version="1.0" encoding="UTF-8"?>
>       <presence xmlns="urn:ietf:params:xml:ns:pidf"
>       xmlns:rpid="urn:example-com:ietf:params:ns:rpid-tuple"
>       entity="sip:[email-masked]">
>          <tuple id="432sd">
>             <status>
>                <basic>open</basic>
>             </status>
>             <rpid:class>im</rpid:class>
>             <contact>im:[email-masked]</contact>
>          </tuple>
>          <tuple id="thr76jk">
>             <status>
>                <basic>closed</basic>
>             </status>
>             <rpid:class>voice</rpid:class>
>             <contact>tel:[email-masked]</contact>
>          </tuple>
>       </presence>
>
> My question: if the presentity did not change the "im" tuple, but added
> completely new tuple with status=open, would the trigger be evaluated 
> as
> match?

No. The element and its ancestors need to have already existed earlier 
for this to match to be a match.

Hisham

>
>    <?xml version="1.0" encoding="UTF-8"?>
>       <presence xmlns="urn:ietf:params:xml:ns:pidf"
>       xmlns:rpid="urn:example-com:ietf:params:ns:rpid-tuple"
>       entity="sip:[email-masked]">
>          <tuple id="432sd">
>             <status>
>                <basic>closed</basic>
>             </status>
>             <rpid:class>im</rpid:class>
>             <contact>im:[email-masked]</contact>
>          </tuple>
>          <tuple id="thr76jk">
>             <status>
>                <basic>closed</basic>
>             </status>
>             <rpid:class>voice</rpid:class>
>             <contact>tel:[email-masked]</contact>
>          </tuple>
>          <tuple id="myNewTuple">
>             <status>
>                <basic>open</basic>
>             </status>
>             <rpid:class>mms</rpid:class>
>             <contact>tel:[email-masked]</contact>
>          </tuple>
>       </presence>
>
> Silvestr
>
>> -----Original Message-----
>> From: Hisham Khartabil [mailto:[email-masked]]
>> Sent: Thursday, February 16, 2006 10:02 AM
>> To: Peknik Silvestr
>> Cc: [email-masked]
>> Subject: Re: [Simple] triggers in filter-format drafts selecting
>> multiple elements - problem?
>>
>> You should construct your filter to either look like
>>
>> <changed>//tuple[@id="1"]/status/basic
>> </changed>
>>
>>
>> or
>>
>> <changed>//tuple[@id="2"]/status/basic
>> </changed>
>>
>> or both at the same time.
>>
>>
>> It doesnt make sense to have a filter as you define it.
>>
>> Hisham
>>
>> On Feb 16, 2006, at 9:15 AM, <[email-masked]> wrote:
>>
>>>> There is only one <status> element in a tuple, so I don't see how
>> this
>>>> would happen in this case. But I say if a trigger filter selects 2
>>>> elements, then its an error.
>>>
>>> I don't understand it now. In the draft is explicitly stated that the
>>> XPATH-like selector may select multiple elements and that all
>>> identified
>>> elements are selected.
>>>
>>> Example:
>>> <changed>//tuple/status/basic
>>> </changed>
>>>
>>> Before change:
>>> <tuple id="1">
>>>   <status>
>>>     <basic>open</basic>
>>>   </status>
>>>   <contact>sip:[email-masked]</contact>
>>> </tuple>
>>> <tuple id="2">
>>>   <status>
>>>     <basic>closed</basic>
>>>   </status>
>>>   <contact>sip:[email-masked]</contact>
>>> </tuple>
>>>
>>> After change (note that also the order has changed):
>>> <tuple id="2">
>>>   <status>
>>>     <basic>open</basic>
>>>   </status>
>>>   <contact>sip:[email-masked]</contact>
>>> </tuple>
>>> <tuple id="1">
>>>   <status>
>>>     <basic>closed</basic>
>>>   </status>
>>>   <contact>sip:[email-masked]</contact>
>>> </tuple>
>>>
>>> Filter selects:
>>> <basic>open</basic>, <basic>closed</basic> before change
>>> <basic>open</basic>, <basic>closed</basic> after change
>>>
>>> How do we know which elements should we compare? Do we take into
>>> consideration the parent path to each element? That would bring
>> another
>>> problem - are 2 equal <basic> elements selected by a wildcard-trigger
>>> equal if they have different parents?
>>>
>>> -----Original Message-----
>>> From: Hisham Khartabil [mailto:[email-masked]]
>>> Sent: Wednesday, February 15, 2006 3:45 PM
>>> To: Peknik Silvestr
>>> Cc: [email-masked]
>>> Subject: Re: [Simple] triggers in filter-format drafts selecting
>>> multiple elements - problem?
>>>
>>>
>>> On Feb 15, 2006, at 2:11 PM, [email-masked] wrote:
>>>
>>>> Hello, again a question about filtering.
>>>>
>>>> Draft-ietf-simple-filter-format-05 describes triggers defining
>>>> conditions under which notifications are sent. Lets take the
>> <changed>
>>>> trigger:
>>>>
>>>> "The <changed> element is used to identify the XML element or
>>>>    attribute, from the package specific XML document, whose value
>> MUST
>>>>    change, compared to the "previous XML document", in order to
>>>> activate
>>>>    the trigger and cause the content to be delivered."
>>>> ...
>>>>
>>>> It is also written that the elements can identify more than one
>>>> element:
>>>>
>>>> "  In some cases, due to the design of the XML schema, the
> XPATH-like
>>>>    expression results in identifying more than one element with the
>>>> same
>>>>    name (the XPATH expression may not have uniquely identified an
>>>>    element at every step).  In those cases, all elements identified
>>> are
>>>>    selected."
>>>>
>>>> What happens if I have trigger defining change from "open" to
>> "closed"
>>>> for some <status> element, and the XPATH-like expression selects
> more
>>>> than one element? One can be changed from "open" to "closed", the
>>> other
>>>> from "closed" to "open.
>>>
>>> There is only one <status> element in a tuple, so I don't see how
> this
>>> would happen in this case. But I say if a trigger filter selects 2
>>> elements, then its an error.
>>>
>>>
>>>>  Similarly, if the selector in <added> element
>>>> selects one element in previous document and 2 elements in current
>>>> document, is it a match?
>>>
>>> There is something wrong in the filter if one already existed. I
> doubt
>>> there will be examples where this would happen.
>>>
>>> Hisham
>>>
>>
>

_______________________________________________
Simple mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/simple

---

From: <[email-masked]>
Date: Thu, 23 Feb 2006 16:30:34 +0100

Hello, 

this

 

SUBSCRIBE ...

The presence document:

So the trigger selects 2 elements. In the example, the "im" tuple is
changed to "open" and the notification is sent:

My question: if the presentity did not change the "im" tuple, but added
completely new tuple with status=open, would the trigger be evaluated as
match?

Silvestr

XPATH-like
more
this
doubt