Reputation: 305
I loaded this turtle file into two different OWL reasoners (HermiT and RDFox):
@prefix : <http://www.semanticweb.org/justin/ontologies/2022/10/untitled-ontology-16#> .
@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#> .
:A1 rdf:type owl:Class .
:A2 rdf:type owl:Class ;
rdfs:subClassOf :A1 .
:A3 rdf:type owl:Class ;
rdfs:subClassOf :A2 .
I expected the reasoner to infer that:
:A3 rdfs:subClassOf :A1 .
But neither reasoner did.
Related material:
"The rdfs:subClassOf property is transitive." https://www.w3.org/TR/rdf-schema/#ch_subclassof
"When one defines a property P to be a transitive property, this means that if a pair (x,y) is an instance of P, and the pair (y,z) is also instance of P, then we can infer the the pair (x,z) is also an instance of P." https://www.w3.org/TR/owl-ref/#TransitiveProperty-def
Upvotes: 3
Views: 279
Reputation: 1751
Yes, the rdfs:subClassOf
property is transitive. I'm afraid I can't explain why HermiT does not return the expected triple as I don't know that system but for RDFox, there are a couple of extra steps that you would need to take to see the triples you're looking for.
First of all, RDFox has a first-class representation of axioms that is independent of any axioms held as triples. To use axioms in reasoning, they must be added to the data store's (first-class) axioms. If your data store contains axioms represented as triples, such as :A2 rdfs:subClassOf :A1
, you can import them as axioms using the importaxioms
shell command (this command accepts some options but if your axioms are present as triples in the default graph, and you want the axioms to apply to the default graph, no arguments are needed). When axioms are imported, RDFox generates corresponding Datalog rules that actually do the reasoning.
Even at this point, you will not see any additional rdfs:subClassOf
triples. This is because, unlike many other reasoners, RDFox is focused on making inferences about data (aka Abox reasoning) and not about the schema (aka Tbox reasoning). Concretely, this means that if you add some an instances of :A3
to the data store along with the axioms you have shown, those instances will also be classified as belonging to the classes :A2
and :A1
. Thus the effects of the transitive rdfs:subClassOf
relations are materialised which is often of more practical use that having the implied rdfs:subClassOf
triples.
For cases where schema reasoning really is needed, RDFox has a built-in ruleset to do subsumption reasoning (as you were expecting here). This can be imported in the shell with:
import <rdfox:TBoxReasoning>
This will make RDFox infer :A3 rdfs:subClassOf :A1
. The relevant documentation section is here.
Here's a complete RDFox shell script (correct for version 5.7) demonstrating all of the above which I hope you'll find useful:
dstore create default
prefix : <http://www.semanticweb.org/justin/ontologies/2022/10/untitled-ontology-16#>
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#>
import ! :A1 rdf:type owl:Class .
import ! :A2 rdf:type owl:Class ; rdfs:subClassOf :A1 .
import ! :A3 rdf:type owl:Class ; rdfs:subClassOf :A2 .
set output out
set query.print-summary off
echo
echo "Subclasses of :A1 (w/o subsumption ruleset):"
select ?subClass { ?subClass rdfs:subClassOf :A1 }
echo
importaxioms
import ! :a3 a :A3 .
echo
echo "Instances of :A1..."
select ?instance { ?instance a :A1 }
echo
import <rdfox:TBoxReasoning>
echo
echo "Subclasses of :A1 (with subsumption ruleset):"
select ?subClass { ?subClass rdfs:subClassOf :A1 }
Upvotes: 7