W3C home > Mailing lists > Public > www-webont-wg@w3.org > January 2003

migrating RDF(S) to OWL Lite

From: Jeremy Carroll <jjc@hplb.hpl.hp.com>
Date: Fri, 17 Jan 2003 11:49:23 +0100
To: <www-webont-wg@w3.org>
Message-ID: <BHEGLCKMOHGLGNOKPGHDKEOMCAAA.jjc@hpl.hp.com>


Hopefully, it is still possible for the Guide editors to do something with
this before publication; if it is too late, so be it.

(I am unsure whether it is best to start with RDF=>OWL Lite or RDFS=>OWL
Lite).

It would be good if someone who felt sufficiently confident could check this
e-mail for technical correctness.

RDF=>OWL Lite
+++++++++++++

Certain RDF idioms are not supported in OWL Lite or OWL DL.
Examples are:
- reification: use OWL Full
- RDF containers (i.e. rdf:Bag, rdf:Seq, rdf:Alt, rdf:_1 ...)
  use OWL Full
- properties that have both literal values and (uriref or bnode) values,
  use OWL Full
- use of a propertyURIref as a class, use OWL Full.
- bnodes that are objects of more than triple, see below.

- some uses of RDFS, see below.

(not necessairly exhaustive list - I can't think of anything else, but that
doesn't mean there isn't).

Given this, to port an RDF file to be an OWL Lite file the following steps
must be taken.

1:
Find all urirefs that are properties in the RDF file, for each add one of
the following two declarations

<owl:ObjectProperty rdf:about="propertyURI"/>

or

<owl:DatatypeProperty rdf:about="propertyURI"/>

2:
Find all objects of triples with rdf:type as the predicate and add
declarations

<owl:Class rdf:about="classURI" />

3: Find all other URIrefs used in the file (these identify individuals)
If there is no rdf:type triple with that URIref as subject add the following

<owl:Thing rdf:about="individualURIref" />

4: Find all bnodes, if there is no rdf:type triple with that bnode as
subject add the following
<owl:Thing rdf:nodeID="bnodeIdentifier" />
(this step may involve adding an rdf:nodeID to the original occurrence of
the bnode, in which case an arbitrary new bnodeIdentifier is used, it may be
easier to add a property attribute
  rdf:type="&owl;Thing"
in an appropriate place, or change an rdf:Description to an owl:Thing,
see example below).


FINISH

Example:

RDF:

<eg:House>
   <eg:owner>
     <rdf:Description>
       <eg:email rdf:resource="mailto:jeremy.carroll@hp.com"/>
       <eg:name>Jeremy Carroll</eg:name>
     </rdf:Description>
   </eg:owner>
</eg:House>


OWL Lite:

<!-- Step 1 -->
<owl:ObjectProperty rdf:about="&eg;owner"/>
<owl:ObjectProperty rdf:about="&eg;email"/>
<owl:DatatypeProperty rdf:about="&eg;name"/>

<!-- Step 2 -->
<owl:Class rdf:about="&eg:House"/>

<!-- Step 3 -->
<owl:Thing rdf:about="mailto:jeremy.carroll@hp.com"/>

<!-- Step 4 -->
<owl:Thing rdf:nodeID="jjc"/>

<!-- original RDF file, with nodeID added -->
<eg:House>
   <eg:owner>
     <rdf:Description rdf:nodeID="jjc">
       <eg:email rdf:resource="mailto:jeremy.carroll@hp.com"/>
       <eg:name>Jeremy Carroll</eg:name>
     </rdf:Description>
   </eg:owner>
</eg:House>


Reformatted OWL Lite:

<!-- ontology declarations -->

<owl:ObjectProperty rdf:about="&eg;owner"/>
<owl:ObjectProperty rdf:about="&eg;email"/>
<owl:DatatypeProperty rdf:about="&eg;name"/>

<owl:Class rdf:about="&eg:House"/>

<!-- data -->
<eg:House>
   <eg:owner>
     <owl:Thing >
       <eg:email>
          <owl:Thing rdf:about="mailto:jeremy.carroll@hp.com"/>
       </eg:email>
       <eg:name>Jeremy Carroll</eg:name>
     </owl:Thing>
   </eg:owner>
</eg:House>


It may well be appropriate to put the "ontology declarations" in a separate
file and then use owl:imports to import them into the datafile. Doing this
with the owl:Thing declarations on urirefs is possible but generally a bit
strange. This cannot be done with the bnodes (e.g. <owl:Thing
rdf:nodeID="jjc"/> ) because the blank node identifiers in the two files are
not related.


RDFS => OWL Lite
++++++++++++++++

With an RDFS schema, it may well be possible to add additional OWL Lite
facts to make it an OWL Lite ontology.

This is not possible if any of the following hold (non-exhaustive list)
1. A property and a class have the same URIref
2. A property is intended to be used both with uriref objects and literal
objects
3. The schema uses subclasses of the builtin RDFS classes, or subproperties
of the builtin RDFS properties.
4. any of the previous list is pertinent

A good way of doing this is to import the RDFS document into a new OWL Lite
document; which adds additional declarations.
Another approach is to edit the RDFS, replacing RDFS declarations of
classes and properties with OWL Lite declarations.


The following declarations are needed.

1. For each rdfs:Class add or replace with an owl:Class
2. For each rdf:Property add or replace with either
   owl:ObjectProperty
or
   owl:DatatypeProperty


FINISH

Example
=======

<rdfs:Class rdf:about="&eg:House">
  <rdfs:comment xml:lang="en">
    A class of houses.
  </rdfs:comment>
</rdfs:Class>
<rdf:Property rdf:about="&eg:owner">
  <rdfs:comment xml:lang="en">
    The ownership relation.
  </rdfs:comment>
  <rdfs:range rdf:resource="&eg;Person"/>
</rdf:Property>
<rdfs:Class rdf:about="&eg:Person">
  <rdfs:comment xml:lang="en">
    Legal persons (both phyiscal and other).
  </rdfs:comment>
</rdfs:Class>
<rdfs:Class rdf:about="&eg;Mailbox">
  <rdfs:comment xml:lang="en">
    An e-mailbox.
  </rdfs:comment>
</rdfs:Class>
<rdf:Property rdf:about="&eg:email">
  <!-- The subPropertyOf relationship
   here does not work, when you look at
   the defn of vcard;EMAIL. It is here
   as illustrative of what to do
   with subPropertyOf.
  -->
  <rdfs:subPropertyOf
    rdf:resource=
"http://www.w3.org/2001/vcard-rdf/3.0#EMAIL"
  />
  <rdfs:comment xml:lang="en">
    The object is an e-mail box used by the subject.
  </rdfs:comment>
  <rdfs:domain rdf:resource="&eg;Person"/>
  <rdfs:domain rdf:resource="&eg;Mailbox"/>
</rdf:Property>
<rdf:Property rdf:about="&eg:name">
  <rdfs:subPropertyOf
    rdf:resource=
"http://www.w3.org/2001/vcard-rdf/3.0#FN"
  />
  <rdfs:comment xml:lang="en">
    The object is the name of the subject.
  </rdfs:comment>
  <rdfs:domain rdf:resource="&eg;Person"/>
</rdf:Property>


Either ADD:

<owl:Class rdf:about="&eg;House"/>
<owl:Class rdf:about="&eg;Person"/>
<owl:Class rdf:about="&eg;Mailbox"/>

<owl:ObjectProperty rdf:about="&eg;owner"/>
<owl:DatatypeProperty rdf:about="&eg;name"/>
<owl:ObjectProperty rdf:about="&eg;email"/>
<owl:ObjectProperty rdf:about="&vcard;EMAIL" />
<owl:DatatypeProperty rdf:about="&vcard;FN" />

or EDIT rdfs into OWL Lite:

<owl:Class rdf:about="&eg:House">
  <rdfs:comment xml:lang="en">
    A class of houses.
  </rdfs:comment>
</owl:Class>
<owl:ObjectProperty rdf:about="&eg:owner">
  <rdfs:comment xml:lang="en">
    The ownership relation.
  </rdfs:comment>
  <rdfs:range rdf:resource="&eg;Person"/>
</owl:ObjectProperty>
<owl:Class rdf:about="&eg:Person">
  <rdfs:comment xml:lang="en">
    Legal persons (both phyiscal and other).
  </rdfs:comment>
</owl:Class>
<owl:Class rdf:about="&eg;Mailbox">
  <rdfs:comment xml:lang="en">
    An e-mailbox.
  </rdfs:comment>
</owl:Class>
<owl:ObjectProperty rdf:about="&eg:email">
  <!-- The subPropertyOf relationship
   here does not work, when you look at
   the defn of vcard;EMAIL. It is here
   as illustrative of what to do
   with subPropertyOf.
  -->
  <rdfs:subPropertyOf>
    <owl:ObjectProperty rdf:about="&vcard;EMAIL" />
  </rdfs:subPropertyOf>
  <rdfs:comment xml:lang="en">
    The object is an e-mail box used by the subject.
  </rdfs:comment>
  <rdfs:domain rdf:resource="&eg;Person"/>
  <rdfs:domain rdf:resource="&eg;Mailbox"/>
</owl:ObjectProperty>
<owl:DatatypeProperty rdf:about="&eg:name">
  <rdfs:subPropertyOf>
    <owl:DatatypeProperty rdf:about="&vcard;FN" />
  </rdfs:subPropertyOf>
  <rdfs:comment xml:lang="en">
    The object is the name of the subject.
  </rdfs:comment>
  <rdfs:domain rdf:resource="&eg;Person"/>
</owl:DatatypeProperty>


Blank Nodes
+++++++++++
As noted earlier, blank nodes that are the object of more than triple are
not permitted in OWL Lite.
There are two possible work-arounds:
a) Skolemization.
   Replace all such blank nodes with new URIrefs.
   This adds information to the RDF graph.
   The resulting graph entails the original graph.

b) Blank node division.
   Whenever a blank node is the object of two or more triples,
   replace it with two or more blank nodes, each being the
   object of one of the triples, and the subject of triples
   equivalent to those that the original blank node was subject
   of.
   This removes information from the graph, (but adds triples).
   The resulting graph is entailed by the original graph.

Example of (a) and (b) without doing other OWL Lite migration
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Input:

<eg:c>
  <eg:p >
    <rdf:Description rdf:nodeID="n">
     <eg:a >
        <eg:class2/>
     </eg:a>
     <eg:dp>value of dp</rg:dp>
    </rdf:Description>
   </eg:p>
   <eg:q rdf:nodeID="n"/>
</eg:c>


Skolemization:

<eg:c>
  <eg:p >
    <rdf:Description rdf:about="gensym">
     <eg:a >
        <eg:class2/>
     </eg:a>
     <eg:dp>value of dp</rg:dp>
    </rdf:Description>
   </eg:p>
   <eg:q rdf:resource="gensym"/>
</eg:c>

Blank node division.

<eg:c>
  <eg:p >
    <rdf:Description>
     <eg:a >
        <eg:class2/>
     </eg:a>
     <eg:dp>value of dp</rg:dp>
    </rdf:Description>
   </eg:p>

  <eg:q >
    <rdf:Description>
     <eg:a >
        <eg:class2/>
     </eg:a>
     <eg:dp>value of dp</rg:dp>
    </rdf:Description>
   </eg:q>
</eg:c>
Received on Friday, 17 January 2003 05:49:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:57:57 GMT