<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Using the Alignment API: a small tutorial on the Alignment API</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" type="text/css" href="../../base.css" />
<link rel="stylesheet" type="text/css" href="../../style.css" />
<script type="text/javascript">
<!--
function show(id) {
	var element = document.getElementById(id);
	element.style.display = "block";
}
function hide(id) {
	var element = document.getElementById(id);
	element.style.display = "none";
}
-->
</script>
<style type="text/css">
<!--
div.logic {
	padding-left: 5px;
	padding-right: 5px;
	margin-top: 10px;
	margin-bottom: 10px;
}
-->
</style>
</head>
<body style="background-color: #FFFFFF;">

<h1>Using the Alignment API: a small tutorial on the Alignment <abbr title="Application Programming Interface">API</abbr></h1>

<dl>
<dt>This version:</dt>
<dd>http://alignapi.gforge.inria.fr/tutorial/tutorial1/</dd>
<dt>Author:</dt>
<dd><a href="http://exmo.inrialpes.fr/people/euzenat">J&eacute;r&ocirc;me Euzenat</a>, INRIA &amp; LIG
</dd>
</dl>

<p style="border-bottom: 2px solid #AAAAAA; border-top: 2px solid
	  #AAAAAA; padding-top: 15px; padding-bottom: 15px;">
Here is a small tutorial for the alignment <abbr>API</abbr>. Most of the tutorial is based on command-lines invocations. Of course, it is not the natural way to use this <abbr>API</abbr>: it is made for being <a href="../tutotial3/embbed.html">embedded in some application programme</a> and we are working towards implementing an <a href="server.html">alignment server</a> that can help programmes to use the <abbr>API</abbr> remotely. The complete tutorial is also available as a self-contained <a href="script.sh" title="script for UNIX systems">script.sh</a> or <a href="script.bat" title="script for Windows systems">script.bat</a>.
We make no garantee on the MS-DOS script, it is only here for helping.
</p>
<p>A <a href="server.html">companion tutorial</a> has been designed for the Alignment
  Server. It follows, as much as possible, the reasoning of this
  tutorial but provides input and output through a web browser.</p>
<div style="font-size: 75%;">This tutorial has been designed for the Alignment API version
  2.4 (it has been updated to work with version 4.0).</div>

<h2>Preparation</h2>
	
<p>
First you must download the Alignment API and check that it works
as indicated <a href="../index.html">here</a>.</p>

<p>You can <a href="../align.html">modify the Alignment <abbr>API</abbr> and its implementation</a>. In this tutorial, we will simply learn how to use it.</p>

<p>You will then go to the directory of this tutorial by doing:</p>
<div class="fragment">
$ cd tutorial1
</div>
<p>You can clean up previous trials by:</p>
<div class="fragment">
$ rm results/*
</div>

<p>
The goal of this tutorial is only to help you realize the
possibilities of the Alignment <abbr>API</abbr> and implementation. It
can be played by invoking each command line from the command-line
interpreter. In this example we use the <tt>tcsh</tt> syntax (which
only affects the <tt>setenv</tt> command).</p>

<!--p>Beside a Java interpreter, if one wants to generate the <abbr title="HyperText Markup Language">HTML</abbr> translations of the alignments, this can be done with the help of an <abbr title="XML Stylesheet Language Trasnformation">XSLT</abbr> 1.0 processor like <tt>xsltproc</tt>. Hence:</p>
<div class="fragment">
$ xsltproc ../form-align.xsl results/file.rdf > results/file.html
</div>
<p>generates <tt>results/file.html</tt> from the alignment file <tt>results/file.rdf</tt>.</p-->
	
<h2>The data</h2>
	
<p>
Your mission, if you accept it, will be to find the best alignment
between two bibliographic ontologies. They can be seen here:</p>
<dl>
  <dt>edu.mit.visus.bibtex.owl</dt>
  <dd>is a relatively faithfull transcription of BibTeX as an ontology. It can be seen here in <a href="../edu.mit.visus.bibtex.owl"><abbr title="Ressource Description Framework">RDF</abbr>/<abbr title="eXtansible Markup Language">XML</abbr></a> or <a href="../edu.mit.visus.bibtex.html"><abbr>HTML</abbr></a>.</dd>
  <dt>myOnto.owl</dt>
  <dd>is an extension of the previous one that contains a number of supplementary concepts. It can be seen here in <a href="../myOnto.owl"><abbr>RDF</abbr>/<abbr>XML</abbr></a> or <a href="../myOnto.html"><abbr>HTML</abbr></a>.</dd>
</dl>

<p>These two ontologies have been used for a few years in the <a href="oaei.ontologymatching.org">Ontology Alignment Evaluation Initiative</a>.</p>
	
<h2>Matching</h2>
	
<p>For demonstrating the use of our implementation of the Alignment <abbr>API</abbr>, we implemented a particular processor (<tt>fr.inrialpes.exmo.align.util.Procalign</tt>) which:</p>
<ul>
<li>Reads two <acronym title="Web Ontology Language">OWL</acronym>/<abbr>RDF</abbr> ontologies;</li>
	<li>Creates an alignment object;</li>
	<li>Computes the alignment between these ontologies;</li>
	<li>Displays the result.</li>
</ul>

<p>Let's try to match these two ontologies
(<tt>$CWD</tt> is a variable that <a href="../index.html">has been
set up</a> to the directory just above this one):</p>
<div class="fragment">
$ java -jar ../../../lib/procalign.jar file://$CWD/myOnto.owl file://$CWD/edu.mit.visus.bibtex.owl
</div>

<p>The result is displayed on the standard output. Since the output is too long we send it to a file by using the <tt>-o</tt> switch:</p>
<div class="fragment">
$ java -jar ../../../lib/procalign.jar file://$CWD/myOnto.owl file://$CWD/edu.mit.visus.bibtex.owl -o results/equal.rdf
</div>

<p>Additional options are available:</p>
<ul>
<li>displaying debug information (-d);</li>
<li>controling the way of rendering the output (-r);</li>
<li>deciding the implementation of the alignment method (-i);</li>
<li>providing an input alignment (-a) [implemented but not used by most methods].</li>
</ul>

<p>Hence, it is possible to display the alignment
  in <abbr title="HyperText Markup Language">HTML</abbr> by using the
  adequate renderer:
<div class="fragment">
$ java -jar ../../../lib/procalign.jar file://$CWD/myOnto.owl file://$CWD/edu.mit.visus.bibtex.owl -r fr.inrialpes.exmo.align.impl.renderer.HTMLRendererVisitor -o results/equals.html
</div>
and opening the <a href="results/equals.html">results/equals.html</a>
in a browser.
</p>

<p>See the output in <a href="results/equal.rdf"><abbr>RDF</abbr>/<abbr>XML</abbr></a> or <a href="results/equal.html"><abbr>HTML</abbr></a>.</p>
<p>The result is expressed in the Alignment format. This format, in <abbr>RDF</abbr>/<abbr>XML</abbr>, is made of a header containing "metadata" about the alignment:
</p>
<div class="owl"><pre>
&lt;?xml version='1.0' encoding='utf-8' standalone='no'?>
&lt;rdf:RDF xmlns='http://knowledgeweb.semanticweb.org/heterogeneity/alignment#'
         xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
         xmlns:xsd='http://www.w3.org/2001/XMLSchema#'
         xmlns:align='http://knowledgeweb.semanticweb.org/heterogeneity/alignment#'>
&lt;Alignment>
  &lt;xml>yes&lt;/xml>
  &lt;level>0&lt;/level>
  &lt;type>**&lt;/type>
  &lt;method>fr.inrialpes.exmo.align.impl.method.StringDistAlignment&lt;/method>
  &lt;time>18&lt;/time>
  &lt;onto1>
    &lt;Ontology rdf:about="http://alignapi.gforge.inria.fr/tutorial/myOnto.owl">
      &lt;location>file:///Java/alignapi/html/tutorial/myOnto.owl&lt;/location>
      &lt;formalism>
        &lt;Formalism align:name="OWL1.0" align:uri="http://www.w3.org/2002/07/owl#"/>
      &lt;/formalism>
    &lt;/Ontology>
  &lt;/onto1>
  &lt;onto2>
    &lt;Ontology rdf:about="http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl">
      &lt;location>file:///Java/alignapi/html/tutorial/edu.mit.visus.bibtex.owl&lt;/location>
      &lt;formalism>
        &lt;Formalism align:name="OWL1.0" align:uri="http://www.w3.org/2002/07/owl#"/>
      &lt;/formalism>
    &lt;/Ontology>
  &lt;/onto2>
</pre></div>
<p>and the corresponding set of correspondences:</p>
<div class="owl"><pre>
  &lt;map&gt;
    &lt;Cell&gt;
      &lt;entity1 rdf:resource="http://alignapi.gforge.inria.fr/tutorial/myOnto.owl#Article"/&gt;
      &lt;entity2 rdf:resource="http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl#Article"/&gt;
      &lt;measure rdf:datatype="http://www.w3.org/2001/XMLSchema#float"&gt;1.0&lt;/measure&gt;
      &lt;relation&gt;=&lt;/relation&gt;
    &lt;/Cell&gt;
  &lt;/map&gt;
</pre></div>
<p>each correspondence is made of two references to the aligned entities, the relation holding between the entities (<tt>=</tt>) and a confidence measure (<tt>1.0</tt>) in this correspondence. Here, because the default method that has been used for aligning the ontologies is so simple (it only compares the labels of the entities and find that there is a correspondence if their labels are equal), the correspondences are always that simple. But it is too simple so we will use a more sophisticated method based on an edit distance:</p>
<div class="fragment">
$ java -jar ../../../lib/procalign.jar -i fr.inrialpes.exmo.align.impl.method.StringDistAlignment -DstringFunction=levenshteinDistance file://$CWD/myOnto.owl file://$CWD/edu.mit.visus.bibtex.owl -o results/levenshtein.rdf
</div>

<p>See the output in <a href="results/levenshtein.rdf"><abbr>RDF</abbr>/<abbr>XML</abbr></a> or <a href="results/levenshtein.html"><abbr>HTML</abbr></a>.</p>

<p>This is achieved by specifying the class of Alignment to be used (through the <tt>-i</tt> switch) and the distance function to be used (<tt>-DstringFunction=levenshteinDistance</tt>).</p>

<p>Look at the results: how are they different from before?</p>
<div class="button">
	<input type="button" onclick="show('qu1')" value="Show Discussion"/>
	<input type="button" onclick="hide('qu1')" value="Hide Discussion"/>
</div>
<div class="explain" id="qu1">

<p>We can see that the correspondences now contain confidence factors different than <tt>1.0</tt>, they also match strings which are not the same and indeed far more correspondences are available.</p></div>

<p>We do the same with another measure (smoaDistance):</p>
<div class="fragment">
$ java -jar ../../../lib/procalign.jar -i fr.inrialpes.exmo.align.impl.method.StringDistAlignment -DstringFunction=smoaDistance file://$CWD/myOnto.owl file://$CWD/edu.mit.visus.bibtex.owl -o results/SMOA.rdf
</div>
<div class="logic"><p><b>More work:</b> you can apply other available alignments classes. Look in the <a href="../../../src/fr/inrialpes/exmo/align/impl/method">../../../src/fr/inrialpes/exmo/align/impl/method</a> directory for more simple alignment methods. Also look in the <tt>StringDistances</tt> class the possible values for <tt>stringFunction</tt> (they are the names of methods).</p></div>
<div class="logic"><p><b>Advanced:</b> You can also look at the
    instructions for installing WordNet and its Java interface and use
    a WordNet based distance provided with the <abbr>API</abbr>
    implementation by ($WNDIR is the directory where wordnet 3.0 is installed):</p>
<div class="fragment">
$ java -cp ../../../lib/procalign.jar:../../../lib/jwnl/jwnl.jar fr.inrialpes.exmo.align.impl.util.Procalign -Dwndict=$WNDIR -i fr.inrialpes.exmo.align.ling.JWNLAlignment file://$CWD/myOnto.owl file://$CWD/edu.mit.visus.bibtex.owl -o results/jwnl.rdf
</div>

<p>See the output in <a href="jwnl.rdf"><abbr>RDF</abbr>/<abbr>XML</abbr></a> or <a href="jwnl.html"><abbr>HTML</abbr></a>.</p></div>
	
<h2>Manipulating</h2>
	
<p>As can be seen there are some correspondences that do not really make sense. Fortunately, they also have very low confidence values. It is thus interesting to use a threshold for eliminating these values. Let's try a threshold of <tt>.33</tt> over the alignment (with the <tt>-t</tt> switch):</p>
<div class="fragment">
$ java -jar ../../../lib/procalign.jar file://$CWD/myOnto.owl file://$CWD/edu.mit.visus.bibtex.owl -i fr.inrialpes.exmo.align.impl.method.StringDistAlignment -DstringFunction=levenshteinDistance -t 0.33 -o results/levenshtein33.rdf
</div>

<p>See the output in <a href="results/levenshtein33.rdf"><abbr>RDF</abbr>/<abbr>XML</abbr></a> or <a href="results/levenshtein33.html"><abbr>HTML</abbr></a>.</p>

<p>As expected we have suppressed some of these inaccurate correspondences. But did we also suppressed accurate ones?</p>
<div class="button">
	<input type="button" onclick="show('qu4')" value="Show Discussion"/>
	<input type="button" onclick="hide('qu4')" value="Hide Discussion"/>
</div>
<div class="explain" id="qu4"><p>This operation has contributed eliminating a number of innacurate correspondences like Journal-Conference or Composite-Conference. However, there remains some unaccurate correspondences like Institution-InCollection and Published-UnPublished!</p></div>	

<p>We can also apply this treatment to other methods available:</p>
<div class="fragment">
$ java -jar ../../../lib/procalign.jar -i fr.inrialpes.exmo.align.impl.method.StringDistAlignment -DstringFunction=smoaDistance file://$CWD/myOnto.owl file://$CWD/edu.mit.visus.bibtex.owl -t 0.5 -o results/SMOA5.rdf
</div>

<p>See the output in <a href="results/SMOA5.rdf"><abbr>RDF</abbr>/<abbr>XML</abbr></a> or <a href="results/SMOA5.html"><abbr>HTML</abbr></a>.</p>

<p><b>Other manipulations:</b> It is possible to invert an alignment with the following command:</p>
<div class="fragment">
$ java -cp ../../../lib/procalign.jar fr.inrialpes.exmo.align.util.ParserPrinter -i results/SMOA5.rdf -o results/AOMS5.rdf
</div>
<p>See the output in <a href="results/AOMS5.rdf"><abbr>RDF</abbr>/<abbr>XML</abbr></a> or <a href="results/AOMS5.html"><abbr>HTML</abbr></a>. The results is an alignment from the source to the target. Inverting alignment is only the exchange of the order of the elements in the alignment file. This can be useful when you have an alignment of <i>A</i> to <i>B</i>, an alignment from <i>C</i> to <i>B</i> and you want to go from <i>A</i> to <i>C</i>. The solution is then to invert the second alignment and to compose them.</p>

<div class="logic"><p><b>More work:</b> There is another switch (<tt>-T</tt>) in Procalign that specifies the way a threshold is applied (hard|perc|prop|best|span) the default being "hard". The curious reader can apply these and see the difference in results. How they work is explained in the Alignment <abbr>API</abbr> documentation.</p></div>

<div class="logic"><p><b>More work:</b> Try to play with the thresholds in order to find the best values for levenshteinDistance and smoaDistance.</p></div>
	
<h2>Output</h2>
	
<p>Once a good alignment has been found, only half of the work has been done. In order to actually use our result it is necessary to transform it into some processable format. For instance, if one wants to merge two OWL ontologies, the alignment can be changed into set of <acronym>OWL</acronym> "bridging" axioms. This is achieved by "rendering" the alignment in <acronym>OWL</acronym> (through the <tt>-r</tt> switch):</p>
<div class="fragment">
$ java -cp ../../../lib/procalign.jar fr.inrialpes.exmo.align.util.ParserPrinter results/SMOA5.rdf -r fr.inrialpes.exmo.align.impl.renderer.OWLAxiomsRendererVisitor
</div>

<p>The result is a set of OWL assertions of the form:</p>
<div class="owl"><pre>
  &lt;owl:Class rdf:about="http://alignapi.gforge.inria.fr/tutorial/myOnto.owl#Techreport"&gt;
    &lt;owl:equivalentClass rdf:resource="http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl#Techreport"/&gt;
  &lt;/owl:Class&gt;

  &lt;owl:ObjectProperty rdf:about="http://alignapi.gforge.inria.fr/tutorial/myOnto.owl#copyright"&gt;
    &lt;owl:equivalentProperty rdf:resource="http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl#hasCopyright"/&gt;
  &lt;/owl:ObjectProperty&gt;
</pre></div>

<p>If one wants to use the alignments only for infering on instances without actually merging the classes, she can generate SWRL rules:</p>
<div class="fragment">
$ java -cp ../../../lib/procalign.jar fr.inrialpes.exmo.align.util.ParserPrinter results/SMOA5.rdf -r fr.inrialpes.exmo.align.impl.renderer.SWRLRendererVisitor
</div>
<p>which brings for the same assertions:</p>
<div class="owl"><pre>
  &lt;ruleml:imp&gt;
    &lt;ruleml:_body&gt;
      &lt;swrl:classAtom&gt;
        &lt;owllx:Class owllx:name="http://alignapi.gforge.inria.fr/tutorial/myOnto.owl#Techreport"/&gt;
        &lt;ruleml:var&gt;x&lt;/ruleml:var&gt;
      &lt;/swrl:classAtom&gt;
    &lt;/ruleml:_body&gt;
    &lt;ruleml:_head&gt;
      &lt;swrlx:classAtom&gt;
        &lt;owllx:Class owllx:name="http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl#Techreport"/&gt;
        &lt;ruleml:var>x&lt;/ruleml:var&gt;
      &lt;/swrl:classAtom&gt;
    &lt;/ruleml:_head&gt;
  &lt;/ruleml:imp&gt;

  &lt;ruleml:imp&gt;
    &lt;ruleml:_body&gt;
      &lt;swrl:individualPropertyAtom swrlx:property="http://alignapi.gforge.inria.fr/tutorial/myOnto.owl#copyright"/&gt;
        &lt;ruleml:var&gt;x&lt;/ruleml:var&gt;
        &lt;ruleml:var&gt;y&lt;/ruleml:var&gt;
      &lt;/swrl:individualPropertyAtom&gt;
    &lt;/ruleml:_body&gt;
    &lt;ruleml:_head&gt;
      &lt;swrl:datavaluedPropertyAtom swrlx:property="http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl#hasCopyright"/&gt;
        &lt;ruleml:var&gt;x&lt;/ruleml:var&gt;
        &lt;ruleml:var&gt;y&lt;/ruleml:var&gt;
      &lt;/swrl:datavaluedPropertyAtom&gt;
    &lt;/ruleml:_head&gt;
  &lt;/ruleml:imp&gt;
</pre></div>
	
<p>Exchanging data can also be achieved more simply through <abbr>XSLT</abbr> transformations which will transform the <acronym>OWL</acronym> instance files from one ontology to another:</p>
<div class="fragment">
$ java -cp ../../../lib/procalign.jar fr.inrialpes.exmo.align.util.ParserPrinter results/SMOA5.rdf -r fr.inrialpes.exmo.align.impl.renderer.XSLTRendererVisitor -o results/SMOA5.xsl
</div>
<p>this transformation can be applied to the data of <a href="data.xml">data.xml</a>:</p>
<div class="fragment">
$ xsltproc results/SMOA5.xsl data.xml > results/data.xml
</div>
<p>for giving the <a href="results/data.xml">results/data.xml</a> file.</p>
	
<h2>Evaluating</h2>
	
<p>We will evaluate alignments by comparing them to some reference alignment which is supposed to express what is expected from an alignment of these two ontologies. The reference alignment is <a href="refalign.rdf">refalign.rdf</a> (or <a href="results/refalign.html"><abbr>HTML</abbr></a>).</p>

<p>For evaluating we use another class than <tt>Procalign</tt>. It is called <tt>EvalAlign</tt> we should specify this to <tt>java</tt>. By default, it computes precision, recall and associated measures. It can be invoked this way:</p>
<div class="fragment">
$ java -cp ../../../lib/procalign.jar fr.inrialpes.exmo.align.util.EvalAlign -i fr.inrialpes.exmo.align.impl.eval.PRecEvaluator file://$CWD/refalign.rdf file://$CWD/tutorial1/results/equal.rdf
</div>

<p>The first argument is always the reference alignment, the second one is the alignment to be evaluated. The result is given here:</p>
<div class="owl"><pre>
&lt;?xml version='1.0' encoding='utf-8' standalone='yes'?>
&lt;rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
  xmlns:map='http://www.atl.external.lmco.com/projects/ontology/ResultsOntology.n3#'>
  &lt;map:output rdf:about=''>
    &lt;map:input1 rdf:resource="http://alignapi.gforge.inria.fr/tutorial/myOnto.owl"/>
    &lt;map:input2 rdf:resource="http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl"/>
    &lt;map:precision>1.0&lt;/map:precision>
    &lt;map:recall>0.3541666666666667&lt;/map:recall>
    &lt;fallout>0.0&lt;/fallout>
    &lt;map:fMeasure>0.5230769230769231&lt;/map:fMeasure>
    &lt;map:oMeasure>0.3541666666666667&lt;/map:oMeasure>
    &lt;time>22&lt;/time>
    &lt;result>0.3541666666666667&lt;/result>
  &lt;/map:output>
&lt;/rdf:RDF>
</pre></div>

<p>Of course, since that method only match objects with the same name, it is accurate, yielding a high precision. However, it has poor recall.</p>

<p>We can now evaluate the edit distance. What to expect from the evaluation of this alignment?</p>
<div class="button">
	<input type="button" onclick="show('qu5')" value="Show Discussion"/>
	<input type="button" onclick="hide('qu5')" value="Hide Discussion"/>
</div>
<div class="explain" id="qu5"><p>Since it returns more correspondences by loosening the constraints for being a correspondence, it is expected that the recall will increase at the expense of precision.</p></div>
<p>We can see the results of:</p>
<div class="fragment">
$ java -cp ../../../lib/procalign.jar fr.inrialpes.exmo.align.util.EvalAlign -i fr.inrialpes.exmo.align.impl.eval.PRecEvaluator file://$CWD/refalign.rdf file://$CWD/tutorial1/results/levenshtein33.rdf
</div>
<div class="button">
	<input type="button" onclick="show('qu6')" value="Show result"/>
	<input type="button" onclick="hide('qu6')" value="Hide result"/>
</div>
<div class="explain" id="qu6"><pre>
&lt;?xml version='1.0' encoding='utf-8' standalone='yes'?>
&lt;rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
  xmlns:map='http://www.atl.external.lmco.com/projects/ontology/ResultsOntology.n3#'>
  &lt;map:output rdf:about=''>
    &lt;map:input1 rdf:resource="http://alignapi.gforge.inria.fr/tutorial/myOnto.owl"/>
    &lt;map:input2 rdf:resource="http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl"/>
    &lt;map:precision>0.6153846153846154&lt;/map:precision>
    &lt;map:recall>1.0&lt;/map:recall>
    &lt;fallout>0.38461538461538464&lt;/fallout>
    &lt;map:fMeasure>0.761904761904762&lt;/map:fMeasure>
    &lt;map:oMeasure>0.375&lt;/map:oMeasure>
    &lt;time>28&lt;/time>
    &lt;result>1.625&lt;/result>
  &lt;/map:output>
&lt;/rdf:RDF>
</pre></div>
<p>It is possible to summarize these results by comparing them to each others. This can be achieved by the <tt>GroupEval</tt> class. This class can output several formats (by default html) and takes all the alignments in the subdirectories of the current directory. Here we only have the <tt>results</tt> directory:</p>
<div class="fragment">
$ cp ../refalign.rdf results
$ java -cp ../../../lib/procalign.jar fr.inrialpes.exmo.align.util.GroupEval -r refalign.rdf -l "refalign,equal,SMOA,SMOA5,levenshtein,levenshtein33" -c -f prm -o results/eval.html
</div>

<p>The results are displayed in the <a href="results/eval.html">results/eval.html</a> file whose main content is the table:</p>
<center style="font-size: 82%;">
<table border='2' frame='sides' rules='groups'>
<colgroup align='center' />
<colgroup align='center' span='3' />
<colgroup align='center' span='3' />
<colgroup align='center' span='3' />
<colgroup align='center' span='3' />
<colgroup align='center' span='3' />
<colgroup align='center' span='3' />
<thead valign='top'><tr><th>algo</th>
<th colspan='3'>refalign</th>
<th colspan='3'>equal</th>
<th colspan='3'>SMOA</th>
<th colspan='3'>SMOA5</th>
<th colspan='3'>levenshtein</th>
<th colspan='3'>levenshtein33</th>
</tr></thead><tbody><tr><td>test</td>
<td>Prec.</td>
<td>Rec.</td>
<td>FMeas.</td>
<td>Prec.</td>
<td>Rec.</td>
<td>FMeas.</td>
<td>Prec.</td>
<td>Rec.</td>
<td>FMeas.</td>
<td>Prec.</td>
<td>Rec.</td>
<td>FMeas.</td>
<td>Prec.</td>
<td>Rec.</td>
<td>FMeas.</td>
<td>Prec.</td>
<td>Rec.</td>
<td>FMeas.</td>
</tr></tbody><tbody>
<tr>
<td>results</td>
<td>1.00</td>
<td>1.00</td>
<td>1.00</td>
<td>1.00</td>
<td>0.35</td>
<td>0.52</td>
<td>0.53</td>
<td>0.96</td>
<td>0.69</td>
<td>0.66</td>
<td>0.96</td>
<td>0.78</td>
<td>0.51</td>
<td>1.00</td>
<td>0.68</td>
<td>0.62</td>
<td>1.00</td>
<td>0.76</td>
</tr>
<tr bgcolor="yellow"><td>H-mean</td><td>1.00</td>
<td>1.00</td>
<td>1.00</td>
<td>1.00</td>
<td>0.35</td>
<td>0.52</td>
<td>0.53</td>
<td>0.96</td>
<td>0.69</td>
<td>0.66</td>
<td>0.96</td>
<td>0.78</td>
<td>0.51</td>
<td>1.00</td>
<td>0.68</td>
<td>0.62</td>
<td>1.00</td>
<td>0.76</td>
</tr>
</tbody></table>
</center>
	
<!--div class="fragment">
$ java -jar ../../../lib/Procalign.jar file://$CWD/rdf/edu.umbc.ebiquity.publication.owl file://$CWD/rdf/edu.mit.visus.bibtex.owl -i fr.inrialpes.exmo.align.impl.method.StringDistAlignment -DstringFunction=levenshteinDistance -DprintMatrix=1 -o /dev/null > matrix.tex
</div-->
	
<div class="logic"><p><b>More work:</b> As you can see, the <tt>PRecEvaluator</tt> does not only provide precision and recall but also provides F-measure. F-measure is usually used as an "absolute" trade-off between precision and recall (i.e., the optimum F-measure is considered the best precision and recall). Can you establish this point for <acronym>SMOA</acronym> and levenshtein and tell which algorithm is more adapted?</p></div>
	
<!--div class="logic"><p><b>More work:</b>If you want to compare several algorithms, there is another class, GroupAlign, that allows to run an</p></div-->
	
<h2>Further exercises</h2>
	
<p>More info: <a href="http://alignapi.gforge.inria.fr">http://alignapi.gforge.inria.fr</a></p>
	
<hr />
<small>
<p style="text-align: center;">http://alignapi.gforge.inria.fr/tutorial/tutorial1/</p>
</small>
<hr />
<p>$Id$</p>
</body>
</html>