This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5002 - [XDM] Wrong use of the term "root node" in the XDM spec
Summary: [XDM] Wrong use of the term "root node" in the XDM spec
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Data Model 1.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows XP
: P2 minor
Target Milestone: ---
Assignee: Anders Berglund
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL: http://www.w3.org/TR/xpath-datamodel
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-04 06:17 UTC by Mukul Gandhi
Modified: 2007-11-19 21:34 UTC (History)
1 user (show)

See Also:


Attachments

Description Mukul Gandhi 2007-09-04 06:17:02 UTC
I found an inconsistency in a terminology in the "XQuery 1.0 and XPath 2.0 Data Model" specification (http://www.w3.org/TR/xpath-datamodel).

Section 2.1 Terminology mentions:
Every node is one of the seven kinds of nodes defined in "6 Nodes". Nodes form a tree that consists of a root node plus all the nodes that are reachable directly or indirectly from the root node via the dm:children, dm:attributes, and dm:namespace-nodes accessors. Every node belongs to exactly one tree, and every tree has exactly one root node.

The reference to the term, "root node" in this paragraph seems wrong. XPath 2.0 & XQuery 1.0 now use the term document node. 

Then in the same section, it's defined, "A tree whose root node is a Document Node is referred to as a document".

And, "A tree whose root node is not a Document Node is referred to as a fragment".

Then in section, "2.4 Document Order", it's written: The root node is the first node.

Also in section, "D Glossary (Non-Normative)", the term root node is used.

Although the concept of "root node" does not exist in "XQuery 1.0 and XPath 2.0 Data Model", this term is used at many places in this specification.

If "root node" is a valid concept in XQuery 1.0 and XPath 2.0, I think, it should be clearly defined in the data model specification. 

As per my knowledge, the concept of "root node" is now replaced by "document node" in XQuery & XPath 2.0. 

If I am correct, then references to the term "root node" should be removed from the "XQuery 1.0 and XPath 2.0 Data Model" specification, and replaced with "document node". Or, the concept of "root node" should be defined, if such a node type exists in the data model (which to me is not a valid node type in the data mode, as per the specification).

Regards,
Mukul
Comment 1 Michael Kay 2007-09-05 12:08:44 UTC
Personal response: although there's a tortuous history here, involving differences of terminology between XML 1.0, XPath 1.0, and XDM, I don't think the XDM spec can be faulted for these definitions. You are reading "root node" as if it were a kind of node, which is a reasonable misunderstanding given the history, but XDM makes it very plain in the section you are quoting that being a root is essentially a relationship between a node and a tree.

It's true that the spec uses the term "root node" without a formal definition, but the sentence "Nodes form a tree that consists of a root node plus all the nodes that are reachable directly or indirectly from the root node" is pretty close to a formal definition (of both "root" and "tree") and certainly seems adequate to me.
Comment 2 Mukul Gandhi 2007-09-09 14:16:01 UTC
Hi Mike,
  Thanks for your response. Please find below my further comments on this topic.

The XDM spec states (in section, 2.1 Terminology):
1) Every node is one of the seven kinds of nodes defined in 6 Nodes. Nodes form a tree that consists of a root node plus all the nodes that are reachable directly or indirectly from the root node via the dm:children, dm:attributes, and dm:namespace-nodes accessors.
2) A tree whose root node is a Document Node is referred to as a document.
3) A tree whose root node is not a Document Node is referred to as a fragment.

I think the "root node" concept in XDM is fine, and this terminology can coexist with 7 kinds of nodes possible in XDM (which are presently defined).

But I suggest adding following definitions to the section, 2.1 Terminology.  
A tree is a logical structure which is constructed from the nodes, which represent a document or a fragment.
The root node of the tree, is it's top most node, which could be a document node, or it can be the root node of a fragment.

This will define the concept of root node unambiguously.

Regards,
Mukul
Comment 3 Anders Berglund 2007-09-26 14:52:20 UTC
The XSL and XQuery WGs discussed this and decided to add a definition of "root node" (even though the term is used in its normal meaning in the context of "tree structures"). Proposed text:

[Definition: The topmost node of a tree is called the root node.]

Note: Thus the root node is merely a designator, based on position,
for one of the nodes in the tree without implying what kind of
a node it is.
In the XPath 1.0 datamodel the root node was a kind of node.