- From: Fangqi Hu <Fangqi.Hu@logictier.com>
- Date: Wed, 20 Jun 2001 11:58:37 -0700
- To: "'www-xml-query-comments@w3.org'" <www-xml-query-comments@w3.org>
- Cc: "'fangqi100@yahoo.com,'" <fangqi100@yahoo.com>, >, "'dtchang@us.ibm.com'" <dtchang@us.ibm.com>
Hi, I have a comment about the xquery solution and expected result to the UseCase "R" Q5. First, the expected result is not quite right, because we should also list the item that doesn't have any bid which is itemno 1008 in this case. For this matter, the previous version of Use Cases is right. So the expected result should be: <result> <jones_bike> <itemno> 1001 </itemno> <description> Red Bicycle </description> <high_bid> 55 </high_bid> <bidder> Mary Doe </bidder> </jones_bike> <jones_bike> <itemno> 1008 </itemno> <description> Broken Bicycle </description> </jones_bike> </result> However, in order to achieve this result, the query solution needs to be changed, because the current query only lists the items that have bids. So I rewrite the query as follow: <result> FOR $seller IN document("users.xml")//user_tuple, $item IN document("items.xml")//item_tuple LET $highbid := max(document("bids.xml")//bid_tuple[itemno = $item/itemno]/bid), $bidderId := document("bids.xml")//bid_tuple[bid = $highbid]/userid, $buyername := document("users.xml")//user_tuple[userid = $bidderId]/name WHERE $seller/name = "Tom Jones" AND $seller/userid = $item/offered_by AND contains($item/description, "Bicycle") RETURN <jones_bike> $item/itemno , $item/description , <high_bid> $highbid</high_bid> , <high_bidder> $buyername </high_bidder> </jones_bike> SORTBY (itemno) </result> I run this query using my own XQuery engine (I'm implementing it for my master degree project), and it gives the expected result. Let me know your thoughts on this. Thanks, Fangqi Hu
Received on Wednesday, 20 June 2001 15:14:49 UTC