An RDF 1.2 annotation: an asserted triple recovered with the reifier that records who stated it and when.
data/annotation-n3.ttl · annotation-n3.n3 · output · proof · check · playground
The question
Which asserted statement has both an identified source and a recorded date?
Historical background
RDF 1.2 developed a compact syntax for writing an asserted triple and its annotation together. A reifier identifies the statement for the purposes of attaching facts such as a speaker or date. This example follows that connection back to the triple being annotated. W3C, RDF 1.2 Turtle
What the program says
data/annotation-n3.ttl:
# Alice's asserted name has a reifier recording who stated it and when.
# A query returns the triple and its annotations only when they occur together,
# showing RDF 1.2 reification and preserving the date's datatype.
@prefix : <https://example.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
:alice :name "Alice" ~ :claim1 .
:claim1 :statedBy :carol ;
:recorded "2025-01-15"^^xsd:date .
annotation-n3.n3:
# Alice's asserted name has a reifier recording who stated it and when.
# A query returns the triple and its annotations only when they occur together,
# showing RDF 1.2 reification and preserving the date's datatype.
@prefix : <https://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
{
?s ?p ?o .
?reifier rdf:reifies <<( ?s ?p ?o )>> ; :statedBy ?source ; :recorded ?date .
} log:query {
?s ?p ?o .
?reifier rdf:reifies <<( ?s ?p ?o )>> ; :statedBy ?source ; :recorded ?date .
} .
What eyemind concludes
The command writes these conclusions in its native output format:
@prefix : <https://example.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
:alice :name "Alice" .
:claim1 rdf:reifies <<( :alice :name "Alice" )>> .
:claim1 :statedBy :carol .
:claim1 :recorded "2025-01-15"^^xsd:date .
The query joins the asserted triple with its reifier, source and date. It reports those four triples together, preserving the date datatype.
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.
result(iri('https://example.org/alice'), iri('https://example.org/name'), literal('Alice', datatype('http://www.w3.org/2001/XMLSchema#string')))
result(iri('https://example.org/claim1'), iri('http://www.w3.org/1999/02/22-rdf-syntax-ns#reifies'), triple(iri('https://example.org/alice'), iri('https://example.org/name'), literal('Alice', datatype('http://www.w3.org/2001/XMLSchema#string'))))
result(iri('https://example.org/claim1'), iri('https://example.org/statedBy'), iri('https://example.org/carol'))
result(iri('https://example.org/claim1'), iri('https://example.org/recorded'), literal('2025-01-15', datatype('http://www.w3.org/2001/XMLSchema#date')))
What the proof establishes
The saved report ends with verdict('checked'). The proof holds the four
claims, four steps recording the firing of the query rule behind each one,
a derived(...) listing of those facts and a called(...) table of every
answer of the question. The checker answers the question from that table,
expanding it one level against the compiled program, requires the listing to
be closed under the rules, and replays each recorded firing. It follows the
certificate without calling the reasoning engine.
The verdict checked establishes that the four claims follow from the program and are every answer of its question.
Try it
From the repository root:
node bin/eyemind.js examples/data/annotation-n3.ttl examples/annotation-n3.n3
node bin/eyemind.js --proof examples/data/annotation-n3.ttl examples/annotation-n3.n3
node bin/eyemind.js --check-proof examples/proof/annotation-n3.js examples/data/annotation-n3.ttl examples/annotation-n3.n3
