Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XQuery : Some .... in .... satisfies

Reply
Thread Tools

XQuery : Some .... in .... satisfies

 
 
Istvan
Guest
Posts: n/a
 
      09-04-2006
Hello

Have anybody an idea how to solve "Some ... in ... satisfies " with
standard functions ?


For example this:
"List the reserves of those open auctions where a
certain person issued a bid before another person."


let $auction := doc("auction.xml") return
for $b in $auction/site/open_auctions/open_auction
where
some $pr1 in $b/bidder/personref[@person = "person20"],
$pr2 in $b/bidder/personref[@person = "person51"]
satisfies $pr1 << $pr2
return <history>{$b/reserve/text()}</history>


Thats an query of the XMark Benchmark... Q4.
I need it to execute on Tamino, and so I have to rewrite it, because
Tamino doesn't support
"Some ... in .... satisfies".

 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      09-05-2006
Been a while since I've worked with XQuery, but in XSLT I'd rephrase
that as "find all which satisfy; is that nodeset empty". In XSLT any
comparison expression on nodesets is taken as "does any element
satisfy"; I'd expect that to be true of XQuery too since the underlying
semantics are similar.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
 
 
 
Priscilla Walmsley
Guest
Posts: n/a
 
      09-10-2006
Hi,

"Some..in..satisfies" _is_ standard XQuery and has been for a long time;
I'm not sure why Tamino wouldn't support it.

But anyway, how about something like (untested):

let $auction := doc("auction.xml") return
for $b in $auction/site/open_auctions/open_auction
where
(for $pr1 in $b/bidder/personref[@person = "person20"]
return
$b/bidder/personref[@person = "person51"][. >> $pr1])
return <history>{$b/reserve/text()}</history>

Hope that helps,
Priscilla
---------------------------------------------
Priscilla Walmsley
Author, XQuery (Coming in 2006 from O'Reilly)
http://www.datypic.com
http://www.xqueryfunctions.com
---------------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Istvan
Guest
Posts: n/a
 
      09-10-2006
problem solved.



Tamino Developers said:


let $auction := doc("auction.xml") return
for $b in $auction/site/open_auctions/open_auction
where
some $pr1 in $b/bidder/personref[@person = "person20"],
$pr2 in $b/bidder/personref[@person = "person51"]
satisfies $pr1 << $pr2
return <history>{$b/reserve/text()}</history>

 
Reply With Quote
 
Istvan
Guest
Posts: n/a
 
      09-10-2006
problem solved.



Tamino Developers said:

let $auction := input()/auction
for $b in $auction/site/open_auctions/open_auction
for $pr1 in $b/bidder/personref[@person = "person20"],
$pr2 in $b/bidder/personref[@person = "person51"]
where $pr1 << $pr2 return $b/reserve/text()

 
Reply With Quote
 
Priscilla Walmsley
Guest
Posts: n/a
 
      09-10-2006
Hi,

I don't think this is the same thing because you are going to get
duplicate results for the same auction if there is more than one bid
that satisfies the condition.

Priscilla

----------------------------------
Priscilla Walmsley
Author, Definitive XML Schema
Definitive XQuery
http://www.datypic.com
----------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Istvan
Guest
Posts: n/a
 
      09-10-2006
Priscilla Walmsley wrote:
> Hi,
>
> I don't think this is the same thing because you are going to get
> duplicate results for the same auction if there is more than one bid
> that satisfies the condition.



Hi !

I wanted to test both. But the query doesn't give a result on the XMark
generated data.
I don't know why is this query in the XMark Tests included....

But I think you are right


Thank you Priscilla !

You are super *g*

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you find an item that satisfies multiple conditions? Bob Sanders Ruby 4 12-01-2008 05:52 PM
obtain element name, or attribute and value of the document name itself, and some elemnts and attributes from an ancestor or the node itself using xquery Jeff Kish XML 4 10-30-2008 05:47 PM
Some XQuery/SQL Server 2005 help please CK XML 1 11-27-2006 08:03 PM
Some .... in .... satisfies Istvan XML 0 09-04-2006 11:56 AM
A List Implementation that satisfies the contract, yet breaks standard implementations! Ant... Java 6 10-28-2003 03:53 PM



Advertisments