Ancestors in a named graph

Ancestors derived within a TriG named graph, each conclusion kept in its named-graph formula.

data/trig-named-graph-n3.trig · trig-named-graph-n3.n3 · output · proof · check · playground


The question

How can ancestor conclusions stay attached to their family graph?


Historical background

Work on named graphs in 2005 tied the identity of a graph to its provenance and use. RDF 1.1 later standardized datasets and TriG in 2014. Here the graph names stay attached to the data as the ancestry rules run within each graph. Carroll, Bizer, Hayes and Stickler, Named Graphs, Provenance and Trust · W3C, RDF 1.1 TriG


What the program says

data/trig-named-graph-n3.trig:

# Alice is Bob's parent and Bob is Carol's in the family named graph.
# The loader represents its contents as a quoted graph:content formula.
# Two rules conclude the three ancestor links in formulas with the same name;
# none of those links is asserted in the default graph.
@prefix : <https://example.org/> .

:family {
  :alice :parent :bob .
  :bob :parent :carol .
}

trig-named-graph-n3.n3:

# Alice is Bob's parent and Bob is Carol's in the family named graph.
# The loader represents its contents as a quoted graph:content formula.
# Two rules conclude the three ancestor links in formulas with the same name;
# none of those links is asserted in the default graph.
@prefix : <https://example.org/> .
@prefix graph: <https://eyereasoner.github.io/eyemind/graph#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{
  ?g graph:content ?data .
  ?data log:includes { ?s :parent ?o } .
} => { ?g graph:content { ?s :ancestor ?o } } .

{
  ?g graph:content ?data .
  ?data log:includes { ?s :parent ?m . ?m :parent ?o } .
} => { ?g graph:content { ?s :ancestor ?o } } .

What eyemind concludes

The command writes these conclusions in its native output format:

@prefix : <https://example.org/> .
@prefix graph: <https://eyereasoner.github.io/eyemind/graph#> .

:family graph:content { :alice :ancestor :bob } .
:family graph:content { :bob :ancestor :carol } .
:family graph:content { :alice :ancestor :carol } .

The loader writes the TriG family graph as a graph:content formula. log:includes matches parent links only inside that formula. Each conclusion is a new formula with the same graph name: Alice is an ancestor of Bob and Carol, and Bob of Carol. These formulas describe named-graph content; their enclosed triples are not default-graph assertions.

The check report records the corresponding claims as JavaScript expressions:

// Checked answers: these follow from the input program and are every answer of its questions.
rdf(iri('https://example.org/family'), iri('https://eyereasoner.github.io/eyemind/graph#content'), graph([rdf(iri('https://example.org/alice'), iri('https://example.org/ancestor'), iri('https://example.org/bob'))]))
rdf(iri('https://example.org/family'), iri('https://eyereasoner.github.io/eyemind/graph#content'), graph([rdf(iri('https://example.org/bob'), iri('https://example.org/ancestor'), iri('https://example.org/carol'))]))
rdf(iri('https://example.org/family'), iri('https://eyereasoner.github.io/eyemind/graph#content'), graph([rdf(iri('https://example.org/alice'), iri('https://example.org/ancestor'), iri('https://example.org/carol'))]))

What the proof establishes

The saved report ends with verdict('checked').

The checker reads the clauses from the compiled program, not from the proof, and never calls the reasoning engine. It answers the original questions from the proof’s call tables, checking each table by expanding its call one level against the program; it requires each derived listing to be closed under the forward rules; and it replays the recorded firing of each listed fact, computing primitives again. A step, table or listing the check does not use fails it.

The verdict establishes that the displayed claims follow from the compiled program and are every answer of its original questions.


Try it

From the repository root:

node bin/eyemind.js examples/data/trig-named-graph-n3.trig examples/trig-named-graph-n3.n3
node bin/eyemind.js --proof examples/data/trig-named-graph-n3.trig examples/trig-named-graph-n3.n3
node bin/eyemind.js --check-proof examples/proof/trig-named-graph-n3.js examples/data/trig-named-graph-n3.trig examples/trig-named-graph-n3.n3