Warning:
This wiki has been archived and is now read-only.

CommentResponse:PA-1

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: <http://www.w3.org/2005/xpath-functions#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX myLibrary: <http://mylibrary.example/>

CONSTRUCT { ?s skos:prefLabel ?label . 
           ?s myLibrary:hasAlternateURI ?u }
WHERE { { SELECT ?s (IRI(fn:concat("http://otherlibrary.example/",
           fn:encode-for-uri(?label),
           "/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

1. http://www.w3.org/2009/sparql/wiki/Feature:FunctionLibrary#XQuery_1.0_and_XPath_2.0_Functions_and_Operators