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

I

Istvan

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".
 
J

Joseph Kesselman

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.
 
P

Priscilla Walmsley

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
 
I

Istvan

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

Istvan

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()
 
P

Priscilla Walmsley

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
 
I

Istvan

Priscilla said:
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*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top