I am testing validation of RDF data using SHACL in TopBraidComposer Maestro Edition (v 6.3.2).
During my analysis of SHACL, I came across the document DASH Reification Support for SHACL. Chapter 2 of that document defines the property dash:reifiableBy
, which - according to the document - "can be used to link a SHACL property shape with one or more node shapes. Any reified statement must conform to these node shapes."
This appears to say that one can define SHACL validation of statements against certain shapes. The document has an example, which I try to run in TopBraidComposer - slightly modified, though, in order to actually get validation results (in this case, that a statement is invalid). The code is:
# baseURI: http://example.org/shacl/shapes/dash/reifiableBy
# imports: http://datashapes.org/dash
# prefix: exshacl
@prefix ex: <http://example.org/shacl/data/dash/reifiableBy#> .
@prefix exschema: <http://example.org/shacl/schema/dash/reifiableBy/> .
@prefix exshacl: <http://example.org/shacl/shapes/dash/reifiableBy#> .
@prefix dash: <http://datashapes.org/dash#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://example.org/shacl/shapes/dash/reifiableBy>
a owl:Ontology ;
owl:imports <http://datashapes.org/dash> ;
.
###########################
# Shape(s)
###########################
exshacl:ProvenanceShape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:path exschema:date ;
sh:datatype xsd:date ;
sh:minCount 1 ;
] ;
sh:property [
a sh:PropertyShape ;
sh:path exschema:author ;
sh:nodeKind sh:IRI ;
sh:minCount 1 ;
] ;
.
exshacl:PersonShape
a sh:NodeShape ;
sh:targetClass exschema:Person ;
sh:property [
a sh:PropertyShape ;
sh:path exschema:age ;
sh:datatype xsd:integer ;
sh:minCount 1 ;
dash:reifiableBy exshacl:ProvenanceShape ;
] ;
.
###########################
# Data
###########################
ex:Bob
a exschema:Person ;
exschema:age "23"^^xsd:integer ;
.
ex:BobAge23Reification
a rdf:Statement ;
rdf:subject ex:Bob ;
rdf:predicate exschema:age ;
rdf:object "23"^^xsd:integer ;
ex:author ex:Claire .
The exshacl:PersonShape
works, in so far as the property shape ensures that exschema:age
is present for a exschema:Person
and has datatype xsd:integer
.
However, the rdf statement ex:BobAge23Reification
on the triple ex:Bob exschema:age "23"^^xsd:integer
is not validated against the exshacl:ProvenanceShape
. While property exschema:author
is present in the statement, property exschema:date
is not.
Is the example code wrong or missing a crucial bit, or does dash:reifiableBy
not define a SHACL constraint component that is actually validated (and instead is intended only for defining editing forms in GUIs)?
(Such questions may be better asked on the topbraid-users mailing list)
The shape looks fine but TopBraid currently doesn't validate rdf:Statements, but instead uses reified triples using http://datashapes.org/reification.html#uriReification
This may change in future versions, depending on the direction that Jena may take for RDF* support.
The current version of TBC isn't suitable for editing such reified values, but TopBraid EDG is.