Hi Bob,

There is no built-in function to do this, but it is not hard to write such a 
function.  You can make the function very simple or very complicated, depending 
on what your needs are.  For example, do you need it to just be unique or do 
you need it increase (as in 1, 2, 3, 4...)?  Or it could be as simple as 
generating a random number with xdmp:random.  Another approach that might make 
sense if you are loading the content from Java is to generate the URI in Java.

Using XQuery, if you want to increment a number to use in your URI, you can 
store that number in a document and update the document (for example, add 1 to 
the number) each time you generate a URI.  This will add some cost to 
generating the URI, but can guarantee that you are getting a sequential and 
unique number.

Hope that helps.

-Danny

From: [email protected] 
[mailto:[email protected]] On Behalf Of Runstein, Robert 
E. (Contr) (IS)
Sent: Monday, May 04, 2009 9:35 AM
To: [email protected]
Subject: [MarkLogic Dev General] URI generator


Does MarkLogic provide a function to generate a unique document uri?  If not, 
what approaches have you taken to create unique uris?  Thanks.

Best Wishes,

Bob Runstein

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

Reply via email to