Consider two GraphDB repositories with different reasoning rulesets:
- Repo A with ruleset "RDFS (Optimized)"
- Repo B with ruleset "RDFS-Plus (Optimized)"
I executed the following SPARQL INSERT in both these repositories:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ex: <http://www.example.com#>
INSERT DATA {
ex:hasPet a owl:ObjectProperty;
rdfs:domain ex:Human;
rdfs:range ex:Pet.
ex:someHuman ex:hasPet ex:somePet.
}
In both repositories, I would expect that through rdfs:domain
and rdfs:range
, the following class assertions should be inferred:
ex:someHuman rdf:type ex:Human
ex:somePet rdf:type ex:Pet
rdfs:domain
and rdfs:range
are RDFS properties so they should be inferred for Repo A. And because RDFS-Plus is an extension of RDFS, I thought they would also be inferred in Repo B.
However, these tripels are only inferred with ruleset RDFS (Repo A). If I execute the following SPARQL query, I only get a result in Repo A and no result in Repo B.
PREFIX ex: <http://www.example.com#>
SELECT ?pet WHERE {
?pet a ex:Pet.
}
Could somebody tell me why the two tripels above are only inferred with RDFS ruleset, but not with RDFS-Plus ruleset?
Posting my solution as an answer so that someone having this problem in the future doesn't have to dig through the comments above.
As @DamyanOgnyanov pointed out in the comments to my question, the necessary rules to infer types based on
rdfs:domain
andrdfs:range
are not included in GraphDB's RDFS-Plus and RDFS-Plus (Optimized) ruleset. They are, however, included in the RDFS ruleset, which is counter-intuitive because RDFS should be the basis for RDFS-Plus.In order to make the RDFS-Plus ruleset a proper extension of the RDFS ruleset and get support for
rdfs:domain
andrdfs:range
, I added the following rules of RDFS to RDFS-Plus. The ruleset file can be found at<your-graphdb-folder>/configs/rules
Furthermore, I also added the rules with IDs
rdfs6
,rdfs7
,rdfs12
,rdfs13
from RDFS to RDFS-Plus.I did not add rules
rdfs5
,rdfs9
andrdfs11
. Rulesrdfs5
andrdfs11
are covered by the transitive property rules andrdfs9
is covered by the axiom and rules aboutpsys:transitiveOver
.Edit: GraphDB did not pick up these changes when I created a new repository with the edited RDFS-Plus ruleset. I had to select "Upload custom ruleset" and upload the ruleset that I had edited (i.e. the RDFS-Plus ruleset which still has the default name).