ISSUE A: use SHACL ? ISSUE B: When to define domains and ranges
The various SAREF extensions take different views on the how to specify the intended domain and range of various properties.
Some use rdfs:domain and rdfs:range throughout, some use those predicates sparingly, and others use owl:restriction. Several use a combination of these approaches. Some leave the intended domain and range implicit by mentioning it just in the rdfs:comment.
Additionally, there are other ways to specify the domain and range of a property that are not used (yet) in extensions:
- SHACL constraints: these can indicate constraints of various severity levels (violation, warning, info)
- schema:domainIncludes and schema:rangeIncludes: this can indicate a domain/range such that multiple is interpreted as a union instead of an intersection
Can we take a moment to discuss the implications of rdfs:domain and rdfs:range? And to form an opinion on which type of domain/range specification would be most applicable in which situation? Afterall, the RDFS constructs indicate inference rules instead of restrictions in the common sense. We as ontology experts may be aware of that, but it becomes quite complicated towards less experienced users. Compare for example the following quotes:
Hogan, the web of data (2020) p.118: "A common misconception is that rdfs:domain and rdfs:rangeact as a form of constraint, ensuring respectively that the subject orobject resource of a given relation is typed with a given class. This is notdirectly the case in RDF(S), where data are assumed to be incompleteand such definitions are used to “complete” the data by inferring theappropriate type rather than to flag the data as missing a type. Anotherrelated misconception is that rdfs:domain and rdfs:range are used tocheck that the type of a subject or object resource is “correct”: this isnot always the case since a resource can be typed under multiple classes. [...] Another related and common mistake is to assign multiple domains(or multiple ranges) to a property with the intention of saying that thesubject (or object) is of one of those types. [...] "
p.36 from A Practical Guide To Building OWL Ontologies Using Protege, Matthew Horridge. "Although we have specified the domains and ranges of various properties for the purposes of this tutorial, we generally advise against doing this. The fact that domain and range conditions do not behave as constraints and the fact that they can cause `unexpected' classification results can lead problems and unexpected side effects. These problems and side effects can be particularly difficult to trackdown in a large ontology."