How do you concatenate strings in SPARQL?

Is there a way to concatenate strings in SPARQL? For example:

?concatvar = ?var + "append_text" Assign string variable to another string variable plus concatenated text.

Specifically, I am using Jena and ARQ.

Thank you

Firstly you need fn:concat(string, string, ...), where fn is See the ARQ library function documentation for more information.

Secondly you need to assign the result. There is no way (currently) in SPARQL to do this, but ARQ provides the following syntax extensions: (You will need to use the Syntax.syntaxARQ option)

SELECT ( fn:concat(?var, "append_text") AS ?concatvar ) WHERE ....

Select expressions

SELECT ?concatvar WHERE {
  LET ( ?concatvar := fn:concat(?var, "append_text") )


The former, and perhaps the latter, will appear in SPARQL 1.1.

SPARQL 1.1 adds CONCAT(...) which is fn:concat from XPtha/XQuery functions and operators.

ARQ overload + as well:


but that is a legal extension, not part of the base SPARQL standard. fn:concat(string, ...)

I just accomplished this using the ARQ functions:

   ?concat <> ("<a href='" ?url "'>Link Text</a>") .