w3c / rdf-star

RDF-star specification
https://w3c.github.io/rdf-star/
Other
119 stars 23 forks source link

Allow for triples in the VALUES clause #108

Closed hartig closed 3 years ago

hartig commented 3 years ago

By using the VALUES clause of SPARQL, users can specify solution mappings that feed into the evaluation process. Given that SPARQL-star solution mappings may bind variables to triples, the VALUES clause should be extended accordingly for SPARQL-star.

I propose to implement this idea by adding EmbTP as another alternative to the DataBlockValue production in the SPARQL grammar:

[65] DataBlockValue ::= EmbTP | iri | RDFLiteral | NumericLiteral | BooleanLiteral | 'UNDEF'

However, let's wait with this change until the work on PR #106 (annotation syntax for SPARQL-star) has been finished and that PR has been merged.

afs commented 3 years ago

There is a positive syntax test for embedded triples with VALUES included in PR #110.

hartig commented 3 years ago

Looks good. Thanks. The only issue: you have put it in the category of tests related to the annotation syntax while it is not actually related to the annotation syntax.

afs commented 3 years ago

Good point - will fix (side effect of dealing with many tests at once).

afs commented 3 years ago

Slight problem: EmbTP allows variables so use in [ ] DataBlockValue ::= EmbTP | ... allows variables, and we have variables in VALUES.

Here are some productions to address this:

[ ] DataBlockValue ::=  EmbTD | iri | RDFLiteral | NumericLiteral | BooleanLiteral | 'UNDEF'

[ ] EmbTP ::= ...
[ ] EmbTD ::= '<<' DataValueTerm ( iri | 'a' ) DataValueTerm '>>'
[ ] DataValueTerm  ::= EmbTD | iri | RDFLiteral | NumericLiteral | BooleanLiteral

DataValueTerm stops UNDEF inside a << >>. I've left DataBlockValue in full form so it is more like the SPARQL 1.1 text but it is also DataValueTerm | 'UNDEF'.

Putting EmbTD after EmbTP adds a little clarity.

(EmbTD is just following the naming style - there may be a better name).

I will add a bad syntax test case to PR #110.

The case of the use of <<>> and annotation syntax in INSERT DATA and DELETE DATA is already covered by grammar note 8 that bans variables.

hartig commented 3 years ago

Nice catch. Thanks!

JervenBolleman commented 3 years ago

I think the above is what @afs wrote. But jut to be clear all embedded triples used in a VALUE clause should be completely known, which is what I enforced for when working on implementing RDF-star for RDFlib. I used the name KnownEmbTP for what @afs calls EmbTD.

hartig commented 3 years ago

Yes, triples that can be passed via a VALUES clause as per this proposal here are RDF-star triples and not SPARQL-star triple patterns with variables.

hartig commented 3 years ago

During today's telco we have agreed to implement this proposal. I will create a PR for it.

hartig commented 3 years ago

PR #128 implements the proposal to add the option for triples in the VALUES clause.

hartig commented 3 years ago

Closing this issue as PR #128 has been merged now.