diff --git a/html/tutorial/index.html b/html/tutorial/index.html index 7dd7c8a87145425db097012d923e1934d15f928c..205c909ac87753f79a62c0e9333e82dfeab6685b 100644 --- a/html/tutorial/index.html +++ b/html/tutorial/index.html @@ -39,7 +39,7 @@ div.logic { <dt>This version:</dt> <dd>http://alignapi.gforge.inria.fr/tutorial/</dd> <dt>Author:</dt> -<dd><a href="http://exmo.inrialpes.fr/people/euzenat">Jérôme Euzenat</a>, INRIA Grenobe Rhône-Alpes & LIG +<dd><a href="http://exmo.inrialpes.fr/people/euzenat">Jérôme Euzenat</a>, INRIA Grenoble Rhône-Alpes & LIG </dd> </dl> diff --git a/html/tutorial2/index.html b/html/tutorial2/index.html new file mode 100644 index 0000000000000000000000000000000000000000..e45e7ab5bc7ea9f430d97792d52ef7241b8d8deb --- /dev/null +++ b/html/tutorial2/index.html @@ -0,0 +1,179 @@ +<?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>Advanced tutorial on the Alignment API</title> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> +<meta name="Contributor" content="Antoine Zimmermann" /> +<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>Advanced tutorial on the Alignment <abbr title="Application Programming Interface">API</abbr> and server</h1> + +<dl> +<dt>This version:</dt> +<dd>http://alignapi.gforge.inria.fr/tutorial2/</dd> +<dt>Author:</dt> +<dd><a href="http://exmo.inrialpes.fr/people/euzenat">Jérôme Euzenat</a>, INRIA Grenoble Rhône-Alpes & 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 embedded in some application programme and we are working towards implementing an alignment server that can help programmes to use the <abbr>API</abbr> remotely. +</p> +<p>A small <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> +<small>This tutorial has been designed for the Alignment API version 3.6.</small> + +<h2>Preparation</h2> + +<p>See the <a href="../tutorial/index.html">simple tutorial preparation part</a>.</p> + +<h2>The data</h2> + +<p> +We have two ontologies, to be found on the web, under which two half of the summerschool participants are described. +</p> +<p> +The goal is to have a unified view of these participants. +.</p> + +<p>The goal here is to develop a program in Java.</p> + +<h2>Matching ontologies</h2> + +<p> +This can be achieved: +<ul> +<li>by running programs either locally or from the alignment server</li> +<li>by finding an alignment from the web/server</li> +<li>by finding a chain of alignments from the web/server</li> +</ul> +</p> + +<h2>Manipulate the data</h2> + +<p> +Again, this is either: +<ul> +<li>generating OWL axioms from the alignments and merge the ontologies</li> +<li>transforming data from one ontology to another</li> +</ul> +This can be done with the alignment API support. +</p> + +<h2>Generate the answers</h2> + +<p> +This can be done in two ways: +<ul> +<li>using SPARQL but I think that I already</li> +<li>using Pellet or something to answer these queries.</li> +</ul> +Indeed, I will go for the second one (too bad because the first one is nice). +</p> + +<p>Of course, you can do it progressively.</p> +<div class="fragment"> +$ javac -classpath ../../lib/api.jar:../../lib/rdfparser.jar:../../lib/align.jar:../../lib/procalign.jar -d results MyApp.java +$ java -cp ../../lib/Procalign.jar:results MyApp file://$CWD/myOnto.owl file://$CWD/edu.mit.visus.bibtex.owl > results/MyApp.owl +</div> + +<p>Do you want to see a possible solution?</p> +<div class="button"> + <input type="button" onclick="show('qu7')" value="Cheat"/> + <input type="button" onclick="hide('qu7')" value="Teacher is comming"/> +</div> +<div class="explain" id="qu7"><p>The main piece of code in Skeleton.java is replaced by:</p> +<pre> +// Run two different alignment methods (e.g., ngram distance and smoa) +AlignmentProcess a1 = new StringDistAlignment(); +a1.init( onto1, onto2 ); +params.setParameter("stringFunction","smoaDistance"); +a1.align( (Alignment)null, params ); +AlignmentProcess a2 = new StringDistAlignment(); +a2.init( onto1, onto2 ); +params = new BasicParameters(); +params.setParameter("stringFunction","ngramDistance"); +a2.align( (Alignment)null, params ); + +// Merge the two results. +((BasicAlignment)a1).ingest(a2); + +// Threshold at various thresholds +// Evaluate them against the references +// and choose the one with the best F-Measure +AlignmentParser aparser = new AlignmentParser(0); +Alignment reference = aparser.parse( "file://"+(new File ( "refalign.rdf" ) . getAbsolutePath()) ); +Evaluator evaluator = new PRecEvaluator( reference, a1 ); + +double best = 0.; +Alignment result = null; +for ( int i = 0; i <= 10 ; i = i+2 ){ + a1.cut( ((double)i)/10 ); + evaluator.eval( new BasicParameters() ); + System.err.println("Threshold "+(((double)i)/10)+" : "+((PRecEvaluator)evaluator).getFmeasure()); + if ( ((PRecEvaluator)evaluator).getFmeasure() > best ) { + result = (BasicAlignment)((BasicAlignment)a1).clone(); + best = ((PRecEvaluator)evaluator).getFmeasure(); + } +} + +// Displays it as SWRL Rules +PrintWriter writer = new PrintWriter ( + new BufferedWriter( + new OutputStreamWriter( System.out, "UTF-8" )), true); +AlignmentVisitor renderer = new SWRLRendererVisitor(writer); +result.render(renderer); +writer.flush(); +writer.close(); +</pre></div> + +<p>A full working solution is <a href="MyApp.java">MyApp.java</a>.</p> + +<div class="logic"><p><b>More work:</b> We will think about that.</p></div> + +<h2>Further exercises</h2> + +<p>More info: <a href="http://alignapi.gforge.inria.fr">http://alignapi.gforge.inria.fr</a></p> + + +<h2>Acknowledgements</h2> + +<p>The format of this tutorial has been shamelessly borrowed from Sean Bechhofer's <a href="http://owl.man.ac.uk/2005/07/sssw/"><acronym>OWL</acronym> tutorial</a>.</p> + +<hr /> +<small> +<p style="text-align: center;">http://alignapi.gforge.inria.fr/tutorial2/</p> +</small> +<hr /> +<p>$Id: index.html 742 2008-07-07 23:20:07Z euzenat $</p> +</body> +</html>