This adds a utility to take an RDFLib-friendly representation of a property path and build the corresponding SHACL Path representation in RDF (e.g. the objects of triples with predicate sh:path). The provided path object could either be:
A URIRef, when the path is simply a predicate
A Path, when the path is complex (e.g. a/rdfs:subClassOf*)
This makes it easy to create complex SHACL paths from RDFLib without needing to remember the details about how to construct the RDF representations of those paths correctly.
This is sort of a follow-up to #2699 which added the opposite functionality.
Checklist
[x] Checked that there aren't other open pull requests for
the same change.
[x] Checked that all tests and type checking passes.
If the change adds new features or changes the RDFLib public API:
coverage: 90.256% (+0.009%) from 90.247%
when pulling 2163692d101dae6900e31836c211391934d8eb87 on mgberg:build-shacl-path
into a9e30d3a78a85c1215386710b510ee7c1cfb679a on RDFLib:main.
Summary of changes
This adds a utility to take an RDFLib-friendly representation of a property path and build the corresponding SHACL Path representation in RDF (e.g. the objects of triples with predicate
sh:path
). The provided path object could either be:URIRef
, when the path is simply a predicatePath
, when the path is complex (e.g.a/rdfs:subClassOf*
)This makes it easy to create complex SHACL paths from RDFLib without needing to remember the details about how to construct the RDF representations of those paths correctly.
This is sort of a follow-up to #2699 which added the opposite functionality.
Checklist