You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jerven Tjalling Bolleman <je...@sib.swiss> on 2017/11/06 14:22:32 UTC

ARQ substr does not quite match Xpath substr specifcation.

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


-- 
-------------------------------------------------------------------
Jerven Bolleman                        Jerven.Bolleman@sib.swiss
SIB Swiss Institute of Bioinformatics  Tel: +41 (0)22 379 58 85
CMU, rue Michel Servet 1               Fax: +41 (0)22 379 58 58
1211 Geneve 4,
Switzerland     www.sib.swiss - www.uniprot.org
Follow us at https://twitter.com/#!/uniprot
-------------------------------------------------------------------

Re: ARQ substr does not quite match Xpath substr specifcation.

Posted by Dave Reynolds <da...@gmail.com>.
On 06/11/17 14:45, 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)}"

It's a bash quoting issue, note that Andy's version uses ' for the outer 
quoting. You are losing the " characters around 1234567890 before it 
gets to sparql.

> 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)}'

Dave


Re: ARQ substr does not quite match Xpath substr specifcation.

Posted by Jerven Tjalling Bolleman <je...@sib.swiss>.
Thank you, yes that was silly!

My apologies for the noise.

On 11/06/2017 04:26 PM, Andy Seaborne wrote:
> 
> 
> 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
>>>>>
>>>>>
>>>
>>

-- 
-------------------------------------------------------------------
Jerven Bolleman                        Jerven.Bolleman@sib.swiss
SIB Swiss Institute of Bioinformatics  Tel: +41 (0)22 379 58 85
CMU, rue Michel Servet 1               Fax: +41 (0)22 379 58 58
1211 Geneve 4,
Switzerland     www.sib.swiss - www.uniprot.org
Follow us at https://twitter.com/#!/uniprot
-------------------------------------------------------------------

Re: ARQ substr does not quite match Xpath substr specifcation.

Posted by Andy Seaborne <an...@apache.org>.

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
>>>>
>>>>
>>
> 

Re: ARQ substr does not quite match Xpath substr specifcation.

Posted by Jerven Tjalling Bolleman <je...@sib.swiss>.
Of course to make it even stranger

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

Does work as expected!

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
>>>
>>>
> 

-- 
-------------------------------------------------------------------
Jerven Bolleman                        Jerven.Bolleman@sib.swiss
SIB Swiss Institute of Bioinformatics  Tel: +41 (0)22 379 58 85
CMU, rue Michel Servet 1               Fax: +41 (0)22 379 58 58
1211 Geneve 4,
Switzerland     www.sib.swiss - www.uniprot.org
Follow us at https://twitter.com/#!/uniprot
-------------------------------------------------------------------

Re: ARQ substr does not quite match Xpath substr specifcation.

Posted by Jerven Tjalling Bolleman <je...@sib.swiss>.
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
>>
>>

-- 
-------------------------------------------------------------------
Jerven Bolleman                        Jerven.Bolleman@sib.swiss
SIB Swiss Institute of Bioinformatics  Tel: +41 (0)22 379 58 85
CMU, rue Michel Servet 1               Fax: +41 (0)22 379 58 58
1211 Geneve 4,
Switzerland     www.sib.swiss - www.uniprot.org
Follow us at https://twitter.com/#!/uniprot
-------------------------------------------------------------------

Re: ARQ substr does not quite match Xpath substr specifcation.

Posted by Andy Seaborne <an...@apache.org>.
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
> 
>