Re: ACTION-330 test cases around '+' for string concatenation

On 30 Nov 2010, at 13:52, Axel Polleres wrote:

> 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

Ooops, I realise I should move this to data-sparql11 in an own subdirectory...

moved new test cases to 

  data-sparql11/function-library/

which imo should also be the place for test cases regarding new functions.

Axel

> 
> 
> 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 14:19:23 UTC