Quick start with the Alignment API in Java

An extensive presentation of the alignment API can be found at http://gforge.inria.fr/docman/?group_id=117. We also have an on-line tutorial on using it.

Fetching the Alignment API and starting

Requirements

For using you will need Java runtime environment (tested in 1.5). All other necessary libraries are available in the archive (see the list of libraries).

Fetching the ZIP'ed version

The simplest way to use alignapi is to get the last release zipfile from the site http://gforge.inria.fr/frs/?group_id=117. It contains all the sources, compiled library, required libraries.

Running

Running the program is achieved through:

$ java -jar lib/procalign.jar
usage: Procalign [options] URI1 URI2
options are:
        --impl=className -i classname           Use the given alignment implementation.
        --renderer=className -r className       Specifies the alignment renderer
        --output=filename -o filename   Output the alignment in filename
        --alignment=filename -a filename Start from an XML alignment file
        --threshold=double -t double    Filters the similarities under threshold
        --debug[=n] -d [n]              Report debug info at level n
        --help -h                       Print this message
Congratutalations, you are done. We advise you to learn more by using the tutorial and the documentation.

Details below are for developing with the Alignment API.

Bug reports

Package content

Whatever your mode of getting ontolign you will get an alignapi directory containing the following subdirectories:

Developing with the Alignement API

Requirements

For extending you will need Java compiler (tested in Java standard edition 1.5). Other libraries are included. It is also very usefull to have Ant.

Compilation and use

Generating the jar-files corresponding to the Alignment API can be achieved by launching:

$ ant jar
This recompiles the necessary files.

Only compiling the necessary files is obtained by:

$ ant compile

Recompiling all files is achieved by:

$ ant compileall

Typical development with the API

We can distinguish four types of developments in the API:

In theory, only the first aspect requires recompiling and modifying the Alignment API code. However, it may be useful for others (for instance for debugging).

The alignment API

The OWL-API is extended with the (org.semanticweb.owl.align) package. Which describes the Alignment API. This API is, in turns, an "implementation" of the Alignment format.

It is basically made of three interfaces:

Alignment
Represents the alignment of two ontology by a specific method. It contains a specification of the alignment and a list of cells.
Cell
Represents a couple of aligned entities together with their confidence measure and alignement relation.
Relation
Represents the specification of the relation holding between two aligned entities.

More information about the attributes of these classes can be found in the format description.

Addtionnally, there is an AlignmentProcess interface which contains a method for calling a particular alignment method (it is a sub-interface of Alignment) and an AlignmentException.

Implementing and extending the API

A (default) impplementation of this API can be found in the fr.inrialpes.exmo.align.impl package.

Adding new alignments methods amounts to create a new AlignmentProcess class implementing the interface. Generally, this can extend the proposed fr.inrialpes.exmo.align.impl.BasicAlignment class and implement AlignmentProcess.

The BasicAlignment has the good taste of defining the storage sructures for ontologies and alignment specification as well as the methods for dealing with alignment display. The only method it does not implement is alignment itself. All methods can be refined (no one is final).

The NameEqAlignment class extends the BasicAlignment by aligning classes bearing the exact same name for properties and classes).

A more elaborate implementation is the EditDistNameAlignment class which uses an edit distance on class names. It thus have to build a matrix of distance and to choose the alignment from the distance. It can be called by:

$ java -jar lib/procalign.jar file://$CWD/rdf/onto1.owl file://$CWD/rdf/onto2.owl -i fr.inrialpes.exmo.align.impl.method.EditDistNameAlignment
which returns:
<?xml version='1.0' encoding='utf-8' standalone='no'?>
<!DOCTYPE rdf:RDF SYSTEM "align.dtd">

<rdf:RDF xmlns='http://knowledgeweb.semanticweb.org/heterogeneity/alignment'>
<Alignment>
  <xml>yes</xml>
  <level>0</level>
  <type>11</type>
  <onto1>file://$CWD/rdf/onto1.owl</onto1>
  <onto2>file://$CWD/rdf/onto2.owl</onto2>
  <map>
    <Cell>
      <entity1 rdf:resource='http://www.example.org/ontology1#reviewedarticle'/>
      <entity2 rdf:resource='http://www.example.org/ontology2#article'/>
      <measure rdf:datatype='xsd:float'>0.5333333333333333</measure>
      <relation>=</relation>
    </Cell>
    <Cell>
      <entity1 rdf:resource='http://www.example.org/ontology1#journalarticle'/>
      <entity2 rdf:resource='http://www.example.org/ontology2#journalarticle'/>
      <measure rdf:datatype='xsd:float'>0.0</measure>
      <relation>=</relation>
    </Cell>
  </map>
</Alignment>
</rdf:RDF>


http://alignapi.gforge.inria.fr/align.html

$Id: align.html 467 2007-04-21 06:06:36Z euzenat $