owlrdfsgraphdbreasoningrdfs+

RDFS-Plus Reasoning for rdfs:domain and range in GraphDB


Consider two GraphDB repositories with different reasoning rulesets:

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:

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?


Solution

  • 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 and rdfs: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 and rdfs:range , I added the following rules of RDFS to RDFS-Plus. The ruleset file can be found at <your-graphdb-folder>/configs/rules

        Id: rdfs2
    
          a b c [Constraint b != <rdf:type>]
          b <rdfs:domain> d
        ------------------------------------
          a <rdf:type> d
    
    
        Id: rdfs3
    
          a b c
          b <rdfs:range> d
        ------------------------------------
          c <rdf:type> d
    

    Furthermore, I also added the rules with IDs rdfs6, rdfs7, rdfs12, rdfs13 from RDFS to RDFS-Plus.

    I did not add rules rdfs5, rdfs9 and rdfs11. Rules rdfs5 and rdfs11 are covered by the transitive property rules and rdfs9 is covered by the axiom and rules about psys: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).