If I want to intersect two sorted lists of atomic values (an O(n) 
operation), is there an efficient way to do that in MarkLogic?  These 
are lists of URIs, drawn from the uri lexicon.

In particular, my use case is detecting duplicate uris:

let $uris-1 := cts:uri-match ("/BTL/*", (), (), (), 
xdmp:forest("dg-staging-1"))
let $uris-2 := cts:uri-match ("/BTL/*", (), (), (), 
xdmp:forest("dg-staging-2"))

return count($uris-1 [. = $uris-2] )

that seems to be doing O(n^2), based on empirical measurements - of 
course the optimizer doesn't "know" or act on the fact that the lists 
are sorted

-- 
Michael Sokolov
Engineering Director
www.ifactory.com

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

Reply via email to