Mano, Although there isn't an efficient XQuery or XPath expression to answer that question directly from MarkLogic's indexes, you could obtain that information by parsing the namespaces of all the elements of each document in turn. (And you could do attributes too, if you wanted namespaces of any namespaced attributes.)
To do that efficiently, I would xdmp:spawn<http://developer.marklogic.com/pubs/4.2/apidocs/Ext-6.html#xdmp:spawn> a task for each document (using cts:uris<http://developer.marklogic.com/pubs/4.2/apidocs/Lexicons.html#cts:uris> to generate a list of all doc uris) to the task server, using an XQuery module that parsed and returned all the namespaces for a given document uri. That XQuery module might look something like this: xquery version "1.0-ml"; declare variable $URI as xs:string external; let $map := map:map() let $_ := for $e in doc($URI)//element() (: note that this may also return the empty namespace :) return map:put($map, namespace-uri($e), "") (: assumes this path exists and is writeable :) return xdmp:save(concat("/tmp/docs_namespaces/", $URI), text { $URI, string-join(map:keys($map), ",") }) You could then use the output to obtain lists of namespaces and the uris of documents that use them. Depending on the number of documents in your database, you may need to break the work up into smaller batches, or increase the size of your task server queue (under Groups -> <group name of the server(s) you'll use> in the Administration interface). Alternatively, you could use a tool like corb<http://developer.marklogic.com/code/corb>. Others may have more clever ideas. Aaron Aaron Redalen, Managing Principal Consultant MarkLogic Corporation Phone | Cell +1 240 688 7433 email [email protected]<mailto:[email protected]> web www.marklogic.com<http://www.marklogic.com/> ________________________________ From: [email protected] [[email protected]] On Behalf Of mano m [[email protected]] Sent: Thursday, March 03, 2011 6:44 AM To: [email protected] Subject: [MarkLogic Dev General] namespace Hi, Is it possible to get the list of documents stored on ML sharing the same namespace. regards, Mano
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
