From d397310533a241ba370208864008643ee43cff05 Mon Sep 17 00:00:00 2001 From: Nicolas Guillouet <nicolas@meaningengines.com> Date: Tue, 9 Dec 2014 10:32:24 +0000 Subject: [PATCH] Adding new tests : SPARQLSelectRendererVisitorTest.QueryFromAndProperty + SPARQLConstructVisitorTest.ConstructFromAndProperty. Have to uncomment and fix --- .../exmo/align/parser/RDFParser.java | 6 +- test/input/alignment_with_and_property.rdf | 93 +++++++++ test/src/SPARQLConstructVisitorTest.java | 176 ++++++++++++------ test/src/SPARQLSelectRendererVisitorTest.java | 97 +++++++++- test/src/Utils.java | 2 - 5 files changed, 311 insertions(+), 63 deletions(-) create mode 100644 test/input/alignment_with_and_property.rdf diff --git a/src/fr/inrialpes/exmo/align/parser/RDFParser.java b/src/fr/inrialpes/exmo/align/parser/RDFParser.java index 1f6a097d..03a8cd60 100644 --- a/src/fr/inrialpes/exmo/align/parser/RDFParser.java +++ b/src/fr/inrialpes/exmo/align/parser/RDFParser.java @@ -832,7 +832,7 @@ public class RDFParser { ValueExpression v = parseValue(stmt.getObject()); return new PropertyValueRestriction(comp, v); } else { - throw new AlignmentException("There is no pasrser for entity " + rdfType.getLocalName()); + throw new AlignmentException("parseProperty : There is no parser for entity " + rdfType.getLocalName()); } } @@ -946,7 +946,7 @@ public class RDFParser { throw new AlignmentException("Incorrect class expression " + nn); } } else { - throw new AlignmentException("There is no pasrser for entity " + rdfType.getLocalName()); + throw new AlignmentException("parseRelation : There is no parser for entity " + rdfType.getLocalName()); } } @@ -962,7 +962,7 @@ public class RDFParser { } else if (isPattern) { // not necessarily with a variable (real patterns) return new InstanceId(); } else { - throw new AlignmentException("There is no pasrser for entity " + rdfType.getLocalName()); + throw new AlignmentException("parseInstance : There is no parser for entity " + rdfType.getLocalName()); } } diff --git a/test/input/alignment_with_and_property.rdf b/test/input/alignment_with_and_property.rdf new file mode 100644 index 00000000..8a4bb5be --- /dev/null +++ b/test/input/alignment_with_and_property.rdf @@ -0,0 +1,93 @@ +<?xml version='1.0' encoding='utf-8' standalone='no'?> +<rdf:RDF xmlns='http://knowledgeweb.semanticweb.org/heterogeneity/alignment#' + xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' + xmlns:ns0='http://exmo.inrialpes.fr/align/service#' + xmlns:xsd='http://www.w3.org/2001/XMLSchema#' + xmlns:align='http://knowledgeweb.semanticweb.org/heterogeneity/alignment#' + xmlns:edoal='http://ns.inria.org/edoal/1.0/#'> +<Alignment rdf:about="http://localhost:8089/alid/1394718240757/976"> + <xml>yes</xml> + <level>2EDOAL</level> + <type>?*</type> + <pretty>test1</pretty> + <ns0:cached>Thu Mar 13 14:44:05 CET 2014</ns0:cached> + <ns0:stored>null</ns0:stored> + <time>34</time> + <ns0:ouri2>http://purl.org/ontology/mo/</ns0:ouri2> + <id>http://localhost:8089/alid/1394718240757/976</id> + <ns0:ouri1>http://exmo.inria.fr/connectors-data/example_musical_work_desc/</ns0:ouri1> + <method>fr.inrialpes.exmo.align.impl.method.SubsDistNameAlignment</method> + <onto1> + <Ontology rdf:about="http://exmo.inria.fr/connectors-data/example_musical_work_desc/"> + <location>file:///home/nicolas/Bureau/Discotheka/Inria/Mission/tests/musical_work_source_desc.owl</location> + <formalism> + <Formalism align:name="OWL2.0" align:uri="http://www.w3.org/2002/07/owl#"/> + </formalism> + </Ontology> + </onto1> + <onto2> + <Ontology rdf:about="http://purl.org/ontology/mo/"> + <location>file:///home/nicolas/Bureau/Discotheka/Inria/Mission/tests/musicontology1.2.rdf</location> + <formalism> + <Formalism align:name="OWL2.0" align:uri="http://www.w3.org/2002/07/owl#"/> + </formalism> + </Ontology> + </onto2> + <map> + <Cell rdf:about="http://exmo.inrialpes.fr/connectors-core#cell1"> + <entity1> + <edoal:Class rdf:about="http://exmo.inrialpes.fr/connectors-core#RootElement"/> + </entity1> + <entity2> + <edoal:Class rdf:about="http://purl.org/ontology/mo/MusicalWork"/> + </entity2> + <relation>=</relation> + <measure rdf:datatype='http://www.w3.org/2001/XMLSchema#float'>1.0</measure> + <edoal:linkkey> + <edoal:Linkkey> + <edoal:binding> + <edoal:Intersects> + <edoal:property1> + <edoal:Property rdf:about="http://exmo.inrialpes.fr/connectors-data#tonalite"/> + </edoal:property1> + <edoal:property2> + <edoal:Property> + <edoal:and rdf:parseType="Collection"> + <edoal:PropertyDomainRestriction> + <edoal:class> + <edoal:Class rdf:about="http://purl.org/NET/c4dm/keys.owl#Key"/> + </edoal:class> + </edoal:PropertyDomainRestriction> + <edoal:Property rdf:about="http://www.w3.org/2000/01/rdf-schema#label"/> + </edoal:and> + </edoal:Property> + </edoal:property2> + </edoal:Intersects> + </edoal:binding> + </edoal:Linkkey> + </edoal:linkkey> + </Cell> + </map> + <map> + <Cell rdf:about="http://exmo.inrialpes.fr/connectors-core#cell2"> + <entity1> + <edoal:Property rdf:about="http://exmo.inrialpes.fr/connectors-data#tonalite" /> + </entity1> + <entity2> + <edoal:Property> + <edoal:and rdf:parseType="Collection"> + <edoal:PropertyDomainRestriction> + <edoal:class> + <edoal:Class rdf:about="http://purl.org/NET/c4dm/keys.owl#Key"/> + </edoal:class> + </edoal:PropertyDomainRestriction> + <edoal:Property rdf:about="http://www.w3.org/2000/01/rdf-schema#label"/> + </edoal:and> + </edoal:Property> + </entity2> + <relation>=</relation> + <measure rdf:datatype='http://www.w3.org/2001/XMLSchema#float'>1.0</measure> + </Cell> + </map> +</Alignment> +</rdf:RDF> diff --git a/test/src/SPARQLConstructVisitorTest.java b/test/src/SPARQLConstructVisitorTest.java index 1b064552..d30cd969 100644 --- a/test/src/SPARQLConstructVisitorTest.java +++ b/test/src/SPARQLConstructVisitorTest.java @@ -17,8 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - import fr.inrialpes.exmo.align.impl.edoal.ClassId; import fr.inrialpes.exmo.align.impl.edoal.EDOALAlignment; import fr.inrialpes.exmo.align.impl.edoal.EDOALCell; @@ -84,7 +82,7 @@ public class SPARQLConstructVisitorTest { + "WHERE {\n" + "?s ns0:opus ?o .\n" + "}\n"; - + String expectedQuery2 = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors#>\n" + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" @@ -95,12 +93,10 @@ public class SPARQLConstructVisitorTest { + "?s ns1:opus ?o .\n" + "}\n"; - assertEquals(renderer.getQueryFromOnto1ToOnto2(opusCell), expectedQuery1); assertEquals(renderer.getQueryFromOnto2ToOnto1(opusCell), expectedQuery2); - + //For remote sparql endpoint : - // String remoteServiceURIName = "http://example.org/remoteSparql"; // URI remoteServiceURI = new URI(remoteServiceURIName); // @@ -153,7 +149,6 @@ public class SPARQLConstructVisitorTest { renderer.init(properties); alignment.render(renderer); - String expectedQuery1 = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors#>\n" + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" @@ -163,7 +158,7 @@ public class SPARQLConstructVisitorTest { + "WHERE {\n" + "?s rdf:type ns0:RootElement .\n" + "}\n"; - + String expectedQuery2 = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors#>\n" + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" @@ -173,57 +168,132 @@ public class SPARQLConstructVisitorTest { + "WHERE {\n" + "?s rdf:type ns1:MusicalWork .\n" + "}\n"; - + assertEquals(renderer.getQueryFromOnto1ToOnto2(classCell), expectedQuery1); assertEquals(renderer.getQueryFromOnto2ToOnto1(classCell), expectedQuery2); } @Test(groups = {"full", "impl", "raw"}) public void ConstructComposePropertyRelation() throws Exception { - String[] alignmentFilesNames = {"alignment1.rdf"}; - for (String alignmentFileName : alignmentFilesNames) { - EDOALAlignment alignment = Utils.loadAlignement(alignmentFileName); - StringWriter stringWriter = new StringWriter(); - PrintWriter writer = new PrintWriter(stringWriter); - SPARQLConstructRendererVisitor renderer = new SPARQLConstructRendererVisitor(writer); - Properties properties = new Properties(); - renderer.init(properties); - alignment.render(renderer); - assertEquals(alignment.nbCells(), 1); - Enumeration<Cell> cells = alignment.getElements(); - Cell cell = cells.nextElement(); - - - String expectedQuery1 = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" - + "PREFIX ns1:<http://purl.org/NET/c4dm/keys.owl#>\n" - + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors#>\n" - + "PREFIX ns3:<http://www.w3.org/2000/01/rdf-schema#>\n" - + "PREFIX ns2:<http://purl.org/ontology/mo/>\n" - + "CONSTRUCT {\n" - + "_:o3 rdf:type ns1:Key .\n" - + "_:o3 ns2:key _:o4 .\n" - + "_:o4 ns3:label ?o .\n" - + "}\n" - + "WHERE {\n" - + "?s ns0:key ?o .\n" - + "}\n"; - - String expectedQuery2 = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" - + "PREFIX ns1:<http://purl.org/NET/c4dm/keys.owl#>\n" - + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors#>\n" - + "PREFIX ns3:<http://www.w3.org/2000/01/rdf-schema#>\n" - + "PREFIX ns2:<http://purl.org/ontology/mo/>\n" - + "CONSTRUCT {\n" - + "?s ns0:key ?o .\n" - + "}\n" - + "WHERE {\n" - + "?o3 rdf:type ns1:Key .\n" - + "?o3 ns2:key ?o4 .\n" - + "?o4 ns3:label ?o .\n" - + "}\n"; - assertEquals(renderer.getQueryFromOnto1ToOnto2(cell), expectedQuery1, "FOR alignment file " + alignmentFileName); - assertEquals(renderer.getQueryFromOnto2ToOnto1(cell), expectedQuery2, "FOR alignment file " + alignmentFileName); - } + String alignmentFileName = "alignment1.rdf"; + EDOALAlignment alignment = Utils.loadAlignement(alignmentFileName); + StringWriter stringWriter = new StringWriter(); + PrintWriter writer = new PrintWriter(stringWriter); + SPARQLConstructRendererVisitor renderer = new SPARQLConstructRendererVisitor(writer); + Properties properties = new Properties(); + renderer.init(properties); + alignment.render(renderer); + assertEquals(alignment.nbCells(), 1); + Enumeration<Cell> cells = alignment.getElements(); + Cell cell = cells.nextElement(); + + String expectedQuery1 = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "PREFIX ns1:<http://purl.org/NET/c4dm/keys.owl#>\n" + + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors#>\n" + + "PREFIX ns3:<http://www.w3.org/2000/01/rdf-schema#>\n" + + "PREFIX ns2:<http://purl.org/ontology/mo/>\n" + + "CONSTRUCT {\n" + + "_:o3 rdf:type ns1:Key .\n" + + "_:o3 ns2:key _:o4 .\n" + + "_:o4 ns3:label ?o .\n" + + "}\n" + + "WHERE {\n" + + "?s ns0:key ?o .\n" + + "}\n"; + + String expectedQuery2 = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + + "PREFIX ns1:<http://purl.org/NET/c4dm/keys.owl#>\n" + + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors#>\n" + + "PREFIX ns3:<http://www.w3.org/2000/01/rdf-schema#>\n" + + "PREFIX ns2:<http://purl.org/ontology/mo/>\n" + + "CONSTRUCT {\n" + + "?s ns0:key ?o .\n" + + "}\n" + + "WHERE {\n" + + "?o3 rdf:type ns1:Key .\n" + + "?o3 ns2:key ?o4 .\n" + + "?o4 ns3:label ?o .\n" + + "}\n"; + assertEquals(renderer.getQueryFromOnto1ToOnto2(cell), expectedQuery1, "FOR alignment file " + alignmentFileName); + assertEquals(renderer.getQueryFromOnto2ToOnto1(cell), expectedQuery2, "FOR alignment file " + alignmentFileName); } +// @Test(groups = {"full", "impl", "raw"}) +// public void ConstructFromAndProperty() throws Exception { +// String alignmentFileName = "alignment_with_and_property.rdf"; +// EDOALAlignment alignment = Utils.loadAlignement(alignmentFileName); +// StringWriter stringWriter = new StringWriter(); +// PrintWriter writer = new PrintWriter(stringWriter); +// SPARQLConstructRendererVisitor renderer = new SPARQLConstructRendererVisitor(writer); +// Properties properties = new Properties(); +// renderer.init(properties); +// alignment.render(renderer); +// assertEquals(alignment.nbCells(), 2); +// Enumeration<Cell> cells = alignment.getElements(); +// +// Cell cell1 = null; +// Cell cell2 = null; +// while (cells.hasMoreElements()) { +// Cell cell = cells.nextElement(); +// if (cell.getId().equals("http://exmo.inrialpes.fr/connectors-core#cell1")) { +// cell1 = cell; +// } else { +// cell2 = cell; +// } +// } +// //First test : with "and" property on linkkey +// String expectedQuery = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +// + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors-core#>\n" +// + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" +// + "CONSTRUCT {\n" +// + "?s rdf:type ns1:MusicalWork .\n" +// + "}\n" +// + "WHERE {\n" +// + "?s rdf:type ns0:RootElement .\n" +// + "}\n"; +// String realQuery = renderer.getQueryFromOnto1ToOnto2(cell1); +// assertEquals(realQuery, expectedQuery); +// expectedQuery = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +// + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors-core#>\n" +// + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" +// + "CONSTRUCT {\n" +// + "?s rdf:type ns0:RootElement .\n" +// + "}\n" +// + "WHERE {\n" +// + "?s rdf:type ns1:MusicalWork .\n" +// + "}\n"; +// realQuery = renderer.getQueryFromOnto2ToOnto1(cell1); +// assertEquals(realQuery, expectedQuery); +// //Second test : with "and" property on entity +// expectedQuery = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +// + "PREFIX ns2:<http://exmo.inrialpes.fr/connectors-data#>\n" +// + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors-core#>\n" +// + "PREFIX ns3:<http://purl.org/NET/c4dm/keys.owl#>\n" +// + "PREFIX ns4:<http://www.w3.org/2000/01/rdf-schema#>\n" +// + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" +// + "CONSTRUCT {\n" +// + "?s rdf:type ns3:Key .\n" +// + "?s ns4:label ?o .\n"//@ Jérôme : we have ?o2 instead of ?o +// + "}\n" +// + "WHERE {\n" +// + "?s ns2:tonalite ?o .\n" +// + "}\n"; +// realQuery = renderer.getQueryFromOnto1ToOnto2(cell2); +// assertEquals(realQuery, expectedQuery); +// expectedQuery = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +// + "PREFIX ns2:<http://exmo.inrialpes.fr/connectors-data#>\n" +// + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors-core#>\n" +// + "PREFIX ns3:<http://purl.org/NET/c4dm/keys.owl#>\n" +// + "PREFIX ns4:<http://www.w3.org/2000/01/rdf-schema#>\n" +// + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" +// + "CONSTRUCT {\n" +// + "?s ns2:tonalite ?o .\n" +// + "}\n" +// + "WHERE {\n" +// + "?s rdf:type ns3:Key .\n" +// + "?s ns4:label ?o .\n"//@ Jérôme : we have ?o2 instead of ?o +// + "}\n"; +// realQuery = renderer.getQueryFromOnto2ToOnto1(cell2); +// assertEquals(realQuery, expectedQuery); +// } } diff --git a/test/src/SPARQLSelectRendererVisitorTest.java b/test/src/SPARQLSelectRendererVisitorTest.java index ad3844e6..959ce607 100644 --- a/test/src/SPARQLSelectRendererVisitorTest.java +++ b/test/src/SPARQLSelectRendererVisitorTest.java @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecutionFactory; @@ -45,7 +44,7 @@ import org.testng.annotations.Test; public class SPARQLSelectRendererVisitorTest { @Test(groups = {"full", "impl", "raw"}) - public void QueryFromWithoutLinkkey() throws Exception { + public void QueryWithoutLinkkey() throws Exception { String alignmentFileName = "alignment3.rdf"; EDOALAlignment alignment = Utils.loadAlignement(alignmentFileName); StringWriter stringWriter = new StringWriter(); @@ -81,7 +80,94 @@ public class SPARQLSelectRendererVisitorTest { assertEquals(renderer.getQueryFromOnto2ToOnto1(cell), expectedQuery); } - @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryFromWithoutLinkkey"}) +// @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryWithoutLinkkey"}) +// public void QueryFromAndProperty() throws Exception { +// String alignmentFileName = "alignment_with_and_property.rdf"; +// EDOALAlignment alignment = Utils.loadAlignement(alignmentFileName); +// StringWriter stringWriter = new StringWriter(); +// PrintWriter writer = new PrintWriter(stringWriter); +// SPARQLSelectRendererVisitor renderer = new SPARQLSelectRendererVisitor(writer); +// Properties properties = new Properties(); +// renderer.init(properties); +// alignment.render(renderer); +// assertEquals(alignment.nbCells(), 2); +// Enumeration<Cell> cells = alignment.getElements(); +// +// Cell cell1 = null; +// Cell cell2 = null; +// while (cells.hasMoreElements()) { +// Cell cell = cells.nextElement(); +// if (cell.getId().equals("http://exmo.inrialpes.fr/connectors-core#cell1")) { +// cell1 = cell; +// } else { +// cell2 = cell; +// } +// } +// //First test : with "and" property on linkkey +// String expectedQuery = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +// + "PREFIX ns2:<http://exmo.inrialpes.fr/connectors-data#>\n" +// + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors-core#>\n" +// + "PREFIX ns3:<http://purl.org/NET/c4dm/keys.owl#>\n" +// + "PREFIX ns4:<http://www.w3.org/2000/01/rdf-schema#>\n" +// + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" +// + "SELECT DISTINCT ?s1 ?s2 \n" +// + "WHERE {\n" +// + "?s1 rdf:type ns0:RootElement .\n" +// + "?s2 rdf:type ns1:MusicalWork .\n" +// + "?s1 ns2:tonalite ?o1 .\n" +// + "?s2 rdf:type ns3:Key .\n" +// + "?s2 ns4:label ?o1 .\n"//@ Jérôme : we have ?o2 instead of ?o1 +// + "FILTER(?s1 != ?s2)\n" +// + "}\n"; +// assertEquals(renderer.getQueryFromOnto1ToOnto2(cell1), expectedQuery); +// expectedQuery = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +// + "PREFIX ns2:<http://exmo.inrialpes.fr/connectors-data#>\n" +// + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors-core#>\n" +// + "PREFIX ns3:<http://purl.org/NET/c4dm/keys.owl#>\n" +// + "PREFIX ns4:<http://www.w3.org/2000/01/rdf-schema#>\n" +// + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" +// + "SELECT DISTINCT ?s1 ?s2 \n" +// + "WHERE {\n" +// + "?s2 rdf:type ns0:RootElement .\n" +// + "?s1 rdf:type ns1:MusicalWork .\n" +// + "?s2 ns2:tonalite ?o1 .\n" +// + "?s1 rdf:type ns3:Key .\n" +// + "?s1 ns4:label ?o1 .\n"//@ Jérôme : we have ?o2 instead of ?o1 +// + "FILTER(?s1 != ?s2)\n" +// + "}\n"; +// assertEquals(renderer.getQueryFromOnto2ToOnto1(cell1), expectedQuery); +// //Second test : with "and" property on entity +// expectedQuery = "SELECT QUERY 1 : PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +// + "PREFIX ns2:<http://exmo.inrialpes.fr/connectors-data#>\n" +// + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors-core#>\n" +// + "PREFIX ns3:<http://purl.org/NET/c4dm/keys.owl#>\n" +// + "PREFIX ns4:<http://www.w3.org/2000/01/rdf-schema#>\n" +// + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" +// + "SELECT DISTINCT ?s1 ?s2 \n" +// + "WHERE {\n" +// + "?s1 ns2:tonalite ?o .\n" +// + "?s2 rdf:type ns3:Key .\n" +// + "?s2 ns4:label ?o .\n"//@ Jérôme : we have ?o2 instead of ?o +// + "FILTER(?s1 != ?s2)\n" +// + "}\n"; +// assertEquals(renderer.getQueryFromOnto1ToOnto2(cell2), expectedQuery); +// expectedQuery = "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +// + "PREFIX ns2:<http://exmo.inrialpes.fr/connectors-data#>\n" +// + "PREFIX ns0:<http://exmo.inrialpes.fr/connectors-core#>\n" +// + "PREFIX ns3:<http://purl.org/NET/c4dm/keys.owl#>\n" +// + "PREFIX ns4:<http://www.w3.org/2000/01/rdf-schema#>\n" +// + "PREFIX ns1:<http://purl.org/ontology/mo/>\n" +// + "SELECT DISTINCT ?s1 ?s2 \n" +// + "WHERE {\n" +// + "?s2 ns2:tonalite ?o .\n" +// + "?s1 rdf:type ns3:Key .\n" +// + "?s1 ns4:label ?o .\n"//@ Jérôme : we have ?o2 instead of ?o +// + "FILTER(?s1 != ?s2)\n" +// + "}\n"; +// assertEquals(renderer.getQueryFromOnto2ToOnto1(cell2), expectedQuery); +// } + + @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryWithoutLinkkey"}) public void QueryFromSimpleLinkkeyAndIntersects() throws Exception { String alignmentFileName = "people_intersects_alignment.rdf"; EDOALAlignment alignment = Utils.loadAlignement(alignmentFileName); @@ -153,7 +239,7 @@ public class SPARQLSelectRendererVisitorTest { } } - @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryFromWithoutLinkkey", "QueryFromSimpleLinkkeyAndIntersects"}) + @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryWithoutLinkkey", "QueryFromSimpleLinkkeyAndIntersects"}) public void QueryFromSimpleLinkkeyAndEquals() throws Exception { String alignmentFileName = "people_equals_alignment.rdf"; EDOALAlignment alignment = Utils.loadAlignement(alignmentFileName); @@ -237,6 +323,7 @@ public class SPARQLSelectRendererVisitorTest { assertTrue(resultValues.contains(expected), "For expected : " + expected); } } + @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryFromSimpleLinkkeyAndIntersects"}) public void QueryFromRelationLinkkeyAndIntersects() throws Exception { String alignmentFileName = "people_relation_intersects_alignment.rdf"; @@ -414,7 +501,7 @@ public class SPARQLSelectRendererVisitorTest { // // } -// @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryFromWithoutLinkkey", "QueryFromSimpleLinkkeyFromEquals"}) +// @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryWithoutLinkkey", "QueryFromSimpleLinkkeyFromEquals"}) // public void QueryFromSimpleLinkkeyFromIntersectsAndRelation() throws Exception { // fail("HAVE TODO : with (in + eq) => OPTIONAL (with SERVICE call on remote) / many correspondances / With transformations / On local (FROM ...) or remote sparql endpoint (SERVICE) "); // } diff --git a/test/src/Utils.java b/test/src/Utils.java index 2c1e9f53..0115d08d 100644 --- a/test/src/Utils.java +++ b/test/src/Utils.java @@ -23,13 +23,11 @@ import fr.inrialpes.exmo.align.impl.edoal.EDOALAlignment; import fr.inrialpes.exmo.align.parser.AlignmentParser; import fr.inrialpes.exmo.align.parser.RDFParser; -import com.hp.hpl.jena.ontology.OntModelSpec; import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.DatasetFactory; import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.ModelFactory; import java.io.FileInputStream; import java.io.InputStream; -- GitLab