You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Nicolas Paris <ni...@gmail.com> on 2016/01/06 19:49:52 UTC

[jena-arq] Cast a literal to an IRI

Hello,

Is there a way to cast a literal to an IRI within SPARQL in jena ?
(link to sparql 1.1 doc)
http://www.w3.org/TR/sparql11-query/#func-iri

eg: I have got triple:

foo bar "baz"^^anyUri
baz rdf:label "tiz"^^xsd:string

I would like to query  :

foo bar ?baz
IRI(?baz) rdf:label ?tiz

then i would like to get :

?tiz = "tiz"^^xsd:string

Thanks by advance,

Re: [jena-arq] Cast a literal to an IRI

Posted by Nicolas Paris <ni...@gmail.com>.
Hello Andy,

Thanks a lot, this works as I wish.
It looks like I missed something in the doc.

2016-01-06 20:16 GMT+01:00 Andy Seaborne <an...@apache.org>:
> On 06/01/16 18:49, Nicolas Paris wrote:
>>
>> Hello,
>>
>> Is there a way to cast a literal to an IRI within SPARQL in jena ?
>> (link to sparql 1.1 doc)
>> http://www.w3.org/TR/sparql11-query/#func-iri
>>
>> eg: I have got triple:
>>
>> foo bar "baz"^^anyUri
>> baz rdf:label "tiz"^^xsd:string
>>
>> I would like to query  :
>>
>> foo bar ?baz
>> IRI(?baz) rdf:label ?tiz
>>
>> then i would like to get :
>>
>> ?tiz = "tiz"^^xsd:string
>>
>> Thanks by advance,
>>
>
> BIND assigns function values to to new variables:
>
> foo bar ?baz
> BIND(IRI(str(?baz)) as ?baz_iri)
> ?baz_iri rdfs:label ?tiz

Re: [jena-arq] Cast a literal to an IRI

Posted by Andy Seaborne <an...@apache.org>.
On 06/01/16 18:49, Nicolas Paris wrote:
> Hello,
>
> Is there a way to cast a literal to an IRI within SPARQL in jena ?
> (link to sparql 1.1 doc)
> http://www.w3.org/TR/sparql11-query/#func-iri
>
> eg: I have got triple:
>
> foo bar "baz"^^anyUri
> baz rdf:label "tiz"^^xsd:string
>
> I would like to query  :
>
> foo bar ?baz
> IRI(?baz) rdf:label ?tiz
>
> then i would like to get :
>
> ?tiz = "tiz"^^xsd:string
>
> Thanks by advance,
>

BIND assigns function values to to new variables:

foo bar ?baz
BIND(IRI(str(?baz)) as ?baz_iri)
?baz_iri rdfs:label ?tiz