DAML+OIL to OWL Converter

 

Overview

The converter daml2owl is a console based java program which translates a DAML+OIL file into an OWL file. The converter tries to keep the species of the converted file to OWL DL, unless it is not possible due to the structure or elements defined in the input DAML+OIL file.

Objective

DAML+OIL to OWL conversion is a common task given the drive to migrate ontologies written in DAML+OIL to OWL. This task can be simplified with the help of a program which can somewhat automate the process of conversion. The converter daml2owl tries to achieve this goal of syntactically correct conversion with some necessary user interaction. The converter is intelligent enough to understand the basic differences in the syntax of the two languages. It should not be taken for granted that the semantics of the converted OWL ontology will be perfectly correct since it’s quite hard to comprehend the semantics while keeping the structure of the converter simple.

Motivation

I was assigned the task of converting the ontology OntoCape with the help of some available tool. Although I extensively searched on the Web, I was not able to find a converter capable of handling a broad range of DAML+OIL constructs. So I decided to write a converter in Java from scratch. I would like to mention that the modified BBN OWL conversion script written in Perl was helpful in showing me what the basic structure of a converter should be like. But this converter is not capable of correctly converting except rather simple DAML+OIL ontologies. Somebody interested in an alternative tool can try the export to OWL-RDF feature of OilEd. Again the output OWL file is not correct for detailed and complex DAML+OIL ontologies.

Structure

daml2owl is written completely in Java in order to ensure successful conversion on multiple platforms supported by Java technology. The only requirement is to have JRE v1.4.0 (or as later version) installed on the machine since the program uses java.util.regex package for matching using regular expressions.
The converter basically is a text processor which recognizes the correspondence between different elements and the changes in the syntax of the two languages. The input file is passed through an initial parsing step to find out any construct which the converter can not handle. Please see the limitations section below for further details.

Limitations

OWL does not offer language elements that are equivalent to the qualified cardinality restrictions (QCRs) in DAML+OIL. Consequently, there is no straightforward way of translating QCRs to OWL. For optimal results, all QCRs must be removed from the DAML+OIL ontology before conversion. However, this remodelling might be tedious for large ontologies. Therefore the converter offers a simple translation rule, which converts DAML+OIL statements of the following type

<daml:subClassOf>
<daml:Restriction daml:cardinalityQ="1"
<daml:onProperty rdf:resource="spouse"/>
<daml:hasClassQ rdf:resource="Person"/>
</daml:Restriction>
</daml:subClassOf>


into

<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="spouse"/>
<owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality>
</owl:Restriction>
</rdfs:subClassOf>

<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="spouse"/>
<owl:allValuesFrom rdf:resource="Person"/>
</owl:Restriction>
</rdfs:subClassOf>


using the owl:allValuesFrom element. Note, however, that this might lead to semantically wrong statements. If you want to switch the translation of QCRs off, use the -noQCRconversion option (see below). The following cases are not supported:

  • The converter does not try to convert the DAML+OIL files with qualified cardinality constraints which use daml:List element inside the daml:hasClassQ element.
  • The converter does not try to convert the DAML+OIL files containing qualified cardinality constraints on the same property with different classes.

For further details see README.txt, which is avaible in the downloadable package. In both the above mentioned cases, the program quits after printing the starting line numbers of the problem.

  • The converter does not try to convert the daml:item elements which are normally used in DAML+OIL to define typed list. All the occurrences of the string "daml:item" will simply be renamed to "owl:item". The code to process daml:item may be added later on in an updated version.
  • The converter does not convert the value definition of a property of the following form.
    <size>
    <xsd:integer rdf:value="10"/>
    </size>
  • The converter only accepts slash (/) as the separator character in a URI. If backslash (\) is used, the converter will throw the java.util.regex.PatternSyntaxException runtime exception.

Download

The converter package can be downloaded here.

Download is free of charge. You can use, change, and redistribute the package according to the terms stated in the GNU General Public Licence.

As mentioned above, the only requirement is to install JRE v1.4.0 (or later) if not already installed. The latest JRE can be downloaded form the SUN download page free of charge. The downloadable package contains the source file named daml2owl.java, the compiled class file named daml2owl.class, the documentation file named README.txt, and the licence file named COPYING.txt.

Usage

To run the program, simply type the following command in the command interpreter with required options while sitting in the program directory

<font>java daml2owl <options> <filenames> </font>

Running the java class file with no options prints the following usage instructions on the console screen.

<font> Usage: java daml2owl <options> <values>
where possible options include:</font>

<font>-d <daml_file_name></font>

<font>Specify the URI of the input DAML+OIL file to be converted.</font>

<font>-o <owl_file_name></font>

<font>Specify a URI for the output OWL file. If this option is not given, an OWL file named after the input DAML+OIL file is created.</font>

<font>-ns <namespace></font>

<font>Specify a default namespace for the converted OWL file. Not effective when used with the -dir option.</font>

<font>-base <base_namespace></font>

<font>Specify a base namespace for the converted OWL file. Not effective when used with the -dir option.</font>

<font>-recursive</font>

<font>Recursively convert all ontologies imported by the DAML+OIL input file. The imported ontologies should be in the same directory.</font>

<font>-interactive</font>

<font>Asks the user to provide new URI's for the imported ontologies. </font>

<font>-overwrite</font>

<font>Overwrite already present OWL file(s) if named similar to the output OWL file(s).</font>

<font>-noQCRconversion</font>

<font>Do not convert simple qualified cardinality constraints using the owl:allValuesFrom element.</font>

<font>-dir current</font>

<font>Convert all DAML+OIL files in the current directory.</font>

<font>-dir <dir_name ></font>

<font>Convert all DAML+OIL files in the given directory.</font>

<font>-help</font>

<font>Prints a synopsis of the available options.</font>

The order in which the options are given does not matter. Just remember to use the –d flag when specifying a single DAML+OIL file and –dir when processing all DAML+OIL files in a directory.

For details of the options, see README.txt available in the downloadable package