Best Practice: Be careful with the use of inferencing in RDF Vocabularies
State: Draft
Contact: Nick Crossley
Scope
This Best Practice discusses inappropriate usage of inferencing properties such as
rdfs:domain
and
rdfs:range
in RDF vocabularies.
Recommendation
RDFS contains terms such as
rdfs:domain
and
rdfs:range
, which go beyond mere vocabulary definition and enter into the world of ontologies. The primary difference between a vocabulary and an ontology is that an ontology includes inference rules which let you infer new information from given information - that is, add new triples to those stated, rather than constrain data to some schema.
For more information on this, read
OSLC Resource Shape - A language for defining constraints on Linked Data.
In the light of this knowledge, be careful with the use of inferencing terms in vocabularies - they often do not mean what you might have thought they meant. In particular, do not use
rdfs:domain
or
rdfs:range
with multiple values when defining a vocabulary term for a property, since that infers the target of that property is of all mentioned types, not any one of them.
Examples
Here is an example snippet of an RDF vocabulary document:
@prefix oslc: <http://open-services.net/ns/core#> .
@prefix oslc_qm: <http://open-services.net/ns/qm#> .
@prefix oslc_rm: <http://open-services.net/ns/rm#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
oslc_qm:validatesRequirement
a rdf:Property ;
rdfs:isDefinedBy oslc_qm: ;
rdfs:label "validatesRequirement" ;
rdfs:comment "Requirement that is validated by the Test Case." ;
rdfs:range oslc_rm:Requirement ;
rdfs:domain oslc_qm:TestScript, oslc_qm:TestCase ;
oslc:inverseLabel "Validated By" .
This states that the target of an
oslc_qm:validatesRequirement
property is
both an
oslc_qm:TestScript
and an
oslc_qm:TestCase
- which is not what the author intended. It also implies that any resource using this property may be inferred to be an OSLC requirement - which could prevent reuse of this property for requirements from non-OSLC providers.
In this case, the vocabulary term would be better defined without the use of
rdfs:range
and
rdfs:domain
.
The shape for resources using this property
should consider use of the
oslc:range
property to suggest likely target types for the values of the property.
See Also