diff --git a/test/src/SPARQLConstructVisitorTest.java b/test/src/SPARQLConstructVisitorTest.java index 18f5bb83bd7f5ed558843cf3a1b4303f438db284..8666b6c234a9ecbdec5950f56b8c2ce916d3b52c 100644 --- a/test/src/SPARQLConstructVisitorTest.java +++ b/test/src/SPARQLConstructVisitorTest.java @@ -63,12 +63,14 @@ public class SPARQLConstructVisitorTest { public void ConstructSimplePropertiesRelation() throws Exception { // JE: This is absolutely non standard: // no init and alignment used without ontology declaration + // This only works because the relation is built manually EDOALAlignment alignment = new EDOALAlignment(); + Relation opusRelation = new EquivRelation(); Expression opusExpression1 = new PropertyId(new URI("http://exmo.inrialpes.fr/connectors#opus")); Expression opusExpression2 = new PropertyId(new URI("http://purl.org/ontology/mo/opus")); - EDOALCell opusCell = new EDOALCell("1", opusExpression1, opusExpression2, opusRelation, 1.0); - alignment.addAlignCell(opusCell); + alignment.addAlignCell( "1", opusExpression1, opusExpression2, opusRelation, 1.0 ); + EDOALCell opusCell = (EDOALCell)alignment.getElements().nextElement(); StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); @@ -100,13 +102,12 @@ public class SPARQLConstructVisitorTest { + "WHERE {\n" + "?s ns1:opus ?o .\n" + "}\n"; - EDOALAlignment inval = new EDOALAlignment(); - EDOALCell opusCell2 = opusCell.inverse(); - inval.addAlignCell(opusCell2); - renderer = new SPARQLConstructRendererVisitor(writer); + EDOALAlignment inval = alignment.inverse(); + EDOALCell opusCell2 = (EDOALCell)inval.getElements().nextElement(); + renderer = new SPARQLConstructRendererVisitor(writer); renderer.init(properties); inval.render(renderer); - assertEquals( renderer.getQuery(opusCell2), expectedQuery2 ); + assertEquals( renderer.getQuery( opusCell2 ), expectedQuery2 ); //With Named Graph String namedGraph = "http://exmo.inrialpes.fr/connectors/one-graph"; @@ -178,8 +179,6 @@ public class SPARQLConstructVisitorTest { // + "}\n" // + "}\n", remoteServiceURIName); // - // JE2015-Tosee - // assertEquals( renderer.getQuery(opusCell), expectedQuery2 ); // assertEquals(renderer.getQueryFromOnto1ToOnto2(opusCell, remoteServiceURI), expectedQuery1); // assertEquals(renderer.getQueryFromOnto2ToOnto1(opusCell, remoteServiceURI), expectedQuery2); } @@ -192,11 +191,12 @@ public class SPARQLConstructVisitorTest { @Test(groups = {"full", "impl", "raw"}) public void ConstructSimpleClassesRelation() throws Exception { EDOALAlignment alignment = new EDOALAlignment(); + Relation classesRelation = new EquivRelation(); Expression rootElementExpression = new ClassId(new URI("http://exmo.inrialpes.fr/connectors#RootElement")); Expression musicalWorkExpression = new ClassId(new URI("http://purl.org/ontology/mo/MusicalWork")); - EDOALCell classCell = new EDOALCell("1", rootElementExpression, musicalWorkExpression, classesRelation, 1.0); - alignment.addAlignCell(classCell); + alignment.addAlignCell( "1", rootElementExpression, musicalWorkExpression, classesRelation, 1.0 ); + EDOALCell classCell = (EDOALCell)alignment.getElements().nextElement(); StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); @@ -228,9 +228,8 @@ public class SPARQLConstructVisitorTest { + "WHERE {\n" + "?s rdf:type ns1:RootElement .\n" + "}\n"; - EDOALAlignment inval = new EDOALAlignment(); - EDOALCell classCell2 = classCell.inverse(); - inval.addAlignCell(classCell2); + EDOALAlignment inval = alignment.inverse(); + EDOALCell classCell2 = (EDOALCell)inval.getElements().nextElement(); renderer = new SPARQLConstructRendererVisitor(writer); renderer.init(properties); inval.render(renderer);