Search code examples
shacl

Can SHACL shape target any subject in a graph?


Can SHACL shape target any subject in the validated graph?

The only solution that comes to mind is to use reasoning to infer that everything is owl:Thing and use sh:targetClass owl:Thing.


Solution

  • Earlier drafts of SHACL Core had something like sh:targetAllSubjects but that got removed. Instead the SHACL Advanced Features include custom targets: https://w3c.github.io/shacl/shacl-af/#SPARQLTarget

    This can be used to not only target any subject but also to define a high-level vocabulary for this recurring pattern. For a reference implementation see http://datashapes.org/dash.html#AllSubjectsTarget