On 06/11/17 15:13, Jerven Tjalling Bolleman wrote:
Of course to make it even stranger

sparql -v "select * where {BIND(substr(str("1234567890"), 0, 11) AS ?substr)}"

Does work as expected!

Because the expression is
substr(str(1234567890), 0, 11)

"1234567890" becomes integer 1234567890 due to the quoting. bash allows quoting in the middle of arguments. Unlike some other OS shells, bash evaluates quotes before passing to the command.

   Andy

>> echo "ABC"DEF'GHI'
ABCDEFGHI
>>


Regards,
Jerven

   1 SELECT  ?substr
   2 WHERE
   3   { BIND(substr(str(1234567890), 0, 11) AS ?substr) }

16:13:39 INFO  exec                 :: QUERY
   SELECT  ?substr
   WHERE
     { BIND(substr(str(1234567890), 0, 11) AS ?substr) }
16:13:39 INFO  exec                 :: ALGEBRA
   (project (?substr)
     (extend ((?substr "1234567890"))
       (table unit)))

On 11/06/2017 03:45 PM, Jerven Tjalling Bolleman wrote:
Dear Andy,

That makes it very strange because this is what I get

$ sparql --version
Jena:       VERSION: 3.4.0
Jena:       BUILD_DATE: 2017-07-17T11:43:07+0000
ARQ:        VERSION: 3.4.0
ARQ:        BUILD_DATE: 2017-07-17T11:43:07+0000
RIOT:       VERSION: 3.4.0
RIOT:       BUILD_DATE: 2017-07-17T11:43:07+0000

$ sparql -v "select ?substr where {BIND(substr("1234567890", 0, 11) AS ?substr)}"
   1 SELECT  ?substr
   2 WHERE
   3   { BIND(substr(1234567890, 0, 11) AS ?substr) }

15:43:31 INFO  exec                 :: QUERY
   SELECT  ?substr
   WHERE
     { BIND(substr(1234567890, 0, 11) AS ?substr) }
15:43:31 INFO  exec                 :: ALGEBRA
   (project (?substr)
     (extend ((?substr (substr 1234567890 0 11)))
       (table unit)))
----------
| substr |
==========
|        |
----------

Regards,
Jerven

On 11/06/2017 03:34 PM, Andy Seaborne wrote:
I get "1234567890" (jena v 3.5.0)

sparql -v 'select ?substr where {BIND(substr("1234567890", 0, 11) AS ?substr)}'

   1 SELECT  ?substr
   2 WHERE
   3   { BIND(substr("1234567890", 0, 11) AS ?substr) }

----------------
| substr       |
================
| "1234567890" |
----------------

I get this for versions back to 2.10.0.

     Andy

On 06/11/17 14:22, Jerven Tjalling Bolleman wrote:
Dear Jena-Devs,

I believe that the following query

select ?substr where {BIND(substr("1234567890", 0, 11) AS ?substr)}

should return


| substr       |
================
| "1234567890" |

instead of the current

| substr |
==========
|        |


I take this from reading the spec here.
https://www.w3.org/TR/xpath-functions/#func-substring

If people agree with my reading I will be happy to submit a patch.

Regards,
Jerven




Reply via email to