Hmmm... it seems then that this test poses some challenge for implementors because how can you go both choose to return anything, and pass the test? I guess if you want to extend the semantics in the places where you can, you just have to accept that you can't pass the DAWG tests 100%.
But, I'm further confused by the implementations test result matrix ( http://www.w3.org/2009/sparql/implementations/) , where it says ARQ passes 100% of the SPARQL Query Language tests, and indeed if I look up the functions plus-1 test, it shows as passed. From what I can tell though, the test was last run for ARQ in November 2012, so maybe the strings concatenation for the plus operator is new functionality since that time? Or is there an error with the test runner run by ARQ? On Mon, Apr 21, 2014 at 12:22 PM, Paul Gearon <[email protected]> wrote: > This is an ARQ extension to SPARQL. The expression (?x + ?y AS ?sum) is > only defined for numbers, meaning that it is undefined for string values, > even if they can be converted. If a result is "undefined" then it can be > returned as anything. > > Someone thought that it would be a good idea to have + duplicate the concat > operation when applied to strings. > > To explore further, section 17.5 points out that if a simple literal (which > is now of type xsd:string) has a lexical value that is compatible with a > target type, then a cast may be made: > http://www.w3.org/TR/sparql11-query/#FunctionMapping > > Since the + operator is only defined for numbers, then it may seem > reasonable to assume that this an implicit cast should be performed for the > strings "1" and "2", leading to a result of 3. However, casting is only > defined to occur when explicitly requested, as in: (xsd:integer(?x) + > xsd:integer(?y) AS ?sum). > > Regards, > Paul > > > > On Mon, Apr 21, 2014 at 1:39 PM, Tim Harsch <[email protected]> wrote: > > > Hi, > > I've been trying to figure out an issue with addition of strings in > > SPARQL. According to the DAWG evaluation test at: > > http://www.w3.org/2009/sparql/docs/tests/summary.html#functions-plus-1 > > "1" + "2" != "12", but ARQ run via Fuseki-1.0.1 would seem to disagree. > I > > also tried running the following similar query on dbpedia > > # :x6 :p "1" ; :q "2" . > > SELECT ?x ?y ( ?x + ?y AS ?sum) > > WHERE > > { > > VALUES( ?x ?y ) { > > ( "1" "2" ) > > } > > } > > ORDER BY ?x ?y ?sum > > > > and it seems to agree with the W3C expected results. Is this a bug in > ARQ? > > > > Thanks, > > Tim > > >
