Cast literal to uri

How can I cast a literal object value to a URI that I can use as a predicate value?

I tried this:

prefix ais: <>

select *
where {
  ?i a ais:AssignmentContext .
  ?i ais:physical_column_name ?l .
  ?i uri(fn:concat("ais:", ?l))

but got an error.

Hi Phil!

The function you are looking for is called iri().


In the larger context of your query, you need to use BIND in order to use the generated IRI as a predicate variable, e.g.:

BIND(iri(fn:concat("ais:", ?l)) AS ?pred)
?i ?pred ?obj

Thanks Jess, what do you use for the fn: prefix

I tried prefix fn:
but got an internal server error. worked

CONCAT() is a builtin function so can also call it without any prefix just like you do with IRI()

Yes, that works nicely also.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.