- 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>
> 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 UTC