Chain stratification

No strata, yet one intended result.

chain-stratification-n3.n3 · output · proof · check · playground


The question

Teachers of a course who are not students examine it. The negation must wait until every student is known, but the subproperty rule { ?p rdfs:subPropertyOf ?q . ?x ?p ?y } => { ?x ?q ?y } can derive a triple of any predicate, rdf:type included, from a fact of any predicate, the examiner relation included. So the rules have no strata because whether a teacher is a student might depend on who examines. Can eyemind accept these rules with the three constraints in the example?


Historical background

Küchenmeister, Ivliev, Arndt and Krötzsch proposed chain stratification in 2026 to analyze dependencies that ordinary predicate stratification misses in RDF rules. Their teacher-and-examiner example turns on subproperty propagation. A chain analysis can use the constraints to exclude routes through which that propagation would make the negation self-dependent. Stratified Negation in RDF Rules


What the N3 says

:c1 :participant :ann .
:c1 :teacher :ann, :tim .
:teacher rdfs:subPropertyOf :staff .

{ ?c :participant ?p } => { ?p a :Student } .
{ ?c :teacher ?p . [] log:notIncludes { ?p a :Student } } => { ?c :examiner ?p } .
{ ?p rdfs:subPropertyOf ?q . ?q rdfs:subPropertyOf ?r } => { ?p rdfs:subPropertyOf ?r } .
{ ?p rdfs:subPropertyOf ?q . ?x ?p ?y } => { ?x ?q ?y } .

{ :examiner rdfs:subPropertyOf :participant } => false .
{ :examiner rdfs:subPropertyOf rdfs:subPropertyOf } => false .
{ :examiner rdfs:subPropertyOf rdf:type } => false .

What gets compiled

The examiner rule compiles to a forward rule with a negation:

implies([rdf(C, iri("http://example.org/teacher"), P), not(rdf(P, iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), iri("http://example.org/Student")))], rdf(C, iri("http://example.org/examiner"), P))

Its negated goal unifies with the subproperty rule’s head rdf(X, Q, Y), which depends on the examiner rule’s own head, so ordinary stratification fails. eyemind then follows every chain of rule applications that starts with an examiner fact. A chain reaches rdf(P, type, Student) only by making the examiner relation a subproperty of participation, of subPropertyOf or of rdf:type, and each of those satisfies a constraint. The examiner rule therefore runs in a rank of its own, after the others.


What eyemind concludes

:ann a :Student .
:c1 :staff :ann .
:c1 :staff :tim .
:c1 :examiner :tim .

The check report records the examiner:

rdf(iri('http://example.org/c1'), iri('http://example.org/examiner'), iri('http://example.org/tim'))

Ann participates, so she is a student and no examiner. Both teachers are staff, through the subproperty. Tim examines.


What the proof establishes

The report ends with verdict('checked'). The proof has a step for each derived triple, one listing of the derived rdf facts, and call tables for the calls the questions make. The negation that Tim is no student rests on the call table for the question whether Tim is a Student, which holds no answers: the checker expands that call against the program and the listing, finds no answer either, so the negation holds. It also requires the listing to be closed under the rules and replays each listed triple’s step. A chain-stratified program has only one set of facts that is supported, closed and consistent with its negations, so the checked verdict establishes that the claims follow from the program and are every answer of its questions. Delete one of the three constraints and eyemind rejects the rules as unstratified: a chain then makes a teacher a student.


Try it

node bin/eyemind.js examples/chain-stratification-n3.n3
node bin/eyemind.js --program examples/chain-stratification-n3.n3 > /tmp/chain-stratification.js
node bin/eyemind.js --check-proof examples/proof/chain-stratification-n3.js examples/chain-stratification-n3.n3