- From: Axel Polleres <axel.polleres@deri.org>
- Date: Tue, 30 Nov 2010 13:52:36 +0000
- To: SPARQL Working Group <public-rdf-dawg@w3.org>
I put in two test cases for using '+' for string concatenation and put them in the manifest within the expr-builtin directory: tests/data-r2/expr-builtin Data: @prefix : <http://example/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :x1 :p "a" ; :q 1 . :x2 :p _:b ; :q "1". :x3 :p :a ; :q "1". :x4 :p 1 ; :q 2 . :x5 :p 1.0 ; :q 2 . :x6 :p "1" ; :q "2" . :x7 :p "1"^^xsd:string ; :q "2" . :x8 :p "1"^^xsd:string ; :q 2 . plus-1: PREFIX : <http://example/> SELECT ?x ?y ( ?x + ?y AS ?sum) WHERE { ?s :p ?x ; :q ?y . } ORDER BY ?sum query q-plus-2.rq: PREFIX : <http://example/> SELECT ?x ?y ( str(?x) + str(?y) AS ?sum) WHERE { ?s :p ?x ; :q ?y . } ORDER BY ?sum I checked in results files (.srx) which reflect the *current* behaviour I assume of most engines, i.e. that "+" wouldn't work for concatentation. I assume - if we want to allow '+' for concatenation, what we'd want as results is the following: query q-plus-1.rq : --------------------------------------------------------------- | x | y | sum | =============================================================== | _:b0 | "1" | | | :a | "1" | | | "1" | "2" | "12" | <-- new! | 1 | 2 | 3 | | "1"^^<http://www.w3.org/2001/XMLSchema#string> | "2" | "12" | <-- new! | "1"^^<http://www.w3.org/2001/XMLSchema#string> | 2 | | | 1.0 | 2 | 3.0 | | "a" | 1 | | --------------------------------------------------------------- query q-plus-2.rq: ------------------------------------------------------------------------------ | x | y | sum | ============================================================================== | _:b0 | "1" | | | :a | "1" | "http://example/a1" | <-- new! | "1" | "2" | "12" | <-- new! | 1 | 2 | "12" | <-- new! | "1"^^<http://www.w3.org/2001/XMLSchema#string> | "2" | "12" | <-- new! | "1"^^<http://www.w3.org/2001/XMLSchema#string> | 2 | "12" | <-- new! | 1.0 | 2 | "1.02" | <-- new! | "a" | 1 | "a1" | <-- new! ------------------------------------------------------------------------------ comments welcome, Axel
Received on Tuesday, 30 November 2010 13:53:09 UTC