w3c / rdf-star

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

Add N-Triples* and N-Quads* sections #87

Closed gkellogg closed 3 years ago

gkellogg commented 3 years ago

… as part of a new Concrete Syntaxes Section, which also includes Turtle*.

Fixes #16.


Preview | Diff

gkellogg commented 3 years ago

The minimal N-Quads* section presumes that only embedded triples, not embedded-quads, are defined.

Unlike Turtle, N-Triples does not define curSubject, curObject, or curPredicate. Although described recursively, it does not seem to be necessary in this case, but the notion of what the subject, predicate, and object are is dependent on where you are in the recursive processing order.

pchampin commented 3 years ago

That's great, thanks.

The minimal N-Quads* section presumes that only embedded triples, not embedded-quads, are defined.

My assumption was that N-Quads was for serializing RDF datasets, as defined by https://w3c.github.io/rdf-star/rdf-star-cg-spec.html#concepts, so indeed there is no notion of embedded-quads at the moment. Discussion about it is still possible, of course, and has actually already been started in #49 .

Unlike Turtle, N-Triples does not define curSubject, curObject, or curPredicate. Although described recursively, it does not seem to be necessary in this case, but the notion of what the subject, predicate, and object are is dependent on where you are in the recursive processing order.

I'm personally satisfied with the current wording of the Parsing section.

hartig commented 3 years ago

This PR looks good to me. Thanks @gkellogg!

The minimal N-Quads* section presumes that only embedded triples, not embedded-quads, are defined.

Yes, that's the case.

pchampin commented 3 years ago

This has been discussed in today's call: https://w3c.github.io/rdf-star/Minutes/2021-02-05.html#item02

TallTed commented 3 years ago

I'm trying and failing to understand why the named graphs in an N-Quads file are always (a/k/a MUST be) RDF graphs (unlike the default graph in the same N-Quads file), and cannot be RDF* graphs.

gkellogg commented 3 years ago

I'm trying and failing to understand why the named graphs in an N-Quads file are always (a/k/a MUST be) RDF graphs (unlike the default graph in the same N-Quads file), and cannot be RDF* graphs.

I’ll leave rationale for others as to why this is true for RDF-star in general, but from the grammar, there is no syntax for creating triples in anything other than the default graph. That is my understanding of the basis for RDF-star, and the fact that named graphs do not allow embedded triples is a direct consequence of that.

hartig commented 3 years ago

I am with @TallTed here. The named graphs in an RDF dataset are RDF graphs. Hence, the N-Quads* format should be defined to support that.

hartig commented 3 years ago

After having looked at the grammar now, I think it is supported. The fact that the subject and object production in the grammar are extended in the same way as for N-Triples* is sufficient for this purpose.

gkellogg commented 3 years ago

After having looked at the grammar now, I think it is supported. The fact that the subject and object production in the grammar are extended in the same way as for N-Triples* is sufficient for this purpose.

That may be, although I disagree, but it seems like a change with a number of implications for the semantics. I think it requires more discussion, and I’d rather not hold back the PR. Perhaps we should (temporarily) just eliminate the N-Quads* section until this has been properly discussed.

hartig commented 3 years ago

but it seems like a change with a number of implications for the semantics

I am not sure I understand. What change do you mean?

Notice that none of what I am talking about above has anything to do with embedded quads. Instead, I am talking about the fact that embedded triples can be used in the subject position and the object position of any line within an N-Quads* file (but not in the fourth/graph position and, of course, also not in the predicate position).

For instance, the following may be a line in an N-Quads* file:

<< <http://ex.com/a> <http://ex.com/b> <http://ex.com/c> >> <http://ex.com/pp> "oo" <http://ex.com/graph> .

A line such as this is possible by the current grammar (i.e., using the modified N-Triples productions in the N-Quads grammar), and that's fine. It has to be parsed into an RDF dataset with a named graph with name http://ex.com/graph such that this graph is an RDF* graph that contains the nested triple ((http://ex.com/a, http://ex.com/b, http://ex.com/c), http://ex.com/graph, "oo"). I don't see a problem with that. Am I missing something?

gkellogg commented 3 years ago

but it seems like a change with a number of implications for the semantics

I am not sure I understand. What change do you mean?

No, you're right. I was mis-reading the conversation, and did not properly characterize an RDF-star dataset, which of course is allows embedding within named graphs. I had thought that there was expected to be a transference of the graph name component into the embedded triples, which is where the semantic issues would arise. I'll update the PR to re-characterize an RDF-star dataset.

gkellogg commented 3 years ago

I'll do a final review and make any further changes I think are needed, or indicate that I think we're ready to merge.

gkellogg commented 3 years ago

Okay, I think this is probably ready to be merged.