Search code examples
ontology

Ontology reasoning: How do i make subclasses work?


I want to create a simple ontology. Where..

@prefix : <http://www.semanticweb.org/VDI3814#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://www.semanticweb.org/VDI3814#> .

:Function rdf:type owl:Class .

:ApplicationFunctions rdf:type owl:Class ;
                      rdfs:subClassOf :Function .

:ClosedLoopControl rdf:type owl:Class ;
                   rdfs:subClassOf :ApplicationFunctions .

:PIDControls rdf:type owl:Class ;
             rdfs:subClassOf :ClosedLoopControl .

Now I do the inference with the python package reasonable. In my understanding at the end :PIDControls should be of rdf:type :Function. Because it is a subclass of a subclass of a subclass of :Function. But it is not! Can someone explain me?

Thanks!


Solution

  • rdfs:subClassOf is transitive; in the image below you can see that :PIDControls is properly identified as an rdfs:subClassOf :Function despite the triple never existing (hence, it was properly inferred through the transitive property). Note that you're also talking about Class, and not instances. If you have instances instead, you'll find that you can infer rdf:type.

    transitive subClassOf

    Here's a link to a similar question about rdf:type vs subClassOf, and why you don't use rdf:type to extract this type of entailment.