From SPARQL Working Group
Jump to: navigation, search

Hi Peter,

Sorry for the delayed answer. Note that your proposed query doesn't work as such in SPARQL1.1: first, it overloads "+" as string concatenation and uses expressions in the CONSTRUCT template. You can use fn:concat from from XPath/Xquery Functions&Operators here. Also, as alternative for example:percentEncode, it seems you could likewise consider fn:encode-for-uri.

This said, your query would be expressible following the current draft of SPARQL 1.1 by subqueries as follows:

PREFIX fn: <>
PREFIX skos: <>
PREFIX myLibrary: <http://mylibrary.example/>

CONSTRUCT { ?s skos:prefLabel ?label . 
           ?s myLibrary:hasAlternateURI ?u }
WHERE { { SELECT ?s (IRI(fn:concat("http://otherlibrary.example/",
           "/lang/",fn:encode-for-uri(lang(?label)))) AS  ?u )
        WHERE { ?s skos:prefLabel ?label . } } }

Please note that not every SPARQL1.1 compliant implementation is supposed to support all of the XPath/Xquery functions, we are currently discussing which additional functions to add to the standard library. In fact, fn:concat and fn:encode-for-uri are on the list of proposed functions for such an extension of the standard function library [1] so they would become normative and thus should be supported by SPARQL1.1 compliant implementations.

Also, note that the actual syntax may still change, in fact, the group is discussing whether to take your proposal on board to allow '+' as a shortcut notation for string concatenation (fn:concat).

Hope this clarfies matters, and thanks for your comment again, with best regards, Axel