Data about a named graph in the default graph joined with data inside that graph.
data/trig-graph-join-n3.trig · trig-graph-join-n3.n3 · output · proof · check · playground
The question
Who reported a sensor whose reading lives inside a named graph?
Historical background
Named-graph research used graph identifiers to connect a graph with facts about its origin. TriG became a W3C Recommendation in 2014 and provided a syntax for datasets containing both named and default graphs. The reporter example puts the report in one graph and uses its name to find the reporter elsewhere. Named Graphs, Provenance and Trust · W3C, RDF 1.1 TriG
What the program says
data/trig-graph-join-n3.trig:
# The default graph names the station that reported the sensor graph.
# The sensor graph holds a temperature reading, quoted by graph:content.
# Joining these two contexts concludes who reported the sensor, in the
# default graph; log:includes inspects the quoted reading without asserting it.
@prefix : <https://example.org/> .
:sensorGraph :reportedBy :station7 .
:sensorGraph {
:sensor1 :temperature "21.5" .
}
trig-graph-join-n3.n3:
# The default graph names the station that reported the sensor graph.
# The sensor graph holds a temperature reading, quoted by graph:content.
# Joining these two contexts concludes who reported the sensor, in the
# default graph; log:includes inspects the quoted reading without asserting it.
@prefix : <https://example.org/> .
@prefix graph: <https://eyereasoner.github.io/eyemind/graph#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
{
:sensorGraph :reportedBy ?station ; graph:content ?data .
?data log:includes { ?sensor :temperature ?value } .
} => { ?sensor :reportedBy ?station } .
What eyemind concludes
The command writes these conclusions in its native output format:
@prefix : <https://example.org/> .
:sensor1 :reportedBy :station7 .
The default graph says station7 reported sensorGraph. graph:content names the formula containing sensor1’s temperature; log:includes inspects it. Their join concludes that sensor1 was reported by station7, as a default-graph triple.
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/sensor1'), iri('https://example.org/reportedBy'), iri('https://example.org/station7'))
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-graph-join-n3.trig examples/trig-graph-join-n3.n3
node bin/eyemind.js --proof examples/data/trig-graph-join-n3.trig examples/trig-graph-join-n3.n3
node bin/eyemind.js --check-proof examples/proof/trig-graph-join-n3.js examples/data/trig-graph-join-n3.trig examples/trig-graph-join-n3.n3
