PATHS with Reasoning

Hi everyone,

I am having trouble with a PATHS query that relies on reasoning. I define a parent (superClass) ThingA with a subclass ThingAB. I also define foo:superClassOf as the inverse of rdfs:subClassOf. Why can't I find the PATH via foo:superClassOf when Reasoning is on? What am I doing wrong here?

Here is my mock up data that recreates my issue:

@prefix foo: <http://www.example.org/foo/bar/ontology#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

foo:ThingA rdf:type owl:Class .

foo:ThingAB rdf:type        owl:Class ;
            rdfs:subClassOf foo:ThingA .

# Define superClassOf as the the inverse of subClassOf
foo:superClassOf 
  owl:inverseOf rdfs:subClassOf .

With Reasoning ON the query for superClassOf is successful:

PREFIX foo: <http://www.example.org/foo/bar/ontology#>

SELECT ?superClass ?subClass
WHERE{
  ?superClass foo:superClassOf ?subClass .
}

But this PATHS query returns no results when Reasoning=ON

PREFIX foo: <http://www.example.org/foo/bar/ontology#>

PATHS ALL
START ?s
END ?o
    # VIA rdfs:subClassOf   # Works, no reasoner needed
VIA foo:superClassOf        # No result when Reasoning=ON 

Cheers,

Tim

Hi Tim,

Two things are going on here. First of all, you indeed found a subtle bug in path queries with reasoning which occurs when the start variable is not bound. It will be fixed in the next release.

Second, and more importantly, foo:superClassOf owl:inverseOf rdfs:subClassOf is not a valid OWL axiom. This is prohibited in the OWL 2 spec, see Section 2.4 IRIs:

IRIs with prefixes rdf: , rdfs: , xsd: , and owl: constitute the reserved vocabulary of OWL 2.

and Section 5.3 Object Properties:

IRIs from the reserved vocabulary other than owl:topObjectProperty and owl:bottomObjectProperty MUST NOT be used to identify object properties in an OWL 2 DL ontology.

Simply put, you cannot use rdfs:subClassOf as a regular object property in an OWL axiom. It's accidental that you get the expected result from your SELECT query, we'll look into why Stardog did not warn you.

As a short term workaround for path queries, if you really need unbound start variables, you could put something like start ?s { ?s a owl:Class } instead.

Thanks,
Pavel

My reading of Allemang and Hendler's "Semantic Web for the Working Ontologist" seems to suggest my proposed approach is accepted, as long as one does not define superClassOf within rdfs: (I define it within foo:). What am I missing?

Relevant section is here:
https://books.google.com/books?id=_qGKPOlB1DgC&pg=PA159&lpg=PA159&dq=inverse+of+superClassOf+dean+allemang&source=bl&ots=-_jeF1xKjS&sig=ACfU3U0Z0smhqGwz1MptMMtsUAFYxGDp9w&hl=en&sa=X&ved=2ahUKEwiSp9uy5vPgAhVLmbQKHe66DtcQ6AEwAHoECAkQAQ#v=onepage&q=inverse%20of%20superClassOf%20dean%20allemang&f=false

Tim,

I should have been more precise: the axiom is not valid in OWL DL as the OWL specification states. The book does not contradict the spec but it goes beyond OWL DL fragment into something that's called OWL Full. You can verify this independently of Stardog by using an OWL profile checker in tools like the OWL API or even Protege. I believe mainstream OWL reasoners like Pellet, FaCT++, HermiT, etc. will not accept the axiom.

The distinction between OWL DL and OWL Full used to be a subject of heated debate back in the day but it's not anymore. OWL has that quirk that its semantics can be specified in two different ways: OWL Direct Semantics where an OWL ontology is viewed as a knowledge base in a fragment of first-order logic (the so-called Description Logic) and OWL RDF-based Semantics where an OWL ontology is viewed as an RDF graph (a bunch of triples according to the OWL to RDF Mapping). The former defines inferences using the Description Logic model theory while the latter defines inferences using the RDF model theory. For the most part, you must get the same inferences but only as long as you do not go beyond OWL DL. The main problem with OWL Full is that it's a computationally undecidable language.

This is all theory but what's important in practice is that each system must clearly specify which OWL semantics it implements. Stardog implements the Direct Semantics and says so in https://www.stardog.com/docs/#_owl_rule_reasoning. Other systems might implement the RDF-based semantics and, again, query results should be the same for the OWL DL fragment. But for anything beyond OWL DL, results for the Direct Semantics are not defined (see the definition of legal graphs).

I haven't read the book but I imagine the authors make their readers aware of these nuances somewhere and make it clear that they work with the RDF-based semantics of OWL.

Cheers,
Pavel

Here's a handy little tool command line tool that does exactly what @pavel describes using OWL-API https://github.com/stain/profilechecker

Thanks, Pavel, for taking the time to provide this detailed explanation. I was definitely coming at this from the perspective of RDF-based semantics. Much appreciated

Thanks, Zachary. I will check out the command line tool.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.