Search code examples
sparqlarq

How to convert string to URL with arq/tarql?


I got a TSV file that I'm converting with tarql.

Column prop has strings like dc:source, skos:broader etc. How can I convert these to the corresponding URLs? Assume I have all needed prefixes defined in the tarql query.

I can do this statically eg uri(concat(str(dc:),"source")) but how to do it dynamically? The problem can be narrowed to this: given a prefix dc: how to expand it to the appropriate URL?

Looked at ARQ functions but didn't find anything appropriate. If there's no other solution, I can use a VALUES table that repeats the prefixes and namespaces, but what an ugly solution...


Solution

  • The tarql:expandPrefixedName(?qname) function (completely coincidentally committed just today) does exactly what you need: It expands a prefixed name to a full IRI, using any prefixes declared in the query.

    The tarql namespace is declared implicitly in every Tarql query.