From W3C Wiki
Jump to: navigation, search

This page is planned as entry point of various SHACL examples and design patterns.

Counting Instances

This example enforces a constraint that the data graph must contain at least one instance of the class ex:Person. The "trick" is to attach a constraint on the class itself, and then walk an inverse path along rdf:type triples to compute the count of instances.

       a sh:NodeShape ;
       sh:targetNode ex:Person ;
       sh:property [
           sh:path [ sh:inversePath rdf:type ] ;
           sh:minCount 1 ;
       ] .