Bovlb patch 1 by bovlb · Pull Request #2931 · RDFLib/rdflib (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation5 Commits7 Checks20 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

bovlb

Summary of changes

The following SPARQL where clause:

?s :hasIngredient [:name "chicken"], [:name "butter"] .

should be parsed as:

_:1 :name "butter" .
_:2 :name "chicken" .
?s :hasIngredient _:1 .
?s :hasIngredient _:2

but was instead being parsed as:

_:1 :name "chicken" .
_:1 :name _:2 .
_:2 :name "butter" .
?s :hasIngredient _:1

I fixed the bug and added a new test.

Checklist

@bovlb

@bovlb

@pre-commit-ci

@coveralls

Coverage Status

coverage: 90.293% (-0.006%) from 90.299%
when pulling e287709 on bovlb:bovlb-patch-1
into 9c469b5 on RDFLib:main.

@ashleysommer

Wow. Thanks. I can't believe a bug like that in the SPARQL parser has existed undetected for so long.
Was the bug only when the two bnodes are on the same line? Did it have the same problem when thee bnodes were separated over two lines like this?

?s :hasIngredient [:name "chicken"],
                  [:name "butter"] .

@bovlb

Wow. Thanks. I can't believe a bug like that in the SPARQL parser has existed undetected for so long.

I didn't believe it at first myself.

Was the bug only when the two bnodes are on the same line? Did it have the same problem when thee bnodes were separated over two lines like this?

That doesn't change the token sequence, so it's the same problem.

The bug was that we were assuming a comma implied we should repeat the third-last and second-last results as the subject and object of the new triple. This assumption didn't hold when we had inserted a triple from a blank node.

@bovlb bovlb deleted the bovlb-patch-1 branch

October 16, 2024 04:10