Yes, As Asit mentioned both operators have significant difference . Here one more point about this operators . As per XQeury 1.0 strict and 0.9-ml version both will throw error if you not properly used both operators , But 1.0-ml , it’s doesn’t have any special difference , both will act as same unless otherwise you mention function mapping in the beginning of your XQuery code.
Thanks and regards Raja >>> From: [email protected] [mailto:[email protected]] On Behalf Of Asit Nautiyal Sent: Monday, June 29, 2015 2:50 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Can anyone tell me why the result of the second xqery is empy? There was a difference between = and eq. eq is item operator, use for matching same item and = is sequence operator, use for matching in a sequence. MarkLogic 5.0 onwards both work similarly. But, for mail trail's code, it's behaviour is different as I tried in ML 8. ________________________________ Date: Mon, 29 Jun 2015 14:37:28 +0530 From: [email protected]<mailto:[email protected]> To: [email protected]<mailto:[email protected]> Subject: Re: [MarkLogic Dev General] Can anyone tell me why the result of the second xqery is empy? Geert, I was looking into the difference between eq and = in MarkLogic and found one article and it says "in the "1.0-ml" version of XQuery, there's no difference in behavior. eq behaves the same as =, etc." for more information please refer "https://developer.marklogic.com/blog/comparison-operators-whats-the-difference" Are you referring the same of some other issue of =/eq? Regards, Indy On Mon, Jun 29, 2015 at 1:46 PM, Geert Josten <[email protected]<mailto:[email protected]>> wrote: Replacing = with eq also works. I’ll file a bug, this is odd behavior.. Cheers From: Asit Nautiyal <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Monday, June 29, 2015 at 9:25 AM To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Subject: Re: [MarkLogic Dev General] Can anyone tell me why the result of the second xqery is empy? Hi Raja, That's what i wrote in my first reply, code will work with predicate[ ]. Regards, Asit Nautiyal ________________________________ From: [email protected]<mailto:[email protected]> To: [email protected]<mailto:[email protected]> Date: Mon, 29 Jun 2015 07:22:43 +0000 Subject: Re: [MarkLogic Dev General] Can anyone tell me why the result of the second xqery is empy? Hi All, Below options also working . for $i in collection("test")/catalog/product[@dept = "WMN"]/name return $i, for $i in collection('test')/catalog/product/name return $i[../@dept = "WMN"] By Raja >>> From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Asit Nautiyal Sent: Monday, June 29, 2015 12:37 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Can anyone tell me why the result of the second xqery is empy? Hi Geert, Below code is working fine, if we are assigning xml document in a variable, as you are doing. for $i in $xml/catalog/product/name where $i/../@dept<mailto:$i/../@dept> = 'WMN' return $i But, while using collection (retrieving document from MarkLogic collection) above code won't work. It is working with below code : for $i in collection('SAMPLE')/catalog/product/name where $i/..[@dept = 'WMN'] return $i Regards, Asit Nautiyal ________________________________ From: [email protected]<mailto:[email protected]> To: [email protected]<mailto:[email protected]> Date: Mon, 29 Jun 2015 06:58:38 +0000 Subject: Re: [MarkLogic Dev General] Can anyone tell me why the result of the second xqery is empy? This works just fine for me: let $xml := document{ <catalog> <product dept="WMN"> <number>557</number> <name language="en">Fleece Pullover</name> <colorChoices>navy black</colorChoices> </product> <product dept="ACC"> <number>563</number> <name language="en">Floppy Sun Hat</name> </product> <product dept="ACC"> <number>443</number> <name language="en">Deluxe Travel Bag</name> </product> <product dept="MEN"> <number>784</number> <name language="en">Cotton Dress Shirt</name> <colorChoices>white gray</colorChoices> <desc>Our <i>favorite</i> shirt!</desc> </product> </catalog> } return ( for $i in $xml/catalog/product where $i/@dept = 'WMN' return $i/name, for $i in $xml/catalog/product/name where $i/../@dept<mailto:$i/../@dept> = 'WMN' return $i ) I am getting Fleece Pullover twice.. Cheers, Geert From: 张晓博 <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Monday, June 29, 2015 at 3:25 AM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] Can anyone tell me why the result of the second xqery is empy? There is one XML document stored in my database, the content of the XML document is: <catalog> <product dept="WMN"> <number>557</number> <name language="en">Fleece Pullover</name> <colorChoices>navy black</colorChoices> </product> <product dept="ACC"> <number>563</number> <name language="en">Floppy Sun Hat</name> </product> <product dept="ACC"> <number>443</number> <name language="en">Deluxe Travel Bag</name> </product> <product dept="MEN"> <number>784</number> <name language="en">Cotton Dress Shirt</name> <colorChoices>white gray</colorChoices> <desc>Our <i>favorite</i> shirt!</desc> </product> </catalog> when i execute the follow xquery : for $i in collection('http://marklogic.com/xdmp/test')/catalog/product<http://marklogic.com/xdmp/test%27%29/catalog/product> where $i/@dept = 'WMN' return $i/name; the result is: <namelanguage="en"> Fleece Pullover </name> But, if i use the follow xquery to do the same thing, the result will be empty for $i in collection('http://marklogic.com/xdmp/test')/catalog/product/name<http://marklogic.com/xdmp/test%27%29/catalog/product/name> where $i/../@dept<mailto:$i/../@dept> = 'WMN' return $i; Can anyone tell me why the result of second xqery is empy? _______________________________________________ General mailing list [email protected]<mailto:[email protected]> Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. _______________________________________________ General mailing list [email protected]<mailto:[email protected]> Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected]<mailto:[email protected]> Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected]<mailto:[email protected]> Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
