Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 8d50525f authored by Nicolas Guillouet's avatar Nicolas Guillouet
Browse files

Changing datas for SPARQLSelectRendererVisitorTest

parent afc9b77e
No related branches found
No related tags found
No related merge requests found
......@@ -223,7 +223,7 @@ public class SPARQLSelectRendererVisitor extends GraphPatternRendererVisitor imp
resetS1("?o1");
Expression expr1 = linkkeyIntersects.getExpression1();
expr1.accept(this);
resetS2("?o2");
resetS2("?o1");
Expression expr2 = linkkeyIntersects.getExpression2();
expr2.accept(this);
}
......@@ -249,19 +249,14 @@ public class SPARQLSelectRendererVisitor extends GraphPatternRendererVisitor imp
expr2.accept(this);
listGP.add(getGP());
initStructure();
boolean hasLinkeys = false;
String filter = "FILTER(?s1 != ?s2)";
Set<Linkkey> linkkeys = ((EDOALCell) cell).linkkeys();
if (linkkeys != null) {
hasLinkeys = true;
for (Linkkey linkkey : linkkeys) {
linkkey.accept(this);
}
}
if (hasLinkeys) {
filter = "FILTER(?s1 != ?s2 && ?o2 = ?o1)";
listGP.add(getGP());
}
}
String query = createSelect(listGP, filter);
if (corese) {
throw new AlignmentException("corese case NOT IMPLEMENTED for SPARQLSelectRendererVisitor !!");
......
......@@ -73,8 +73,8 @@ Tests are on two main elements tested on datas for one property :
<exmo:nom>AliceC2</exmo:nom>
<exmo:nom>AliceC2_1</exmo:nom>
<exmo:nom>AliceC2_2</exmo:nom>
<exmo:connait>DaveC1_1</exmo:connait>
<exmo:connait>CarolC1_1</exmo:connait>
<!--<exmo:connait>DaveC1_1</exmo:connait>
<exmo:connait>CarolC1_1</exmo:connait>-->
<exmo:connait>Ivan2</exmo:connait>
<exmo:boitemel>alice1@gmail.com</exmo:boitemel>
<exmo:boitemel>alice1@msn.com</exmo:boitemel>
......
......@@ -33,8 +33,8 @@
<foaf:givenName>AliceC2</foaf:givenName>
<foaf:givenName>AliceC2_1</foaf:givenName>
<foaf:givenName>AliceC2_2_diff</foaf:givenName>
<foaf:knows rdf:resource="http://exmo.inrialpes.fr/connectors-data/people#dave_c1_2" />
<foaf:knows rdf:resource="http://exmo.inrialpes.fr/connectors-data/people#carol_c1_2" />
<!--<foaf:knows rdf:resource="http://exmo.inrialpes.fr/connectors-data/people#dave_c1_2" />
<foaf:knows rdf:resource="http://exmo.inrialpes.fr/connectors-data/people#carol_c1_2" />-->
<foaf:knows rdf:resource="http://exmo.inrialpes.fr/connectors-data/people#ivan_2" />
<foaf:mbox>alice2@gmail.com</foaf:mbox>
<foaf:mbox>alice2@msn.com</foaf:mbox>
......
......@@ -19,7 +19,7 @@
<owl:imports rdf:resource="http://xmlns.com/foaf/0.1/"/>
</owl:Ontology>
<!-- EQUALS for (nom, givenName) / Intersects for (connait, knows)-->
<!-- INTERSECTS + EQUALS for (nom, givenName) / Intersects for (connait, knows)-->
<rdf:Description rdf:about="http://exmo.inrialpes.fr/connectors-data/people#alice_c1_1">
<rdf:type rdf:resource="&exmo;Personne"/>
<exmo:nom>AliceC1</exmo:nom>
......@@ -31,7 +31,7 @@
<exmo:boitemel>alice1@msn.com</exmo:boitemel>
</rdf:Description>
<!-- INTERSECTS on AliceC2 for (nom, givenName) / Equals for (connait, knows)-->
<!-- INTERSECTS on AliceC2 for (nom, givenName) / Equals + INTERSECTS for (connait, knows)-->
<rdf:Description rdf:about="http://exmo.inrialpes.fr/connectors-data/people#alice_c2_1">
<rdf:type rdf:resource="&exmo;Personne"/>
<exmo:nom>AliceC2</exmo:nom>
......
......@@ -18,7 +18,7 @@
</owl:Ontology>
<!-- EQUALS for (nom, givenName) / Intersects for (connait, knows) -->
<!-- EQUALS + Intersects for (nom, givenName) / Intersects for (connait, knows) -->
<rdf:Description rdf:about="http://exmo.inrialpes.fr/connectors-data/people#alice_c1_2">
<rdf:type rdf:resource="&foaf;Person"/>
<foaf:givenName>AliceC1</foaf:givenName>
......@@ -30,7 +30,7 @@
<foaf:mbox>alice2@msn.com</foaf:mbox>
</rdf:Description>
<!-- INTERSECTS on AliceC2 for (nom, givenName) / Equals for (connait, knows)-->
<!-- INTERSECTS on AliceC2 for (nom, givenName) / Equals + Intersects for (connait, knows)-->
<rdf:Description rdf:about="http://exmo.inrialpes.fr/connectors-data/people#alice_c2_2">
<rdf:type rdf:resource="&foaf;Person"/>
<foaf:givenName>AliceC2</foaf:givenName>
......
......@@ -62,7 +62,7 @@ public class SPARQLSelectRendererVisitorTest {
}
@Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryFromWithoutLinkkey"})
public void QueryFromSimpleLinkkeyFromIntersects() throws Exception {
public void QueryFromSimpleLinkkeyAndIntersects() throws Exception {
String alignmentFileName = "people_intersects_alignment.rdf";
EDOALAlignment alignment = Utils.loadAlignement(alignmentFileName);
StringWriter stringWriter = new StringWriter();
......@@ -74,20 +74,21 @@ public class SPARQLSelectRendererVisitorTest {
assertEquals(alignment.nbCells(), 1);
Enumeration<Cell> cells = alignment.getElements();
Cell cell = cells.nextElement();
//Without any service
// PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
// PREFIX ns0:<http://exmo.inrialpes.fr/connectors-core/>
// PREFIX ns1:<http://xmlns.com/foaf/0.1/>
// SELECT DISTINCT ?s1 ?s2
// WHERE {
// ?s1 rdf:type ns0:Personne .
// ?s2 rdf:type ns1:Person .
// ?s1 ns0:nom ?o1 .
// ?s2 ns1:givenName ?o2 .
// FILTER(?s1 != ?s2 && ?o2 = ?o1)
// }
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://xmlns.com/foaf/0.1/>\n"
+ "SELECT DISTINCT ?s1 ?s2 \n"
+ "WHERE {\n"
+ "?s1 rdf:type ns0:Personne .\n"
+ "?s2 rdf:type ns1:Person .\n"
+ "?s1 ns0:nom ?o1 .\n"
+ "?s2 ns1:givenName ?o1 .\n"
+ "FILTER(?s1 != ?s2)\n"
+ "}\n";
String query = renderer.getQueryFromOnto1ToOnto2(cell);
// System.out.println("QUERY = " + query);
// System.out.println("QueryFromSimpleLinkkeyFromIntersects expectedQuery = " + expectedQuery);
// System.out.println("QueryFromSimpleLinkkeyFromIntersects QUERY = " + query);
assertEquals(expectedQuery, query);
Model values = Utils.loadValues(new String[]{"intersects_people_1.rdf", "intersects_people_2.rdf"});
Query selectQuery = QueryFactory.create(query);
......@@ -123,7 +124,7 @@ public class SPARQLSelectRendererVisitorTest {
assertEquals(resultValues.size(), expectedS2.length);
for (String expected : expectedS2) {
assertTrue(resultValues.contains(expected), "For expected : " + expected);
}
}
resultValues = allResultValues.get("s2");
assertEquals(resultValues.size(), expectedS1.length);
......@@ -131,9 +132,9 @@ public class SPARQLSelectRendererVisitorTest {
assertTrue(resultValues.contains(expected));
}
}
//
// @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryFromWithoutLinkkey", "QueryFromSimpleLinkkeyFromIntersects"})
// public void QueryFromSimpleLinkkeyFromEquals() throws Exception {
// @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryFromWithoutLinkkey", "QueryFromSimpleLinkkeyAndIntersects"})
// public void QueryFromSimpleLinkkeyAndEquals() throws Exception {
// String alignmentFileName = "people_equals_alignment.rdf";
// EDOALAlignment alignment = Utils.loadAlignement(alignmentFileName);
// StringWriter stringWriter = new StringWriter();
......@@ -146,7 +147,7 @@ public class SPARQLSelectRendererVisitorTest {
// assertEquals(alignment.nbCells(), 1);
// Enumeration<Cell> cells = alignment.getElements();
// Cell cell = cells.nextElement();
// //Without any service
//
// 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://xmlns.com/foaf/0.1/>\n"
......@@ -155,34 +156,26 @@ public class SPARQLSelectRendererVisitorTest {
// + "?s1 rdf:type ns0:Personne .\n"
// + "?s2 rdf:type ns1:Person .\n"
// + "?s1 ns0:nom ?o1 .\n"
// + "?s2 ns1:givenName ?o2 .\n"
// + "?s2 ns1:givenName ?o1 .\n"
// + "MINUS { \n"
// + "SELECT DISTINCT ?s1 ?s2 \n"
// + "WHERE \n"
// + "{ \n"
// + "?s1 ns0:nom ?o1 .\n"
// + "?s1 ns0:nom ?o2 .\n"
// + "?s2 ns1:givenName ?o3 .\n"
// + "FILTER(?s1 != ?s2 && ?o2 != ?o1 && ?o3 = ?o1 && NOT EXISTS {\n"
// + "?s2 ns1:givenName ?o1 .\n"
// + "FILTER(?s1 != ?s2 && ?o2 != ?o1 && NOT EXISTS {\n"
// + "?s2 ns1:givenName ?o2 .\n"
// + "}) \n"
// + "} \n"
// + "} \n"
// + "}\n"
// + "MINUS {\n"
// + "SELECT DISTINCT ?s1 ?s2 \n"
// + "WHERE \n"
// + "{ \n"
// + "?s1 ns0:nom ?o1 .\n"
// + "?s2 ns1:givenName ?o1 .\n"
// + "?s2 ns1:givenName ?o2 .\n"
// + "?s2 ns1:givenName ?o3 .\n"
// + "FILTER(?s1 != ?s2 && ?o2 != ?o3 && ?o2 = ?o1 && NOT EXISTS {\n"
// + "?s1 ns0:nom ?o3 .\n"
// + "FILTER(?s1 != ?s2 && ?o2 != ?o1 && NOT EXISTS {\n"
// + "?s1 ns0:nom ?o2 .\n"
// + "})\n"
// + "}\n"
// + "}\n"
// + "FILTER(?s1 != ?s2 && ?o2 = ?o1)\n"
// + "FILTER(?s1 != ?s2)\n"
// + "}\n";
// String query = renderer.getQueryFromOnto1ToOnto2(cell);//Where ?p1 is in onto1
// String query = renderer.getQueryFromOnto1ToOnto2(cell);
// System.out.println("QueryFromSimpleLinkkeyFromEquals expected Query : " + expectedQuery);
//// assertEquals(query, expectedQuery);
//
......@@ -224,7 +217,7 @@ public class SPARQLSelectRendererVisitorTest {
// }
// }
//
// @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {})//"QueryFromSimpleLinkkeyFromIntersects"
// @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryFromSimpleLinkkeyAndIntersects"})
// public void QueryFromRelationLinkkeyAndIntersects() throws Exception {
// String alignmentFileName = "people_relation_intersects_alignment.rdf";
// EDOALAlignment alignment = Utils.loadAlignement(alignmentFileName);
......@@ -252,12 +245,12 @@ public class SPARQLSelectRendererVisitorTest {
// + "?s1 ns0:connait ?o1 .\n"
// + "?s2 ns1:knows ?o2 .\n"
// + "?o2 rdf:type ns1:Person .\n"
// + "?o2 ns1:givenName ?o3 .\n"
// + "FILTER(?s1 != ?s2 && ?o3 = ?o1)\n"
// + "?o2 ns1:givenName ?o1 .\n"
// + "FILTER(?s1 != ?s2)\n"
// + "}";
// System.out.println("QueryFromRelationLinkkeyAndIntersects expectedQuery : " + expectedQuery);
// System.out.println("query : " + query);
//// assertEquals(expectedQuery, query);
// assertEquals(expectedQuery, query);
// Query selectQuery = QueryFactory.create(query);
// QueryExecution selectQueryExec = QueryExecutionFactory.create(selectQuery, values);
// ResultSet results = selectQueryExec.execSelect();
......@@ -300,7 +293,7 @@ public class SPARQLSelectRendererVisitorTest {
// }
// }
//
// @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryFromSimpleLinkkeyFromEquals"})
// @Test(groups = {"full", "impl", "raw"}, dependsOnMethods = {"QueryFromSimpleLinkkeyAndEquals"})
// public void QueryFromRelationLinkkeyAndEquals() throws Exception {
// //With Equals Linkkey => throw Exception, I already don't know to do it, could be performances innefficiente ...
// String alignmentFileName = "people_relation_equals_alignment.rdf";
......@@ -315,8 +308,44 @@ public class SPARQLSelectRendererVisitorTest {
// assertEquals(alignment.nbCells(), 1);
// Enumeration<Cell> cells = alignment.getElements();
// Cell cell = cells.nextElement();
// 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://xmlns.com/foaf/0.1/>\n"
// + "SELECT DISTINCT ?s1 ?s2\n"
// + "WHERE {\n"
// + "?s1 rdf:type ns0:Personne .\n"
// + "?s2 rdf:type ns1:Person .\n"
// + "?s1 ns0:connait ?o1 .\n"
// + "?s2 ns1:knows ?o2 .\n"
// + "?o2 rdf:type ns1:Person .\n"
// + "?o2 ns1:givenName ?o1 .\n"
// + "MINUS { \n"
// + "?s1 ns0:connait ?o1 .\n"
// + "?s1 ns0:connait ?o2 .\n"
// + "?s2 ns1:knows ?o3 .\n"
// + "?o3 ns1:givenName ?o1 .\n"
// + "FILTER(?s1 != ?s2 && ?o2 != ?o1 && NOT EXISTS {\n"
// + "?s2 ns1:knows ?o4 .\n"
// + "?o4 ns1:givenName ?o2 .\n"
// + "}) \n"
// + "}\n"
// + "MINUS {\n"
// + "?s1 ns0:connait ?o1 .\n"
// + "?s2 ns1:knows ?o2 .\n"
// + "?o2 ns1:givenName ?o1 .\n"
// + "?s2 ns1:knows ?o3 .\n"
// + "?o3 ns1:givenName ?o4 .\n"
// + "FILTER(?s1 != ?s2 && ?o1 != ?o4 && NOT EXISTS {\n"
// + "?s1 ns0:connait ?o4 .\n"
// + "})\n"
// + "}\n"
// + "FILTER(?s1 != ?s2)\n"
// + "}";
//
// String query = renderer.getQueryFromOnto1ToOnto2(cell);
//// System.out.println("QueryFromSimpleLinkkeyFromIntersects : " + query);
// System.out.println("QueryFromRelationLinkkeyAndEquals expectedQuery : " + expectedQuery);
//// System.out.println("QueryFromRelationLinkkeyAndEquals : " + query);
// assertEquals(query, expectedQuery);
// Model values = Utils.loadValues(new String[]{"equals_people_1.rdf", "equals_people_2.rdf"});
//
// Query selectQuery = QueryFactory.create(query);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment