This is because cts:not-query is fragment-based, so it returns true only if the specified query does not produce a match anywhere in a fragment.
-Danny -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Geert Josten Sent: Thursday, March 12, 2009 1:39 PM To: General Mark Logic Developer Discussion Cc: Deepak Mohan Subject: RE: [MarkLogic Dev General] How to identify a absence of complexnode... Deepak, The suggestion by Florent is good. You are not required to use searching to get quick results. Plain Xpath can be quick in MarkLogic just as well. Next to this, you are explicitly testing for a 'dd' element. To be more precise, you are testing for all child elements exactly, while translating your explanation literally would give: cts:search(//aa, cts:not-query(cts:element-query(xs:QName("ee"), "*")) ) Strangely enough however, the not-query is not behaving as expected. Leaving it out returns the second aa, but including it returns nothing. Perhaps someone at Mark Logic can tell more.. Best 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: [email protected] > [mailto:[email protected]] On Behalf Of > deepak mohan > Sent: donderdag 12 maart 2009 20:44 > To: [email protected] > Cc: Deepak Mohan > Subject: [MarkLogic Dev General] How to identify a absence of > complex node... > > Dear MarkLogic XQuery players, > > I need a kind help. I want to search for a node(<aa>) in > which the complex node of my interest(<ee>) should not be there. > > for eg: > The sample xml structure: > <root> > <aa1> > <bb> > <cc> > <dd> > <ee> > <ff>ff</ff> > </ee> > </dd> > <gg>gg</gg> > </cc> > </bb> > </aa1> > <aa2> > <bb> > <cc> > <gg>gg</gg> > </cc> > </bb> > </aa2> > <aa3> > <bb> > <cc> > <dd> > <ff>ff</ff> > </dd> > <gg>gg</gg> > </cc> > </bb> > </aa3> > </root> > > The XQuery I constructed was: > cts:search(//root, > cts:element-query(xs:QName("aa"), > cts:element-query(xs:QName("bb"), > cts:element-query(xs:QName("cc"), > cts:element-query(xs:QName("dd"), > cts:not-query( > cts:element-query(xs:QName("ee"), "*") > ))))) > > I expected aa3 and aa2, but i got only aa3. > > Then I tried like this: > cts:search(//root, > cts:element-query(xs:QName("aa"), > cts:element-query(xs:QName("bb"), > cts:element-query(xs:QName("cc"), > cts:not-query( > cts:element-query(xs:QName("dd"), > cts:element-query(xs:QName("ee"), "*") > ))))) > I got only aa2 for the above query. > > > > Can any one help me to find both aa2 and aa3....? > > Any feedback from the xquery players is greatly appreciated. > > regards, > Deepak M. > > ________________________________ > > Get rid of Add-Ons in your email ID. Get > [email protected]. Sign up now! > <http://in.rd.yahoo.com/tagline_dbid_15/*http://in.promos.yaho > o.com/address> > _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
