Reputation: 606
Using an RDF database, accessed via a SPARQL endpoint, what's the best way of generating new UUID IRIs and using them for new resources?
Here is an overview of some approaches I've tried. I am sharing this because I would have liked to find this question answered. My favourite is the last approach, but I'd say it's still up for debate.
Query: SELECT (UUID() as ?id) WHERE{}
Query (returns 1000 result rows):
SELECT (UUID() as ?id) WHERE {
VALUES ?index1 { 0 1 2 3 4 5 6 7 8 9 }
VALUES ?index2 { 0 1 2 3 4 5 6 7 8 9 }
VALUES ?index3 { 0 1 2 3 4 5 6 7 8 9 }
}
Related:
Upvotes: 0
Views: 315
Reputation: 606
Following AndyS's comment, I decided to look that up again and adjust my expectations: you have to generate 1 billion UUIDs per second for about 85 years to reach a 50% probability of one or more collisions. Therefore, Variant 1 is best:
Generate a UUID in the client and use it in the update request.
Upvotes: 2