[MarkLogic Dev General] issue with XPATH
Geert Josten
Geert.Josten at daidalos.nl
Thu Mar 26 14:24:11 PST 2009
I don't know how Mark Logic implemented the equality operator, but I would think it is O(count(A) * count(B)). Each item from A is compared against each item from B.
But I don't think you need to worry about the order. If you are comparing sequences, you are probably doing that with a purpose.
Kind regards,
Geert
> -----Original Message-----
> From: general-bounces at developer.marklogic.com
> [mailto:general-bounces at developer.marklogic.com] On Behalf Of
> Eric Palmitesta
> Sent: donderdag 26 maart 2009 22:58
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] issue with XPATH
>
> If both sides of the "=" are (unsorted) sequences, then is
> A=B in O((count(A)+count(B))^2)?
>
> Eric
>
> Geert Josten wrote:
> > Pradeep,
> >
> > Yes, I think the result should be the same. It looks like
> the first approach is interpreted as (doc(..)//b)[position() = 2].
> >
> > Eric,
> >
> > Yes, a = b returns true if any item from sequence a is
> equal to any item in sequence b. You can best see it as an
> intersect on atomic values, returning all items in a that are
> also in b, but none in b that are not in a though..
> >
> > Kind regards,
> > Geert
> >
> >
> >
> > Drs. G.P.H. Josten
> > Consultant
> >
> >
> > http://www.daidalos.nl/
> > Daidalos BV
> > Source of Innovation
> > Hoekeindsehof 1-4
> > 2665 JZ Bleiswijk
> > Tel.: +31 (0) 10 850 1200
> > Fax: +31 (0) 10 850 1199
> > http://www.daidalos.nl/
> > KvK 27164984
> > De informatie - verzonden in of met dit emailbericht - is
> afkomstig van Daidalos BV en is uitsluitend bestemd voor de
> geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen,
> verzoeken wij u het te verwijderen. Aan dit bericht kunnen
> geen rechten worden ontleend.
> >
> >
> >> From: general-bounces at developer.marklogic.com
> >> [mailto:general-bounces at developer.marklogic.com] On Behalf Of Eric
> >> Palmitesta
> >> Sent: donderdag 26 maart 2009 21:46
> >> To: General Mark Logic Developer Discussion
> >> Subject: Re: [MarkLogic Dev General] issue with XPATH
> >>
> >> Perhaps I spoke too soon!
> >>
> >> As I understand, A=B means "return true if A is found
> anywhere in the
> >> sequence B". Can someone confirm this?
> >>
> >> Thanks (and sorry to derail),
> >>
> >> Eric
> >>
> >> Eric Palmitesta wrote:
> >>> Equality testing of non-sequences should use "eq". Try...
> >>>
> >>> [position() eq 2]
> >>>
> >>> Eric
> >>>
> >>> Pradeep Maddireddy wrote:
> >>>> Hi..!
> >>>>
> >>>>
> >>>>
> >>>> I have a document with the following content
> >>>>
> >>>>
> >>>>
> >>>> <root>
> >>>>
> >>>> <a>
> >>>>
> >>>> <b id="1-1">1</b>
> >>>>
> >>>> </a>
> >>>>
> >>>> <a>
> >>>>
> >>>> <b id="2-1">1</b>
> >>>>
> >>>> <b id="2-2">1</b>
> >>>>
> >>>> </a>
> >>>>
> >>>> <a>
> >>>>
> >>>> <b id="3-1">1</b>
> >>>>
> >>>> <b id="3-2">1</b>
> >>>>
> >>>> </a>
> >>>>
> >>>> </root>
> >>>>
> >>>>
> >>>>
> >>>> I think both the following xpath expression should give the same
> >>>> result but they are giving different results, is it an issue in
> >>>> marklogic
> >>>>
> >>>>
> >>>>
> >>>> doc("/root/ab.xml")//b[position()=2]
> >>>>
> >>>>
> >>>>
> >>>> <b id="2-1">1</b>
> >>>>
> >>>>
> >>>>
> >>>> doc("/root/ab.xml")//b[2]
> >>>>
> >>>>
> >>>>
> >>>> <b id="2-2">1</b>
> >>>> <b id="3-2">1</b>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Thanks
> >>>>
> >>>> Pradeep Maddireddy
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>
> ---------------------------------------------------------------------
> >>>> ---
> >>>>
> >>>> _______________________________________________
> >>>> General mailing list
> >>>> General at developer.marklogic.com
> >>>> http://xqzone.com/mailman/listinfo/general
> >>> _______________________________________________
> >>> General mailing list
> >>> General at developer.marklogic.com
> >>> http://xqzone.com/mailman/listinfo/general
> >> _______________________________________________
> >> General mailing list
> >> General at developer.marklogic.com
> >> http://xqzone.com/mailman/listinfo/general
> >>
> >
> > _______________________________________________
> > General mailing list
> > General at developer.marklogic.com
> > http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
>
More information about the General
mailing list