1

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?

Aljosha Koecher
  • 443
  • 6
  • 17
  • Which version? 9.4? – Stanislav Kralin Dec 01 '20 at 14:22
  • 1
    `RDFS-Plus` ruleset does not have the necessary rules to derive triples for `rdfs:domain`. You may look at what rules are used in each of the rulesets by looking at the PIE files at `/configs/rules` – Damyan Ognyanov Dec 01 '20 at 15:01
  • @StanislavKralin Yes, v9.4.1. – Aljosha Koecher Dec 01 '20 at 15:08
  • @DamyanOgnyanov Okay, but is that intentional? I expected RDFS-Plus to contain all the rules of RDFS and more. – Aljosha Koecher Dec 01 '20 at 15:09
  • @DamyanOgnyanov that's clearly counter-intuitive given that RDFS Plus in Semantic Web is know to have everything of RDFS + some OWL based constructs. And moreover, even GraphDB docs state *"Extended version of RDFS with the support also symmetric, inverse and transitive properties, via the OWL vocabulary: "* - so why has the `rdfs:domain` rule been omitted? For me this is either a "bug" or you should rename the ruleset. – UninformedUser Dec 01 '20 at 20:18
  • @UninformedUser agree, but if I recall correctly, motivation for such change come after complains from new GraphDB users (mostly comming from RDBMS world) that what they expect from `rdfs:domain` and `rdfs:range` was to act more like constraints instead of to derive new facts, so these (and some other rules related to rdf lists) were removed intentionally ... – Damyan Ognyanov Dec 02 '20 at 12:42
  • ok, I see - but this should be documented in my opinion then. Clearly, I'd also mention that neither RDFS nor OWL semantcis is about constraints but inference aka entailment. For constraint I'd also recommend to use SHACL or SHeX – UninformedUser Dec 02 '20 at 16:24
  • @DamyanOgnyanov I cannot follow this rationale. The definition of `rdfs:domain` and `rdfs:range` as well as the effects on reasoning are standardized by W3C. Sure it's confusing for someone with an OOP or RDB background, but I guess we all had to go through this learning process. I think it's wrong to change or remove standardized definitions just to make it easier. And IMO, it could make it even more confusing because this change to the "normal" RDFS-Plus ruleset is not documented. IMO the rule should be re-added to the ruleset. If not possible, the change should at least be documented. – Aljosha Koecher Dec 03 '20 at 11:45

1 Answers1

2

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).

Aljosha Koecher
  • 443
  • 6
  • 17