Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The SPARQL grammar allows () in reified triples and triple terms. #157

Closed
afs opened this issue Sep 26, 2024 · 2 comments · Fixed by #159
Closed

The SPARQL grammar allows () in reified triples and triple terms. #157

afs opened this issue Sep 26, 2024 · 2 comments · Fixed by #159
Assignees
Labels
spec:bug Change fixing a bug in the specification (class 3) –see also spec:substantive

Comments

@afs
Copy link
Contributor

afs commented Sep 26, 2024

In SPARQL, () is a parser token NIL.

It allows () to be used as a term in its own right, not just in RDF collections (....). e.g. in VALUES and expressions. this is in SPARQL 1.1.

The grammar in the current editors working draft allows:

<< _:b ex:x () >>
<<( _:b ex:x () )>>

Turtle is different. Parentheses only occur in collection ::= '(' object* ')'.

The SPARQL grammar changed to align with Turtle for reified triples and triple terms.

From: w3c/rdf-tests#140 (comment)

@afs afs added the spec:bug Change fixing a bug in the specification (class 3) –see also spec:substantive label Sep 26, 2024
@afs afs self-assigned this Sep 26, 2024
@afs afs changed the title The SPARQL grammar allows () in reified triples triple terms. The SPARQL grammar allows () in reified triples and triple terms. Sep 26, 2024
@kasei
Copy link
Contributor

kasei commented Sep 28, 2024

I think I'd be OK forbidding this in triple terms and reified triples, as the use of () as a term is an affordance for dealing with collections of unknown size. But if we're not supporting non-empty collections, I don't see a need to support NIL, even if it avoids the primary issue of TT/RF that might syntactically represent multiple triples. And alignment with Turtle here would be good (though it seems the current Turtle spec draft does support collections in reified triples, which I think w3c/rdf-turtle#71 seeks to fix).

@afs
Copy link
Contributor Author

afs commented Sep 29, 2024

NIL seems to be a SPARQL 1.0-ism - an easy way to handle () as zero-lists and as zero argument functions.

But it is allowed in VALUES which has to call it out specially. It is also treated in special ways in functions.

Not for this PR - maybe the grammar can be made more regular (and still the same language) by removing NIL as a terminal and replacing it by LPAREN/RPAREN.

Recorded as: #160

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:bug Change fixing a bug in the specification (class 3) –see also spec:substantive
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants