Yes, I believe you can do what you're asking by using some of the SPARQL 1.1 string functions [1].
-Stephen [1] http://www.w3.org/TR/sparql11-query/#func-strings On Thu, Jan 5, 2012 at 3:33 AM, Florian Beuter <[email protected]> wrote: > That's an interesting approach. Is it possible to use this with fragment > identifiers of other URIs (bound to variables)? > I'm thinking of something like: > > BIND( iri( concat( str(?component), str(?codec) ) ) AS ?config ) > > Is there a possibility to specifiy the namespace for the new created URI and > to build its fragment identifier from the fragment identifiers of other > URIs? > > Thanks for your help. > > Am 04.01.2012 19:30, schrieb Andy Seaborne: > >> 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 >> >> >
