Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [rdf4j-dev] Substring implementation difference between jena, rdf4j and virtuoso

Hi Jeen, Håvard,

I think the bug is on our side.
I opened a pull request with what I think matches the xpath spec.
Added all the examples as test cases.

Hope, I did it ok. Still forgetting to commit with -s :(

Pulling this in is not urgent for me. I found out that
this allows a "wrong" query to return a "right" result.
Fixing my own queries is good enough for me, but I think
we should be exact in regards to matching specs.

We should have a preprint out with the why of the queries
by next week.

Regards,
Jerven

On 2019-03-24 21:33, Håvard Ottestad wrote:
Relevant from the xml spec:

The expression fn:substring("12345", 0, 3) returns "12". _(Characters
at positions greater than or equal to 0 and less than 3 are selected.
Since the first position is 1, these are the characters at positions 1
and 2.)_

So it’s perfectly legal to do substring(“a”, -9999, 9999), which
returns “a”.

Håvard

On 24 Mar 2019, at 21:25, Jeen Broekstra <jeen.broekstra@xxxxxxxxx>
wrote:

Good find Jerven.

You might also file a bug with Jena for the 0, 1 edge case. I only
glanced at the spec but it seems to me that in that case the answer
should still be "A", not the empty string.

Cheers,

Jeen

On Mon, 25 Mar. 2019, 05:25 Jerven Tjalling Bolleman,
<Jerven.Bolleman@sib.swiss> wrote:

Hi James, All,

I didn't see an example with startingLoc less than 1.

However, one document down in the xpath-functions one there is
clarity.
https://www.w3.org/TR/xpath-functions/#func-substring
And I should have looked at that first.

I think this means edge case non conformance bugs in rdf4j and
virtuoso.

I will propose a fix for it in rdf4j and file a bug for it for
virtuoso.

i.e. SUBSTR("ABC", 0, 2)
should return "A" because only for position 1
does fn:round(0) <= 1 and 1 < fn:round(0) + fn:round(2) hold

Regards,
Jerven

On 2019-03-24 17:38, james anderson wrote:
On 2019-03-24, at 15:34:55, Jerven Tjalling Bolleman
<jerven.bolleman@sib.swiss> wrote:

Hi All,

Cross posting as this seems to be a question of spec
implementation
and I am not sure what the correct answer is supposed to be.

look at the examples in the document which you referenced.

best regards, from berlin,
---
james anderson | james@xxxxxxxxx | http://dydra.com [1]

--
Jerven Tjalling Bolleman
SIB | Swiss Institute of Bioinformatics
CMU - 1, rue Michel Servet - 1211 Geneva 4
t: +41 22 379 58 85 - f: +41 22 379 58 58
Jerven.Bolleman@sib.swiss - http://www.sib.swiss [2]

_______________________________________________
rdf4j-dev mailing list
rdf4j-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/rdf4j-dev
_______________________________________________
rdf4j-dev mailing list
rdf4j-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/rdf4j-dev



Links:
------
[1] http://dydra.com/
[2] http://www.sib.swiss/

--
Jerven Tjalling Bolleman
SIB | Swiss Institute of Bioinformatics
CMU - 1, rue Michel Servet - 1211 Geneva 4
t: +41 22 379 58 85 - f: +41 22 379 58 58
Jerven.Bolleman@sib.swiss - http://www.sib.swiss



Back to the top