Hi Karl,
Regaring question #2:
I quite literally ran your code against the following test document:
xdmp:document-insert("my-test-doc.xml", <test xmlns="http://ns">
<L1><L2><L3>
<ID>X032923492</ID>
<StartDate>1900-01-02T00:00:00</StartDate>
</L3></L2></L1>
</test>)
And your queries return the expected results. Could your problem be caused by
something else?
I am running MarkLogic Server 4.1-3. If you are running on an older version,
you might want to upgrade.
Kind regards,
Geert
> (Question #2: and-query() problem -- see code below) However,
> if I run the same query (q1) but join it in a cts:and-query()
> with any other query that also is satisfied by the document
> when the query is run by itself (q2), I get no results. So
> it seems to be a case where cts:and-query() does NOT return
> the intersection of its constituent queries (as it is defined
> to do). What might cause that?
>
> ==== code... ====
>
> (: q1: RETURNS THE TEST DOCUMENT: :)
>
> cts:search(fn:doc("my-test-doc.xml"),
> cts:and-query((
> cts:element-query(fn:QName("http://ns", "L1"),
> cts:element-query(fn:QName("http://ns", "L2"),
> cts:element-query(fn:QName("http://ns", "L3"),
>
> cts:element-range-query(fn:QName("http://ns", "StartDate"),
> ">=", xs:dateTime("1900-01-01T00:00:00")))))
> ))
> )
>
>
> (: q2: RETURNS THE TEST DOCUMENT: :)
>
> cts:search(fn:doc("my-test-doc.xml"),
> cts:and-query((
> cts:element-query(fn:QName("http://ns", "L1"),
> cts:element-query(fn:QName("http://ns", "L2"),
> cts:element-query(fn:QName("http://ns", "L3"),
>
> cts:element-value-query(fn:QName("http://ns", "ID"), "X032923492"))))
> ))
> )
>
>
> (: Q = cts:and-query(q1, q2): RETURNS NO RESULTS: :)
>
> cts:search(fn:doc("my-test-doc.xml"),
> cts:and-query((
> cts:element-query(fn:QName("http://ns", "L1"),
> cts:element-query(fn:QName("http://ns", "L2"),
> cts:element-query(fn:QName("http://ns", "L3"),
>
> cts:element-range-query(fn:QName("http://ns", "StartDate"),
> ">=", xs:dateTime("1900-01-01T00:00:00"))))),
> cts:element-query(fn:QName("http://ns", "L1"),
> cts:element-query(fn:QName("http://ns", "L2"),
> cts:element-query(fn:QName("http://ns", "L3"),
>
> cts:element-value-query(fn:QName("http://ns", "ID"), "X032923492"))))
> ))
> )
>
> ====
>
> Thanks,
> Karl
>
>
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.
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general