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: <http://AIS.org/>

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

but got an error.
Thanks
phil

Hi Phil!

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

Best,
Jess

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: http://www.w3.org/2005/xpath-functions#concat
but got an internal server error.

http://www.w3.org/2005/xpath-functions# 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.
Thanks

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