Subject: RE: [Simple] xcap issue 2: positional insertions

From: [email-masked]
Date: Mon, 10 May 2004 11:30:09 +0300

This is good. I believe we need positional insertions.

My question is how does a positional insertion work for elements with different names (the example you gave with issue 1) where the uniqueness comes from the element name and not an attribute?

eg:
<foo>
   <baz/>
</foo>

If I want to insert bar, and bar has to be inserted before baz. Does it work like this:

PUT http://server/xcap-root/document/foo/bar[1]  

<bar/>

This works, I think, but the general rule you gave below does not apply here (the unique-att thing).

/Hisham

> -----Original Message-----
> From: [email-masked] [mailto:[email-masked]]On Behalf Of
> ext Jonathan Rosenberg
> Sent: 10.May.2004 08:27
> To: Simple WG
> Subject: [Simple] xcap issue 2: positional insertions
> 
> 
> A "positional insertion" is an operation on an XML document 
> that inserts 
> a new element as a child of a specified parent, and 
> furthermore, does so 
>   such that specific siblings appear before, and others appear after, 
> the new element.
> 
> In other words, if I have the following document:
> 
> <foo>
>    <baz id="1"/>
>    <baz id="2"/>
>    <baz id="3"/>
> </foo>
> 
> Lets say I wish to insert a new element, <baz id="1.5"/> that sits 
> between the <baz> elements with id 1 and 2. Such an insertion is 
> positional, since its asking for baz to be inserted in a specific 
> position relative to its siblings.
> 
> In the current xcap spec, such an insertion is not possible. 
> I went over 
> this during the Seoul meeting, and pointed out that this 
> feature would 
> not be necessary for most of the types of schemas we were likely to 
> encounter. However, that proposition was true ASSUMING that 
> the server, 
> when it performed insertions, did so such that the resulting 
> documents 
> were still schema compliant, if possible. In another email, regarding 
> open issue 1, I've proposed that the server become ignorant of the 
> schemas when doing insertions. If that should happen, my 
> assumption no 
> longer holds, and we do really need positional insertions. 
> For example, 
> CPCP would really need them.
> 
> So, my proposal is to allow them. Jari has proposed a simple way. We 
> extend the current xcap features to allow multiple 
> predicates, each of 
> which is ANDED together (this is a feature of XPath). Each predicate 
> appears surrounding by square brackets (the []). We also need 
> to allow 
> the wildcard "*".
> 
> Now, lets once again consider how to insert the baz element 
> with id of 
> 1.5 between the ones with id 1 and 2. The following would 
> accomplish that:
> 
> PUT http://server/xcap-root/document/foo/baz[2][@id="1.5"]
> 
> <baz id="1.5"/>
> 
> Lets analyze this. The xcap URI resolves no no existing 
> element (none of 
> the baz elements have ID equal to 1.5). So, the content is 
> inserted. Its 
> inserted such that the URI now selects the new content. The 
> URI requires 
> this new baz element to be the second of of all baz's, and 
> further, that 
> its id be 1.5. The only way to accomplish that is by 
> inserting it into 
> the document such that it looks like this:
> 
> <foo>
>    <baz id="1"/>
>    <baz id="1.5"/>
>    <baz id="2"/>
>    <baz id="3"/>
> </foo>
> 
> which is the desired operation.
> 
> This approach is really general purpose, and will allow for easy 
> positional insertions so long as the new element differs in some 
> identifiable way from existing elements of the same name. Currently, 
> that would be by attribute name and value.
> 
> Generally, to insert as the nth child under parent foo:
> 
> PUT 
> http://serverd/document/root/path-to-foo/foo/*[n][unique-att="
unique-value"]

where unique-att is an attribute in the new element whose value is 
unique-value, and no other sibling has this attribute with this value.

Do folks agree to add this?

Thanks,
Jonathan R.
-- 
Jonathan D. Rosenberg, Ph.D.                600 Lanidex Plaza
Chief Technology Officer                    Parsippany, NJ 07054-2711
dynamicsoft
[email-masked]                     FAX:   (973) 952-5050
http://www.jdrosen.net                      PHONE: (973) 952-5000
http://www.dynamicsoft.com

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

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

---

From: Jari Urpalainen <[email-masked]>
Date: Mon, 10 May 2004 15:08:49 +0300

> This works, I think, but the general rule you gave below does not apply here (the unique-att thing).

Unfortunately, it does not work, you have to have a constraint like 

PUT http://server/xcap-root/document/foo/*[1]["bar condition"] where any
node "*" is used as Jonathan is proposing and  "bar condition" could be
e.g. an attribute constraint within <bar/> (not any in your example). Of
course this constraint could also be local-name()="bar" but local-name()
function is not yet allowed.

> > http://serverd/document/root/path-to-foo/foo/*[n][unique-att="

There seems to be a typo as @ is missing before unique-att.

BR,
Jari

---

From: Jari Urpalainen <[email-masked]>
Date: Mon, 10 May 2004 15:08:49 +0300

BR,
Jari