[Back to DRAOn]

DRAOn Tutorial

This tutorial provides details on Java interfaces that DRAOn supports via examples. In addition, we discuss on specific aspects of implementation whenever it is necessary. In the examples thereafter, we use the following classes defined in the OWL API, the Alignment API and DRAOn itself.

import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owl.align.Alignment;
import fr.paris8.iut.info.iddl.IDDLReasoner;
import fr.paris8.iut.info.iddl.conf.Semantics;
import fr.paris8.iut.info.iddl.localnode.LocalNode;

From their name, one can know which classes belong to which API.

Using DL as underlying semantics

If you wants to use the DL semantics for a network of aligned ontologies, the following instructions should be put in your programme:

IDDLReasoner reasoner = new IDDLReasoner(Set<URI> uris);

where "uris" is a set of alignment URIs. This means that a network of aligned ontologies can be defined without declaring explicitely ontologies in that creation since the URIs of aligned ontologies can be extracted from alignments. DRAOn uses the DL semantics for the network by default.

IDDLReasoner reasoner = new IDDLReasoner(List<Alignment> aligns);

where "aligns" is a list of alignment objects. This interface can be employed whenever alignments are loaded as Java objects. We can now check whether the defined network is consistent, or entailment of an OWL axiom "ax" by the network under the DL semantics:

boolean reasoner.isConsistent();
boolean reasoner.isEntailed(OWLAxiom ax);

Using IDDL as underlying semantics without distributed feature

In the version 1.5, a network of aligned ontologies and a underlying semantics must be declared when creating a reasoner object as follows:

IDDLReasoner reasoner = new IDDLReasoner(Set<URI> uriSet, Semantics Semantics.IDDL);

This means that when a reasoner object is created, it possesses alignments and ontologies under a determined semantics. These data are not changed over the life of the reasoner object. We have the same interface for alignment objects:

IDDLReasoner reasoner = new IDDLReasoner(List<Alignment>, Semantics Semantics.IDDL);

We can now check whether the defined network is consistent, or entailment of an OWL axiom "ax" by the network under the IDDL semantics:

boolean reasoner.isConsistent();
boolean reasoner.isEntailed(OWLAxiom ax);

where "ax" is either "OWLClassAssertionAxiom" or "OWLSubClassOfAxiom"

Using IDDL as underlying semantics with distributed feature

Before creating reasoner object for this setting, we must define a set of nodes each of which corresponds to an ontology of the network. A local reasoner (HermiT) is associated with each node. The following code shows how to create such nodes :

LocalNode node1 = new LocalNode("localhost", "http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl", 8080 );
LocalNode node2 = new LocalNode("localhost", "http://ebiquity.umbc.edu/v2.1/ontology/publication.owl", 8081 );
Set<LocalNode> nodes = new HashSet<LocalNode>();
nodes.add(node2);

where the constructor of "LocalNode" expects a server name, the URI of a local ontology and a port number. From these nodes, we can now create a global reasoner that calls reasoning services offered by local reasoners located at different machines.

IDDLReasoner reasoner = new IDDLReasoner(Set<URI> als, Set<LocalNode> nodes, Semantics.IDDL);

or

IDDLReasoner reasoner = new IDDLReasoner(List<Alignment> als, Set<LocalNode> nodes, Semantics.IDDL);

To run an example without distributed feature

An example class "Main.java" is given in order to show how to put together the appropriate codes as presented above. It can be compiled :

javac -cp .:./lib/iddl.jar:./lib/procalign.jar:./lib/ontowrap.jar:./lib/HermiT.jar Main.java

and run :

java -cp .:./lib/iddl.jar:./lib/procalign.jar:./lib/ontowrap.jar:./lib/HermiT.jar Main

To run an example with distributed feature

First, we must compile the class IDDLRemoteNode.java by :

javac -cp .:./lib/HermiT.jar:./lib/iddl.jar:./lib/procalign.jar IDDLRemoteNode.java

Then, we run "IDDLRemoteNode" on two machines corresponding to two nodes by providing a port number, the URI of the local ontology associated with this node, and the URL of this ontology as follows:

java -cp .:./lib/HermiT.jar:./lib/iddl.jar:./lib/procalign.jar IDDLRemoteNode 8081 http://ebiquity.umbc.edu/v2.1/ontology/publication.owl file:/Users/leduc/Ontologies/JE/edu.umbc.ebiquity.publication.owl
java -cp .:./lib/HermiT.jar:./lib/iddl.jar:./lib/procalign.jar IDDLRemoteNode 8080 http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl file:/Users/leduc/Ontologies/JE/edu.mit.visus.bibtex.owl

Now, we can launch a global node (global reasoner) by:

java -cp .:./lib/iddl.jar:./lib/procalign.jar:./lib/ontowrap.jar:./lib/HermiT.jar Main

Note that in "Main.java" we must indicate in "LocalNode" the same port numbers and server names where the two local reasoners have been launched.

A DL inconsistent network but IDDL consistent

In "distrib", you can find two ontologies "edu.mit.visus.bibtex-1.owl.owl", "ebiquity.umbc.edu/v2.1/ontology/publication-1.owl" and an alignment "bibref-1.rdf". The network formed from "edu.mit.visus.bibtex-1.owl.owl", "ebiquity.umbc.edu/v2.1/ontology/publication-1.owl" and "bibref-1.rdf" is DL inconsistent but IDDL consistent.

A IDDL inconsistent network

In "distrib", you can find two ontologies "edu.mit.visus.bibtex-1.owl", "ebiquity.umbc.edu/v2.1/ontology/publication-1.owl" and an alignment "bibref-2.rdf". The network formed from these ontologies and alignement is IDDL inconsistent.

http://iddl.gforge.inria.fr

$IUT de Montreuil, Universite de Paris8 $