Masroor
Masroor

Reputation: 908

What does <owl:Ontology rdf:about="xml:base"/> in an ontology mean?

When we see a statement like,

<owl:Ontology rdf:about="xml:base"/>

near the start (header) of an ontology, what exactly does this mean?

If we try to read that in plain English, this should mean something like xml:base an Ontology. But my comprehension does not go beyond that. I am missing specially the xml:base part. What role does xml:base play in case of an ontology?

(Reference: A Semantic Web Primer, second edition, Grigoris Antoniou and Frank van Harmelen, p 135.)

Upvotes: 3

Views: 457

Answers (2)

千木郷
千木郷

Reputation: 1821

I'm reading the same book (A Semantic Web Primer, second edition, Grigoris Antoniou and Frank van Harmelen) in academic research context and I think the descriptions appeared originally in the same book is necessary to answer this question, along with some additional explanation including coding cases and document references to Apache Jena, an open source ontology application builder that could be related by wider users who have not to be computer science experts in semantic web or ontology engineering.

  • In ch3.2.4 Three Views of a Statement, p66, the rdf:about attribute is

    referencing an existing resource

  • As documented in Apache Jena, the URI of this individual of class owl:Ontology is by convention

    the URL, or web address, of the ontology document itself.

Hence,

  • the xml:base declared in rdf:about is definitely a URI assigned to a resource whose type is owl:ontology.
  • the URIs in the following ontologies work in the same way:
    <owl:Ontology rdf:about="xml:base"/>
    <owl:Ontology rdf:about="http://examples/base#"/>
    

However there is another case:

<owl:Ontology rdf:about=""/>

the empty Ontology URI works exactly in a different way, which might result in other unusual URI form such as xml:base confusing on a way, as questioned in this post. Apache Jena's document says

the construct rdf:about="" does not indicate a resource with no URI; it is in fact a shorthand way of referencing the base URI of the document containing the ontology.

Some released RDFS/OWL reasoner products can help us inspect the Ontology URI in much more detail. Here we can explain how the two cases above about Ontology URI work in Apache Jena through an experimental repository:

// https://github.com/chigix/jena_stories/blob/b9af78e7c128a3e31f41bbfbafd06199099eb7f7/src/test/java/com/chigix/jena_stories/ontology/MetaHeaderTest.java#L52
Ontology baseOntology = model.getOntology("xml:base");
assertThat(baseOntology, notNullValue(Ontology.class));
assertThat(baseOntology.getURI(), equalTo("xml:base"));

From the unit testing snippet above, the ontology assigned with xml:base could be queried by a given URI xml:base. It implies that xml:base here is just a simple string representing the URI of the underlying ontology resource.

What's more:

// https://github.com/chigix/jena_stories/blob/b9af78e7c128a3e31f41bbfbafd06199099eb7f7/src/test/java/com/chigix/jena_stories/ontology/MetaHeaderTest.java#L56
model.read(RDFDataMgr.open("african-wildlife.owl"), "http://ontology.chigix.com/some#", "RDF/XML");
assertThat(model.getOntology("xml:base"), notNullValue(Ontology.class));
assertThat(model.getOntology("xml:base").getURI(), equalTo("xml:base"));
assertThat(model.getOntology("http://ontology.chigix.com/some"), nullValue());

so even an ontology is contained in a document whose URL is different with the URI assigned on the underlying ontology resource, we still use the ontology's URI, stated as xml:base here, to query the target ontology.

However what if the ontology's URI in the document is stated empty:

// https://github.com/chigix/jena_stories/blob/b9af78e7c128a3e31f41bbfbafd06199099eb7f7/src/test/java/com/chigix/jena_stories/ontology/MetaHeaderTest.java#L69
model.read(RDFDataMgr.open("printer-ontology.owl"), "http://ontology.chigix.com/some#", "RDF/XML");
assertThat(model.getOntology("xml:base"), nullValue());
assertThat(model.getOntology("http://ontology.chigix.com/some"), notNullValue(Ontology.class));

we can see:

  • the ontology could be queried with a given URI that is identical to the document's URL
  • the questioned xml:base can not help reference to the ontology resource in the document

Conclusionly, xml:base in an ontology is exatly just a normal URI string that could not play any special magical features. The statement of <owl:Ontology rdf:about="xml:base"/> in an ontology document is to group meta-like assertions for housekeeping purposes, including

comments, version control, and inclusion of other ontologies

, as shown in the example in ch4.2.2 Header, p116:

<owl:Ontology rdf:about="">
    <rdfs:comment> This is an ontology </rdfs:comment>
    <owl:priorVersion rdf:resource="http://..." />
    <owl:imports rdf:resource="http://..." />
    <rdfs:label>Ultraman Tiga</rdfs:label>
</owl:Ontology>

The owl documents used in the examples above are originally from the examples in the book's ch4.3 Examples, pp.129-138, and they could be accessed from the experimental repository as well:

Upvotes: 1

Ross Presser
Ross Presser

Reputation: 6265

<owl:Ontology> says that you are starting an Ontology which is defined in the owl namespace.

rdf:about, the about attribute from the rdf namespace, is supposed to give a URI which will give a definition of whatever this XML is talking about. However, in this case the value is xml:base. This says that the subject of this XML schema is represented by the resource located at the URI where this xml was retrieved.

If the ontology were to contain a further <xml:base> element, then that would override URI; instead of looking at where we just retrieved this XML file containing the Ontology, we would instead look at the URI defined in the <xml:base> element.

ETA: As Ignazio points out in a comment below, rdf:about="xml:base" does not really work that way. Even if I have correctly interpreted what the people at Owl actually intended by this, what the code is actually saying is that the about attribute is the string xml:base, which doesn't really mean anything.

Upvotes: 4

Related Questions