- From: Marton Nagy <MARTON.NAGY@saic.com>
- Date: Tue, 05 Mar 2002 10:59:50 -0500
- To: TAN Kuan Hui <kuanhui@mobileworkspace.com>
- CC: query-comments <www-xml-query-comments@w3.org>
Dear Kuan Hui, > Why is there a need to guarantee that the parent-child relationship > to be invertible ? The parent-child relationship being invertible means that given a node $a - the parent accessor of any of its children returns $a, and - $a is contained among the children of its parent (unless it is a document node, that has no parent) This property would be violated for instance if the element constructor had not logically copy their children nodes, but rather reference them, because those children nodes would have different parents before and after the element construction. Such a behavior (i.e. when operations cause side effects) is undesirable because optimization becomes very hard. One cannot change the order of some operations, e.g. interchange for loops because of these side effects. So at least from a conceptual standpoint we want the data model to use immutable nodes and to satisfy the parent-child relationship, while allowing actual implementations to use specialized techniques (including using mutable nodes, if desired) for better performance or to avoid creating physical copies of the arguments to an element constructor. > Is there any impact if the invertibility cannot be complied with ? Again, your implementation may model the data any way it desires, as long as it implements the same XQuery semantics. But you may have a harder time to ensure that path expressions such as $a/../* provide the semantics described in XQuery if your data does not ensure that the parent-child relationship is invertible. Best regards, Marton Nagy XML Query > From: TAN Kuan Hui [mailto:kuanhui@mobileworkspace.com] > Sent: Friday, March 01, 2002 3:33 AM > To: www-xml-query-comments@w3.org > Subject: Why guarantee parent-child relationship to be invertible ? > > Section 4.2 Elements in data model, > > The following para, > > "To guarantee that the parent-child relationship is invertible, the > element > constructors logically create a copy of all of their namespace, > attribute, > and children arguments and set the parent property of these nodes to the > newly created element node." > > Why is there a need to guarantee that the parent-child relationship > to be invertible ? This seems to suggest that their type relationship > somehow can also be inverted, which does not make sense to me. > Could anyone explain what the clause above means exactly ? Is > there any impact if the invertibility cannot be complied with ? > > Thanks. > Kuan Hui
Received on Tuesday, 5 March 2002 12:41:37 UTC