[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

How is satisfies different from where ?

Michael Kay mike at saxonica.com
Mon May 24 10:39:36 PDT 2010


  How is satisfies different from where ?
The "some" and "every" expressions can always be rewritten in terms of
exists() or empty() applied to a corresponding FLWOR expression. They may
provide greater expressive clarity and may perform better in some
implementations, but they are functionally redundant.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

> -----Original Message-----
> From: http://x-query.com/mailman/listinfo/talk 
> [mailto:http://x-query.com/mailman/listinfo/talk] On Behalf Of David
> Sent: 22 May 2010 16:04
> To: http://x-query.com/mailman/listinfo/talk
> Subject:  How is satisfies different from where ?
> 
> I've embarised to admit I've never used the sum/satisfies 
> expressions in XQuery.
> Im trying to grok this recently posted pastebin 
> http://pastebin.com/7GGQxpYH
> 
> quote----
> let $result1 := ( some $i in (1 to 5), $j in (5 to 10)
>    satisfies $j - $i = 0 )
> let $result2 := ( some $i in (1 to 5), $j in (6 to 10)
>    satisfies $j - $i = 0 )
> return
> <test>
> <result1>{$result1}</result1>
> <result2>{$result2}</result2>
> </test>
> 
> ----
> 
> How is this different from
> 
> --------
> <test>
> <result1>{ exists(
> for $i in (1 to 5) , $j in (5 to 10)
> where $j - $i = 0 return  $i
> )}</result1>
> <result2>{
> exists(
> for $i in (1 to 5) ,  $j in (6 to 20)
> where $j - $i = 0 return $i
> )}</result2>
> </test>
> 
> 
> 
> ---------------
> 
> More generaly what does satisfies/sum do differently then for/where ?
> Is it simply a shorter version of the same ? or is there a 
> operaitonal difference ?
> Where would I want to use some/satisfies where for/where is 
> either inappropreate or clumbsy ?
> 
> 
> 
> Thanks for any insight
> 
> 
> 
> 
> 
> 
> 
> --
> -------------------------
> David A. Lee
> http://x-query.com/mailman/listinfo/talk
> http://www.calldei.com
> http://www.xmlsh.org
> 
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> http://x-query.com/mailman/listinfo/talk



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.