Re: Multiple ontologies in a single file: RDF vs. the rest

From: Rinke Hoekstra <hoekstra@uva.nl>
Subject: Multiple ontologies in a single file: RDF vs. the rest
Date: Wed, 7 May 2008 12:44:29 +0200

> 
> Hi,
> 
> The imports/versioning proposal of Peter, and Boris' suggested changes
> to the syntax document to resolve ISSUE-21 and ISSUE-24 got me thinking
> about a problem that we might need to fix...
 
> If imports is by location (i.e. an import statement points to some owl
> *file* at some location), we need to specify a way to deal with files
> that contain multiple ontologies. The reason is that both the XML
> schema and the RDF/XML (or N3, or turtle or...) serialisation (of the
> RDF graph) do not provide ways to prevent this from happening.  The
> functional style syntax does *not* support multiple ontologies in a
> single file. This hints at a round-tripping problem for the
> translation from these formats to FS and back.

In OWL 1 there was the possibility of including information about
multiple ontologies in a single RDF graph - in fact, as you allude to,
it is very hard to prevent anything in RDF - but the RDF graph ends up
being a single ontology.

It turns out that in OWL 1 the validity of RDF graphs as OWL DL
ontologies in RDF graph form was only determined for imports closures.
*This is a bad thing.* The agreed-on situation in OWL 2 is much better.

> The XML syntax spec. explicitly prescribes an ox:Ontology element as
> root element for OWL/XML files, but the XML schema itself cannot enforce
> this. Nonetheless, an OWL/XML file that contains multiple ox:Ontology
> elements can be deemed invalid (although tools may provide custom means
> to disentangle the ontologies). No real problem here.

A way forward would be to require in the schema that an OWL 2 ontology
document in XML form match against a single Ontology element.  The
problem is that tools may want to validate bits of an ontology so things
like Axiom need to be top-level elements as well.  (Right now, an OWL 2
XML document could, I suppose, consist of a sequence of intermixed
Ontology, Datatype, and ObjectUnionOf elements.)  Perhaps some XML
Schema hacker could come up with the appropriate incantations to allow
this.
 
> For RDF/XML this is not as simple, as we only provide a mapping from FS
> to RDF graphs: bags of triples. These triples may be stored anywhere, in
> some DB or a file. A (partial) RDF serialisation of that store may or
> may not contain multiple ontologies, or may even contain no ontology
> element at all. However, for imports to work (obviously), the file does
> need to contain at least an RDF description of type owl:Ontology.
> 
> Possible solution: add this as a requirement to the RDF mapping,
> i.e. say something like ''Any RDF serialisation of the RDF graph
> resulting from this mapping should contain the owl:Ontology triple
> produced by the mapping''.

The way forward is, I think, to add wording to effect that RDF graphs
that are the result of the forward mapping are expected to be stored as
single docments at the location suggested in the soon-to-be-determined
section on publishing ontologies on the web.  I believe that the web
retrieval mechanisms make it possible to store both an OWL 2 ontology in
RDF/XML form and an OWL 2 ontology in XML form at the same web location.
 
> For ontologies stored in a triple store, the custom mechanism as
> described by Peter may be used to resolve the import URI to an ontology
> in the store. However, the RDF representation of ontologies provides no
> means to retrieve the relevant triples (i.e. class axioms etc.) given
> the triple representing the ontology itself. Once the ontology is in RDF
> the 'ontology' and its axioms, entities and annotations are
> disconnected.  But an RDF serialisation of an ontology needs to have some
> means to select the proper triples. (and consequently the mapping to FS
> should take this possibility into account as well)
> 
> (I am tempted to drop the words 'named graph' in this context. Oops,
> just did.)

I do not believe that the working group can be in the business of
determining how triple stores work.  It is certainly a problem if there
is no way of locally storing OWL 2 ontologies in RDF graph form.
However, I do not believe that this is the case.

Triple stores that completely eliminate the source of triples internally
do have problems with many high-level organizations of triples.  I
expect that there are very few, if any, of these sorts of triple
stores.  Triple stores that do record the source of triples (quad
stores) can support the discrimination required to reverse map OWL 2
ontologies.

Of course, if the working group decides that it must be possible to
extract OWL 2 ontologies from within a triple store that does not record
the source of triples, it is possible to do so by drastically changing
the RDF mapping of OWL 2 ontologies.  I would probably not object to
such a change, but I could not provide much help for the required
changes to the OWL 2 Full semantics.

> A solution would be to add a statement along the lines of ''A valid RDF
> serialisation of an RDF graph representing some ontology should contain
> exactly that ontology'' (i.e. exactly those triples resulting from the
> mapping of that ontology from the functional syntax to RDF)

See above for my suggestion along these lines.

> This is relevant because we are about to adopt imports by location, that
> is files stored in a sanctioned syntax (Question: are RDF/XML,N3,Turtle
> etc. sanctioned syntaxes?) and need to make sure that each file contains
> exactly one ontology, and only those axioms/elements/annotations
> belonging to that ontology.

We could, actually, allow multiple OWL 2 ontologies per document in the
functional syntax with a very small change.  I'm not suggesting we do
this, primarily because of imports (although having all the versions of
an ontology in the same document is actually a semi-reasonable
approach).  However, it makes things much easier if each document has a
single ontology in RDF, and reflecting this limitation of RDF in the
other syntaxes makes life easier overall.

(Answer: RDF/XML is the official RDF serialization syntax.  The
N-triples and Turtle syntaxes for RDF graphs get used because they have
advantages over RDF/XML.  N-triples has a definition, but I do not
believe that there is any official mechanism for storing or transferring
N-triples documents - Jeremy may know better.  Turtle is more official,
as there is a defining document and a MIME type for Turtle.  (However, I
do not believe that there is any official word on how to translate
Turtle into RDF graphs.)  N3 doesn't fit into the mix here, as it is not
a viable syntax for RDF graphs.)

> -Rinke

peter

Received on Wednesday, 7 May 2008 11:36:57 UTC