W3C home > Mailing lists > Public > www-ql@w3.org > January to March 2004

Re: Query on the XML graph

From: Murali Mani <mani@CS.UCLA.EDU>
Date: Mon, 9 Feb 2004 04:21:38 -0800 (PST)
To: Michael Brundage <xquery@comcast.net>
Cc: Jim Tivy <jimt@bluestream.com>, Jiang Ming Fei <mfjiang@cse.cuhk.edu.hk>, "www-ql@w3.org 2" <www-ql@w3.org>
Message-ID: <Pine.GSO.4.58.0402090409400.9545@panther.cs.ucla.edu>


> For example, given a structure containing Employee elements with ID and
> ReportsTo attributes (typed as ID, IDREF, respectively), here are some joins
> expressed using XPath 1.0:
>
> (: all managers - i.e., all employees with at least one direct report :)
> //Employee[//Employee/@ReportsTo = @ID]

can I write the above query as also:
Id(//Employee/@ReportsTo)

by semantics of duplicate elimination, they will give the same result?

> If XPath had an idref() function, you could do something like: :)
> //Employee[count(idref(@ID)) >= 2]

I thought there was an idref function?
http://www.w3.org/TR/xquery-operators/#func-idref

> //Employee[count(.//Employee)]
> (: is trivial, but there's no way to recursively follow ID/IDREF edges :)

I will tentatively suggest this:

I think there should be step/(s) to navigate id/idref. Reasons are:

1. Now how do you traverse 2 idref edges in one path expression; it is not
very easy..

rough example: manager of managers:
Id(Id(//Employee/@ReportsTo)/@ReportsTo)

I think rather than the above, something like:

//Employee/@ReportsTo->Employee/@ReportsTo->Employee might be easier to
understand..??

2. We can think of extending recursive operators to idref traversal, and
say:

rough example: (This query can be written w/o recursion; but we can think
of transitive closure as something like this..??)
//Employee/(@ReportsTo->Employee)*

best, murali.
Received on Monday, 9 February 2004 07:25:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 22 July 2006 00:10:19 GMT