Search code examples
rdfowlsemantic-webprotegehermit

Aren't anonymous classes automatically a type of owl:Class?


This ontology does not quite seem to do what I have in mind:

@prefix xsd:      <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf:      <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:     <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:      <http://www.w3.org/2002/07/owl#> .
@prefix :         <http://test/> .

:AClass a owl:Class .
:BClass a owl:Class .

# Class 1
:CClass owl:equivalentClass [
  owl:intersectionOf (
    :AClass
    :BClass
  )
] .

Loading this in protege with hermit reasoner I do not see CClass as sub-class of either AClass or BClass. However the following works:

.
.
.

# Class 1
:CClass owl:equivalentClass [
  rdf:type owl:Class ;
  owl:intersectionOf (
    :AClass
    :BClass
  )
] .

Curious on why I need to add rdf:type owl:Class.

  1. Isn't [ ... ] automatically of type owl:Class?
  2. Or being an intersection of two owl:Class make it so?

Thanks


Solution

  • In your first snippet, it is clear that the intersection must be an OWL class because it is an intersection of OWL classes. Therefore, :CClass must also be an OWL class. However, this implies some reasoning based on how terms are defined. An OWL parser does not have to apply reasoning and should be directed explicitly to whether a term is an OWL class, an object property, a datatype property, an individual, an ontology, an annotation property, a datatype or some other kind of annotation. In the case of an owl:intersectionOf axiom, it is possible that you are declaring a datatype, rather than an OWL class. So it is only by looking at the content of the list, and finding how the terms inside are declared (viz., :AClass and :BClass), that you can eventually infer that they are all OWL classes, and therefore the intersection is an OWL class, and therefore it is equivalent to an OWL class, and therefore :CClass should or could appear as an OWL class in the editor. OWL tools are free to make this kind of inferences for the sake of robustness, but it is not mandated by the OWL standard.

    Edit for clarification: the standard defines a way to map RDF graphs to the abstract syntax of OWL where the constructs that use owl:intersectionOf can be mapped to either a class definition or a datatype definition. The only way the standard recommends to discriminate the two cases is by adding explicitly rdf:type owl:Class or rdf:type rdfs:Datatype (see Tables 12 and 13 of OWL 2 Web Ontology Language Mapping to RDF Graphs). OWL parsers may go beyond what the standard recommends and infer some types based on the context, but they do not have to do it. I know that the OWL API does some such syntactic inferences to avoid crashing on every invalid ontologies.