From 8a2934670f6291fa3333788438e5ec1464871288 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr>
Date: Mon, 27 Feb 2017 14:45:59 +0000
Subject: [PATCH] - Completed equality binding with sameAs

---
 README.TXT                                      |  5 ++---
 .../renderer/SPARQLLinkkerRendererVisitor.java  | 17 +++++++++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/README.TXT b/README.TXT
index 0f911a58..9f4e9d1e 100644
--- a/README.TXT
+++ b/README.TXT
@@ -78,9 +78,8 @@ $ java -jar lib/procalign.jar file://$CWD/examples/rdf/edu.umbc.ebiquity.publica
 Using with JWNL (Wordnet)
 -------------------------
 
-- Wordnet should be installed its directory to be put in $WNDIR (2.0, 3.0, 3.1 should work)
-- jwnl.jar commons-logging.jar must be in lib.
-(file_properties.xml need not anymore to be in current directory)
+- Wordnet should be installed its directory to be put in $WNDIR (3.0 and 3.1 should work)
+- jwnl.jar commons-logging.jar must be in lib (file_properties.xml need not anymore to be in current directory)
 
 $ export WNDIR=../WordNet-3.1/dict
 
diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/SPARQLLinkkerRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/SPARQLLinkkerRendererVisitor.java
index c6066ad7..12446433 100644
--- a/src/fr/inrialpes/exmo/align/impl/renderer/SPARQLLinkkerRendererVisitor.java
+++ b/src/fr/inrialpes/exmo/align/impl/renderer/SPARQLLinkkerRendererVisitor.java
@@ -287,6 +287,21 @@ public class SPARQLLinkkerRendererVisitor extends GraphPatternRendererVisitor im
 	    lkpattern += "MINUS { " + GP1 + "FILTER NOT EXISTS { "+ GP2 +" FILTER ( "+equalValueFilterStatement( o1, o2 )+" ) } }"+NL;
 	    lkpattern += "MINUS { " + GP2 + "FILTER NOT EXISTS { "+ GP1 +" FILTER ( "+equalValueFilterStatement( o1, o2 )+" ) } }"+NL;
 	} else if ( generateSameAs ) { // should be the same...
+	    //initStructure(); //strBGP = ""; // congrats! Unsure
+	    emptyGP();
+	    String o1 = createVarName();
+	    resetVariables( "?s1", o1 );
+	    linkkeyEquals.getExpression1().accept( this );
+	    String GP1 = wrapInNamedGraph( onto1NamedGraph, getGP() );
+	    //initStructure(); //strBGP = ""; // congrats!
+	    emptyGP();
+	    String o2 = createVarName();
+	    resetVariables( "?s2", o2 );
+	    linkkeyEquals.getExpression2().accept( this );
+	    String GP2 = wrapInNamedGraph( onto2NamedGraph, getGP() );
+	    // The two patterns are independent so can use the same variables
+	    lkpattern += "MINUS { " + GP1 + "FILTER NOT EXISTS { "+ GP2 +" FILTER ( "+equalObjectFilterStatement( o1, o2 )+" ) } }"+NL;
+	    lkpattern += "MINUS { " + GP2 + "FILTER NOT EXISTS { "+ GP1 +" FILTER ( "+equalObjectFilterStatement( o1, o2 )+" ) } }"+NL;
 	} else {
 	    initStructure(); //strBGP = ""; // congrats! Unsure
 	    emptyGP();
@@ -353,6 +368,8 @@ public class SPARQLLinkkerRendererVisitor extends GraphPatternRendererVisitor im
     }
 
     // There could be two options, test which one is fastest to evaluate...
+    // Note that the sameAs statement is evaluated out of any namedGraph
+    // it could also be disjunctively wrapped in both named graphs
     protected String equalObjectFilterStatement ( String o1, String o2 ) {
 	//return o1+" owl:sameAs "+o2+". UNION FILTER( "+o1+" = "+o2+" )";
 	return o1+" = "+o2+" || EXISTS { "+o1+" owl:sameAs "+o2+" . }";
-- 
GitLab