On 04/01/12 17:58, Stephen Allen wrote:
Hi Florian,
You actually can construct URIs for each solution by using SPARQL 1.1 syntax:
CONSTRUCT {
?a ?b ?uri .
?uri ?c ?d .
?uri ?e ?f .
}
WHERE {
...
BIND( iri( ... ) AS ?uri )
...
}
Unfortunately, (and someone correct me if I'm wrong) I think you can
only basically build one by concatenating other variables or literals,
or a hash function. It would be nice if SPARQL supported a UUID
function to mint unique URIs, so you could do something like:
BIND( iri( concat( "urn:uuid:", UUID() ) AS ?uri ) =>
<urn:uuid:efa77ac0-36fa-11e1-b86c-0800200c9a66>.
I don't know why the working group decided not to add this, maybe Andy
has a little more insight. It's possible that blank nodes were
thought to be sufficient for this kind of task. It wouldn't be hard
to add to Jena as an extension however.
-Stephen
[1] http://www.w3.org/TR/sparql11-query/#func-iri
Already done :-)
UUID() => <uuid:7b00fb1d-7859-49bc-8666-f998fe7a12c4>
which is an extension in ARQ syntax. That could be provided as
afn:uuid() as well. I'll add that.
What you can also do in std SPARQl 1.1 is BNODE(label) and BNODE() which
give the functionality of CONSTRUCT as functions.
BNODE(label) is the same bNode per row.
BNODE() is a fresh bnode every time.
Andy