Do you have URI Lexicon enabled for the database ?
Are you getting any errors ? (if so what ?)


-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>


From: [email protected] 
[mailto:[email protected]] On Behalf Of Raghu
Sent: Tuesday, February 12, 2013 6:21 PM
To: General MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Somebody please help me!

HI all,


I have a parent - detail
with two children -name , value
I wrote an xquery to fetch the document with both name and value (should be 
siblings) with 'a' as value
cts:search is working a s expected whereas cts:uris isn't
Please find below the sample xquery
Thanks in advance


xdmp:document-insert("/1.xml",
<root>
            <detail>
                        <name>a</name>
                        <value>a</value>
            </detail>
            <detail>
                        <name>a</name>
                        <value>b</value>
            </detail>
</root>
),
xdmp:document-insert("/2.xml",
<root>
            <detail>
                        <name>a</name>
                        <value>b</value>
            </detail>
            <detail>
                        <name>b</name>
                        <value>a</value>
            </detail>
</root>
),
xdmp:document-insert("/3.xml",
<root>
            <detail>
                        <name>b</name>
                        <value>b</value>
            </detail>
            <detail>
                        <name>b</name>
                        <value>b</value>
            </detail>
</root>
);
(: both children of detail 'name' and 'value' should have 'a' as text content :)

let $myquery :=  cts:element-query(xs:QName("detail"),

                                  cts:and-query((

                                                    
cts:element-range-query(xs:QName("name"),"=","a"),

                                                    
cts:element-range-query(xs:QName("value"),"=","a")

                                                ))

                            )

return

(

"cts:uris/ cts:uri-match results:",

cts:uris('',(),$myquery),

"cts:search results:",

cts:search(/root,$myquery)

)
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to