OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Free Nodes - let your data be FREE

Suspend your disbelieve for a moment like you're watching a bad  movie :)

<suspend disbelief>

Suppose we actually wanted to support some FTanML concepts an JSON concepts and Map concept and such into XDM and tools
without totally breaking things.

As discussed the last few days I belive they key issues to doing this are discarding node identity and parentage.

We already have some nodes which are almost like that.   Constructed nodes from xquery and xslt literal constructors like
   let $x := <foo/>

They are not quite the same but the dont have parents and they dont have a document position.
Plus the children still have parents i.e.   This works
    let $x := <foo><bar/></foo>,
        $b := $x/bar
       $root := $b/..

Now ...

Suppose <putting on big suspension of disbelief hat> we added a "free" modifier that could be applied to any place nodes are introduced,
similar to "as type" ... not thinking this all the way through but it could be right after the "as type" or also possibly treat as and cast as ...
     let $x := doc("foo.xml") as doc() free
     let $y :=  <foo><bar/></foo> as free
     let $z :=    /foo/bar treat as free   (: detaches /foo/bar from responsibility of being attached to foo)
declare function x( $e as element(y) free ) as free

Something like that ... it's an annotation on types that then gets applied to expressions.
It might also need to "stick" into the variable if they came from the outside world like external variables which were created free.

So what does this mean ?

Suppose any expression/variable with the free modifier was treated by processors as if it had no parentage or identity.
It may *actually* have none - in which case it should be ignored.

Consequences ? Any time such a beast is encountered then the processor knows that some things can't be done (or can be avoided)

No sibling or parent axis allowed (ideally at compile time error)
Descendant access produces 'free' nodes as well  e.g  if  $a is free then $a/x is also free.  Which means $a/x/.. is undefined
Nodes can be shared in different trees  ... $a/x and $b/x   could be the same node (even if $a and $b are different) ...
e.g   let $x := <x/> , $a := <a>{$x}</a> , $b := <b>{$x}</b>   could actually share $x without copying it.
ordering by document order is ignored  (as is current with constructed nodes)
Copies can be made by reference (see above)
Identity can only be checked by value because the nodes have no identity.
No node-uri , fn:root() etc ...

Pros ?
With this "wafer thin" modification we could then put JSON like data, Map data, unattached data, data not from documents into the XDM node structure and not suffer the penalties.  We can already do most of this right now but by adding a 'free' modifier we can lift the restrictions that makes these things expensive.

< unsuspend disbelief>

David A. Lee

<<attachment: winmail.dat>>

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS