Maps. Use the map option to the function call, then $a - $b

BTW I'd expect cts:uris with a directory-query to be more efficient than 
uri-match.

-- Mike

On Oct 2, 2012, at 13:49, Mike Sokolov <[email protected]> wrote:

> 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
> 
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to