Search code examples
rdfowlsemantic-webrdfs

OWL2 Ontology creates a "ghost" RDFS ontology due to missing `#`


Let's query the code of OWL2 Ontology.

$ http --follow get http://www.w3.org/2002/07/owl# | grep -B30 'rdf-schema>'

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://www.w3.org/2002/07/owl> a owl:Ontology ;
     dc:title "The OWL 2 Schema vocabulary (OWL 2)" ;
     rdfs:comment """
  This ontology partially describes the built-in classes and
  properties that together form the basis of the RDF/XML syntax of OWL 2.
  The content of this ontology is based on Tables 6.1 and 6.2
  in Section 6.4 of the OWL 2 RDF-Based Semantics specification,
  available at http://www.w3.org/TR/owl2-rdf-based-semantics/.
  Please note that those tables do not include the different annotations
  (labels, comments and rdfs:isDefinedBy links) used in this file.
  Also note that the descriptions provided in this ontology do not
  provide a complete and correct formal description of either the syntax
  or the semantics of the introduced terms (please see the OWL 2
  recommendations for the complete and normative specifications).
  Furthermore, the information provided by this ontology may be
  misleading if not used with care. This ontology SHOULD NOT be imported
  into OWL ontologies. Importing this file into an OWL 2 DL ontology
  will cause it to become an OWL 2 Full ontology and may have other,
  unexpected, consequences.
   """ ;
     rdfs:isDefinedBy
          <http://www.w3.org/TR/owl2-mapping-to-rdf/>,
          <http://www.w3.org/TR/owl2-rdf-based-semantics/>,
          <http://www.w3.org/TR/owl2-syntax/> ;
     rdfs:seeAlso   <http://www.w3.org/TR/owl2-rdf-based-semantics/#table-axiomatic-classes>,
                    <http://www.w3.org/TR/owl2-rdf-based-semantics/#table-axiomatic-properties> ;
     owl:imports <http://www.w3.org/2000/01/rdf-schema> ;

Here, you can see that OWL ontology imports RDF Schema ontology. The canonical URL for RDF Schema is this one, as specified in prefix:

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

but import works like this:

owl:imports <http://www.w3.org/2000/01/rdf-schema> ;

This little discrepancy should have no effect on the import itself because the # does not make difference when fetching a web resource. However, it has other important consequences.

$ http --follow get http://www.w3.org/2002/07/owl# | grep -A5 'owl:imports a'

owl:imports a owl:OntologyProperty ;
     rdfs:label "imports" ;
     rdfs:comment "The property that is used for importing other ontologies into a given ontology." ;
     rdfs:domain owl:Ontology ;
     rdfs:isDefinedBy <http://www.w3.org/2002/07/owl#> ;
     rdfs:range owl:Ontology . 

The rdfs:range is important. It means that every value of owl:imports property will be considered an owl:Ontology. Which means that we have the following triple inferred:

<http://www.w3.org/2000/01/rdf-schema> a owl:Ontology

This has unwanted consequences. In particular,

  • http://www.w3.org/2000/01/rdf-schema# is also (legitimately) considered an Ontology, as seen here:
$ http --follow http://www.w3.org/2000/01/rdf-schema# | grep Ontology

<http://www.w3.org/2000/01/rdf-schema#> a owl:Ontology ;

Thus, when we list all ontologies in the graph which includes both RDFS and OWL, we have duplicates.

In addition, if a user wants to look at http://www.w3.org/2000/01/rdf-schema "kind of ontology" they will see no terms in it.

I think this is a bug in OWL code.

  • Is my assessment correct?
  • If it is, then how does this bug get processed, given that the W3C OWL Working Group has been closed?
  • Has anyone else seen this issue too?
  • And if you have, how did you resolve it, so that the graph contains only the proper a owl:Ontology triple for RDFS?

Solution

  • Your assessment is correct. There are a few points to be made more precise:

    • Ontologies can be identified using any URI format, even blank nodes (although it is usually more useful to use just the prefix of the relevant namespace, leading to significantly more compact statements like owl: owl:imports rdfs:). OWL is free to pick any URI to identify the ontology, but of course identifying RDFS using the same format is a mistake.

    • The OWL ontology is not "an OWL ontology" in the sense that using it for reasoning using OWL is incorrect – terms defined by OWL are treated like keywords and are not interpreted like other terms are, thus you normally wouldn't run into this issue when doing OWL reasoning. Note, however, that using just RDFS instead of OWL in this case is perfectly fine, and RDFS entailment should indeed produce <http://www.w3.org/2000/01/rdf-schema> a owl:Ontology, so you could run into this issue in practice. Even without any forms of entailment, tools like Linked Open Vocabularies could use these triples, and so this problem is relevant for machine processing.

    • It's not accurate to describe these "two" ontologies as duplicates – a single entity is free to use as many URIs to identify it as needed – for example, an average person would likely consider all these to denote the same "thing":

      • http://www.w3.org/2000/01/rdf-schema#
      • https://www.w3.org/2000/01/rdf-schema#
      • http://www.w3.org:80/2000/01/rdf-schema#
      • http://www.w3.org:0080/2000/01/rdf-schema#
      • http://w3.org/2000/01/rdf-schema#
      • http://WWW.W3.ORG/2000/01/rdf-schema#

      Instead of thinking of these two URIs as denoting two separate resources, perhaps it is more reasonable to consider <http://www.w3.org/2000/01/rdf-schema#> owl:sameAs <http://www.w3.org/2000/01/rdf-schema>. Such a triple is not present in the RDF data, but that is fine thanks to the open-world principle.

    • In practice, locating the ontology describing a vocabulary term is never so simple anyway – rdfs:isDefinedBy points to any resource providing the definition of a term, and so a triple such as owl:imports rdfs:isDefinedBy <http://www.w3.org/2002/07/owl#> gives you the ontology document but not necessarily the ontology itself, therefore a usable tool must be equipped with means to find it, even through HTTP redirects where there are no explicit RDF statements that link the two resources. Thus http://www.w3.org/2000/01/rdf-schema "should" be corrected using some implementation-defined means to http://www.w3.org/2000/01/rdf-schema# anyway.