Took a look at your code and shapes, had to make a couple of little fixes. In your prologue, you had:
data_graph_orig = data_graph
That made them both reference the same graph, so there was never a difference. I replaced that with:
data_graph_orig = Graph()
for t in data_graph:
data_graph_orig.add(t)
to clone the data. That made the extra triples introduced by RDFS reasoning show up as added. I then took a look
at your shapes, and was a little thrown off by the sh:values construct you used (I can't find it in SHACL-AF) and the
use of the spif: time functions, which are not natively present in pySHACL (perhaps you introduced them in your
context?). Regardless, I added the following declaration and rule:
kennedys:
a owl:Ontology ;
owl:imports sh: ;
sh:declare [
sh:prefix "kennedys" ;
] ;
sh:declare [
sh:prefix "schema" ;
] .
schema:PersonAgeRule
a sh:NodeShape ;
sh:targetClass schema:Person ;
sh:rule [
a sh:SPARQLRule ;
sh:prefixes schema: ;
sh:construct """
CONSTRUCT {
$this schema:age ?age
}
WHERE {
$this schema:birthDate ?birthDate .
FILTER NOT EXISTS { $this schema:deathDate ?any }
bind(year(now()) - year(xsd:dateTime(CONCAT(STR(?birthDate), 'T00:00:00'))) as ?age)
}
""" ;
] ;
.
(The actual YEAR() function only works on dateTime, thus the date hackery)
which caused the following to show up in the graph diff:
Hope that helps.