Hi Ivan,
Is there any way to perform a percent-encoded operation on the strings which
are being used to create the IRI's so that I can get a practical guarantee that
errors won't occur?
Ie, I want to do this
`iri(bif:concat("http://bio2rdf.org/flybase:",bif:percent_encode(?o)))`
I also want a version where spaces are %20 encoded, and not + encoded as in
some URL encoding schemes.
Cheers,
Peter
----- Original Message ----
> From: Ivan Mikhailov <[email protected]>
> To: Peter Ansell <[email protected]>
> Cc: Virtuoso Users List <[email protected]>
> Sent: Monday, 16 February, 2009 10:04:08 PM
> Subject: Re: [Virtuoso-users] constructing URI's from literals
>
> Hello Peter,
>
> > Is there anyway with SPARQL and Virtuoso to create a URI in a result when
> > it
> is stored as a literal in the triplestore?
>
>
> Virtuoso has built-in function iri() that is similar to str() but
> produce an IRI.
>
> > An example query of the relevant data is:
> >
> > SELECT * WHERE { GRAPH{ ?s ?p
> "http://purl.org/obo/owl/COG#COG_C"^^xsd:anyURI . } }
> > Endpoint: http://sparql.neurocommons.org/sparql/
>
> SELECT ?s (iri(?o)) as ?o_iri
> WHERE { GRAPH{ ?s
> ?o } }
>
>
> It's easy to make some transformation of the IRI, like
>
> SELECT
> ?s
> (iri(bif:sprintf("http:/myproxyserver.private/describe?iri=%U",
> str(?o)))) as ?o_iri
> WHERE { GRAPH{ ?s
> ?o } }
>
> or, slightly better,
>
> SELECT
> ?s
> (bif:sprintf_iri("http:/myproxyserver.private/describe?iri=%U",
> str(?o))) as ?o_iri
> WHERE { GRAPH{ ?s
> ?o } }
>
>
> You may use "backquoted" calculated expressions as triple pattern
> fields...
>
> SELECT ?s (iri(?o)) as ?o_iri
> WHERE { GRAPH `iri(bif:concat("http://purl.org/science/graph/",
> "obo/COG2GO"))` { ?s
> ?o } }
>
> ... or as triple construct fields:
>
> construct {
> ?s
> `bif:sprintf_iri("http:/myproxyserver.private/describe?iri=%U",
> str(?o))` }
> WHERE { GRAPH{ ?s
> ?o } }
>
> Best Regards,
>
> Ivan Mikhailov
> OpenLink Software
> http://virtuoso.openlinksw.com
Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out
more