I am writing some basic shapes to validate that an ontology is well-formed, and one of checks I would like to add is that subPropertyOf and inverseOf only target the same type of property. For example:
gshapes:InversePropertyShape
a sh:NodeShape ;
sh:targetSubjectsOf owl:inverseOf ;
sh:property [
a sh:PropertyShape ;
sh:path ( owl:inverseOf rdf:type ) ;
sh:equals rdf:type ;
sh:message "Inverse property must be same type."
] .
gshapes:SuperPropertySameType
a sh:NodeShape ;
sh:targetSubjectsOf rdfs:subPropertyOf ;
sh:property [
a sh:PropertyShape ;
sh:path ( rdfs:subPropertyOf rdf:type ) ;
sh:equals rdf:type ;
sh:message "Super-property must be same type."
] .
The problem I run into is with additional types like owl:FunctionalProperty and owl:TransitiveProperty, which break the above shapes. Is there a nice SHACL-native way for me to ignore those and only pay attention to values such as ObjectProperty and DatatypeProperty, or will I have to drop down to SPARQL queries to handle this validation?