Skip to content

Aligning with semantics of RDF Datasets #1

Open
@sandhawke

Description

@sandhawke

From mailing list thread

The semantics of "named graphs" (part of a formalism called "RDF Datasets") are not exactly what one might expect, or perhaps what one might want. As RDF 1.1 Concepts and Abstract Syntax says:

Despite the use of the word “name” in “named graph”, the graph name is not required to denote the graph. It is merely syntactically paired with the graph. RDF does not place any formal restrictions on what resource the graph name may denote, nor on the relationship between that resource and the graph. A discussion of different RDF dataset semantics can be found in [RDF 1.1: On Semantics of RDF Datasets].

This is going to make it hard to use named graphs for N3. We can't just say that:

{ ...g1... } log:implies { ...g2... }

is represented in an RDF Dataset like this (using TriG with the optional GRAPH keyword for clarity and to match SPARQL):

GRAPH _:g1 { ...g1...}
GRAPH _:g2 { ...g2...}
_:g1 log:implies _:g2

because the blank nodes _:g1 and _:g2 aren't actually constrained by any specification to denote the graphs they are paired with.

This may look like a foolish oversight in the design of RDF Datasets, but the reality at the time was people had implemented and were using Named Graph / Quad systems with a variety of different semantics (as enumerated in RDF 1.1: On Semantics of RDF Datasets, and there was no proposal for a single semantics that had anything like consensus.

So, what are our options now? Here's what I see:

Option 1. Override and/or update that decision in the specification of RDF Datasets. This might be possible if there is currently a consensus that did not exist at the time. I think this is unlikely, but if someone wants to pursue this, they should start by building a complete survey of folks using RDF Datasets and the semantics of their usage. If it turns out here's rough consensus, there might be a path forward here.

Option 2. Override and/or update that decision in the specification of RDF Datasets for some specific cases. I'm thinking in particular that when using blank nodes as graph labels in datasets it's much more likely everyone is using the same semantics. But this is still probably too hard. Still, I find this very tempting.

Option 3. Explicitly convey the intended semantics of each RDF Dataset. One example is provided in Section 4. Declaring the intended sematics, and Ruben's email gives another It's a bit of work, but not too bad, I think. One challenge is that the "<>" construct doesn't work in N-Quads. (More specifically, I don't think there's any way to convey metadata in N-Quads that doesn't depend on knowing exactly the URL for that N-Quads content. Maybe worth adding a construct like "#self=<...>".)

Option 4. Convey the intended semantics of RDF Datasets more subtly, eg by using certain predicates. For example, consider

_:g1 ex:fetchedFrom <https://example.org/g1>.
_:g1 { ... some triples }    

and imagine we define ex:fetchedFrom to include our intended dataset semantics. If we're making up a new predicate, this can't conflict with any current usage, so I'm guessing this would work find in practice, even if it feels odds, like it's breaking levels. But I think it works, and we'll have the same issue with defining variables.

Option 5. Use lists instead of RDF Datasets. For example:

( (:s1 :p1 :o1) (:s2 :p2 :o2) ... ) ex2:fetchedFrom <https://example.org/g1>.

Let's call that thing on the left an SPOList, a list of triples, where each triple is a list of subject, predicate, object. This is looking pretty good to me right now. At this point, we can break out some more of LISP and represent formulas rather elegantly: (:forall :x (implies ((:x a :Man)) ((:x a :Mortal))))

Again, this is just a way to represent graphs in RDF triples; the surface syntax can still use ? for variables and { } for graphs.

Any other options?

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferDeferring this issue until we have established the N3 standard.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions