From 827480701a3e76053c6083aaf24bbd44bca78ce6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr>
Date: Mon, 16 Aug 2010 08:18:39 +0000
Subject: [PATCH] - implemented getInstances for ASSERTED in OWLAPI 3

---
 html/relnotes.html                               | 14 +++++++++-----
 .../exmo/ontowrap/owlapi30/OWLAPI3Ontology.java  | 16 +++++++++++++---
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/html/relnotes.html b/html/relnotes.html
index 72b65722..95ec2c60 100644
--- a/html/relnotes.html
+++ b/html/relnotes.html
@@ -44,8 +44,8 @@ The development of 4 versions continue.
 <li>Complete tutorial4 with distributed reasoning.</li>
 <li>Genericize evaluators in <tt>GraphEvaluator</tt> and <tt>GenPlot</tt> (eval)</li>
 <li>Implementation of a provenance metadata tag (server/impl)</li>
-<li>Replace <tt>DistanceAlignment</tt> with a version more in line
-  with OntoSim (impl)</tt>
+<li>Replace <tt>DistanceAlignment</tt> and <tt>Similarity</tt> with a version more in line
+  with <a href="http://ontosim.gforge.inria.fr">OntoSim</a> (impl)</tt>
 <!--li>Implemented transformations in EDOAL (edoal)</li-->
 <li>Improve HTML interface layout and usability (server)</li>
 <li>Implement metadata edition (server)</li>
@@ -67,15 +67,19 @@ The development of 4 versions continue.
 <li>Integration of skoslite (home made SKOS API) (ontowrap)</li>
 <li>Integration of SKOS API (ontowrap)</li>
 <li>Extended ontowrap so that all methods can raise exceptions (ontowrap)</li>
+<li><tt>DistanceAligment</tt> can now deal indiferently with similarity or distances (impl)</li>
 <li>Implement fully relaxed precision and recall (impl)</li>
+<li>Added Wu-Palmer and gloss overlap similarity over WordNet to <tt>JWNLAlignment</tt> (impl)</li>
+<li>Added <tt>InstanceBasedMatrixMeasure</tt> for instance based alignments (impl)</li>
 <li>Added a <tt>getResult()</tt> method to <tt>Evaluator</tt> (api)</li>
-<li>Added a <tt>DiffAlign( al1, al2 )</tt> evaluator (impl) and interface (server)</li>
-<li>Implemented online evaluation (server)</li>
+<li>Added a <tt>DiffAlign( al1, al2 )</tt> evaluator (impl)</li>
+<li>Implemented online evaluation and diff (server)</li>
 <li>Added the possibility to drop a number of correspondences in <tt>ONetworkWeakener</tt> (util)</li>
-<li>Added a google chart api display of plots <tt>GenPlot -t html</tt> (util)</li>
+<li>Added a google chart API display of plots <tt>GenPlot -t html</tt> (util)</li>
 <li><tt>edoal:or</tt>, <tt>edoal:and</tt> and <tt>edoal:compose</tt>
   can be empty (edoal)</li>
 <li>Upgraded to <span style="color: green">Pellet 2.1</span> (lib)</li>
+<li>Upgraded to <span style="color: green">OntoSim 2.0</span> (lib)</li>
 <li>Added <a href="tutorial/tutorial4/index.html">tutorial 4</a> Pellet action (tutorial)</li>
 <li>Added <a href="tutorial/tutorial5/index.html">tutorial 5</a> about exposing matchers as web services (tutorial)</li>
 <li>Fixed path errors in tutorials (tutorial)</li>
diff --git a/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3Ontology.java b/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3Ontology.java
index 4d0faa72..45ade41e 100644
--- a/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3Ontology.java
+++ b/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3Ontology.java
@@ -348,12 +348,22 @@ public class OWLAPI3Ontology extends BasicOntology<OWLOntology> implements Heavy
     };
     // Pretty inefficient but nothing seems to be stored
     public Set<Object> getInstances( Object cl, int local, int asserted, int named  ){
-	Set<Object> sbcl = new HashSet<Object>();
+	Set<Object> inst = new HashSet<Object>();
+	Set<Object> sbcl = null;
+	if ( asserted != OntologyFactory.ASSERTED ) sbcl = getSubClasses( cl, local, 0, named );
 	for( Object i : getIndividuals() ) {
 	    //if ( getClasses( (OWLIndividual)i, local, asserted, named ).contains( cl ) ) sbcl.add( i );
-	    if ( ((OWLIndividual)i).getTypes( getOntology() ).contains( cl ) ) sbcl.add( i );
+	    if ( ((OWLIndividual)i).getTypes( getOntology() ).contains( cl ) ) inst.add( i );
+	    if ( asserted != OntologyFactory.ASSERTED ) {
+		for ( Object cl2 : sbcl ){
+		    if ( ((OWLIndividual)i).getTypes( getOntology() ).contains( cl2 ) ) {
+			inst.add( i );
+			break;
+		    }
+		}
+	    }
 	}
-	return sbcl;
+	return inst;
     };
 
     /* Property methods */
-- 
GitLab