@@ -114,7 +114,6 @@ public void cleanDatabase() {
114114
115115 @ Test
116116 public void testGetNodeById () throws Exception {
117- // Given
118117 try (Transaction tx = graphDatabaseService .beginTx ()) {
119118
120119 String ontoCreation = "MERGE (p:Category {catName: ' Person'})\n " +
@@ -213,7 +212,6 @@ public void testGetNodeById() throws Exception {
213212
214213 @ Test
215214 public void testGetNodeByIdFromRDFizedLPG () throws Exception {
216- // Given
217215 try (Transaction tx = graphDatabaseService .beginTx ()) {
218216
219217 String configCreation = "CALL n10s.graphconfig.init({handleVocabUris:'IGNORE'}) " ;
@@ -281,7 +279,6 @@ public void testGetNodeByIdFromRDFizedLPG() throws Exception {
281279
282280 @ Test
283281 public void testCypherCgnt () throws Exception {
284- // Given
285282
286283 try (Transaction tx = graphDatabaseService .beginTx ()) {
287284 tx .execute ("UNWIND RANGE(1,5,1) as id\n " +
@@ -298,8 +295,18 @@ public void testCypherCgnt() throws Exception {
298295 tx .commit ();
299296 }
300297
298+ String cableid ;
299+ String crpid ;
300+ try (Transaction tx = graphDatabaseService .beginTx ()) {
301+ Result result = tx .execute ("match (c:Cable{ id: 4 })--(crp:CableRoutingPoint{id: 2 }) " +
302+ " return id(c) as cableid, id(crp) as crpid " );
303+ Map <String , Object > record = result .next ();
304+ cableid = record .get ("cableid" ).toString ();
305+ crpid = record .get ("crpid" ).toString ();
306+ }
307+
301308 Map <String , Object > map = new HashMap <>();
302- map .put ("cypher" , "MATCH s = ()--() RETURN s" );
309+ map .put ("cypher" , "MATCH s = (:Cable{id: 4 } )--(:CableRoutingPoint{id: 2 } ) RETURN s" );
303310 map .put ("format" , "Turtle-star" );
304311
305312 Response response = HTTP .withHeaders ("Accept" , "text/plain" ).POST (
@@ -308,136 +315,21 @@ public void testCypherCgnt() throws Exception {
308315 String expected = "@prefix n4sch: <neo4j://graph.schema#> .\n " +
309316 "@prefix n4ind: <neo4j://graph.individuals#> .\n " +
310317 "\n " +
311- "n4ind:3 a n4sch:CableRoutingPoint;\n " +
312- " n4sch:id \" 2\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
313- " n4sch:inspectionDates \" 2019-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>,\n " +
314- " \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>, \" 2020-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
315- " n4sch:typeCodes \" C\" , \" B\" , \" A\" ;\n " +
316- " n4sch:location \" Point(-0.1275 51.507222222)\" ^^<http://www.opengis.net/ont/geosparql#wktLiteral> .\n " +
317- "\n " +
318- "n4ind:0 a n4sch:Cable;\n " +
319- " n4sch:id \" 1\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
320- " n4sch:HAS_ROUTING_POINT n4ind:3, n4ind:1;\n " +
321- " n4sch:createdAt \" 2017-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
322- " n4sch:name \" cable_1\" .\n " +
323- "\n " +
324- "<<n4ind:0 n4sch:HAS_ROUTING_POINT n4ind:3>> n4sch:createdAt \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
325- " n4sch:labels \" bar\" , \" foo\" .\n " +
326- "\n " +
327- "n4ind:1 a n4sch:CableRoutingPoint;\n " +
328- " n4sch:id \" 1\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
329- " n4sch:inspectionDates \" 2019-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>,\n " +
330- " \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>, \" 2020-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
331- " n4sch:location \" Point(-0.1275 51.507222222)\" ^^<http://www.opengis.net/ont/geosparql#wktLiteral>;\n " +
332- " n4sch:typeCodes \" A\" , \" B\" , \" C\" .\n " +
333- "\n " +
334- "<<n4ind:0 n4sch:HAS_ROUTING_POINT n4ind:1>> n4sch:labels \" bar\" , \" foo\" ;\n " +
335- " n4sch:createdAt \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime> .\n " +
336- "\n " +
337- "<<n4ind:2 n4sch:HAS_ROUTING_POINT n4ind:6>> n4sch:labels \" foo\" , \" bar\" ;\n " +
338- " n4sch:createdAt \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime> .\n " +
339- "\n " +
340- "n4ind:6 a n4sch:CableRoutingPoint;\n " +
341- " n4sch:inspectionDates \" 2019-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>,\n " +
342- " \" 2020-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>, \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
343- " n4sch:location \" Point(-0.1275 51.507222222)\" ^^<http://www.opengis.net/ont/geosparql#wktLiteral>;\n " +
344- " n4sch:typeCodes \" B\" , \" A\" , \" C\" ;\n " +
345- " n4sch:id \" 2\" ^^<http://www.w3.org/2001/XMLSchema#long> .\n " +
346- "\n " +
347- "n4ind:2 a n4sch:Cable;\n " +
348- " n4sch:id \" 2\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
349- " n4sch:createdAt \" 2017-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
350- " n4sch:HAS_ROUTING_POINT n4ind:6, n4ind:4;\n " +
351- " n4sch:name \" cable_2\" .\n " +
352- "\n " +
353- "n4ind:4 a n4sch:CableRoutingPoint;\n " +
354- " n4sch:inspectionDates \" 2019-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>,\n " +
355- " \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>, \" 2020-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
356- " n4sch:id \" 1\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
357- " n4sch:typeCodes \" C\" , \" A\" , \" B\" ;\n " +
358- " n4sch:location \" Point(-0.1275 51.507222222)\" ^^<http://www.opengis.net/ont/geosparql#wktLiteral> .\n " +
359- "\n " +
360- "<<n4ind:2 n4sch:HAS_ROUTING_POINT n4ind:4>> n4sch:labels \" bar\" , \" foo\" ;\n " +
361- " n4sch:createdAt \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime> .\n " +
362- "\n " +
363- "n4ind:7 a n4sch:CableRoutingPoint;\n " +
364- " n4sch:inspectionDates \" 2019-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>,\n " +
365- " \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>, \" 2020-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
366- " n4sch:typeCodes \" A\" , \" C\" , \" B\" ;\n " +
367- " n4sch:location \" Point(-0.1275 51.507222222)\" ^^<http://www.opengis.net/ont/geosparql#wktLiteral>;\n " +
368- " n4sch:id \" 1\" ^^<http://www.w3.org/2001/XMLSchema#long> .\n " +
369- "\n " +
370- "<<n4ind:5 n4sch:HAS_ROUTING_POINT n4ind:7>> n4sch:labels \" foo\" , \" bar\" ;\n " +
371- " n4sch:createdAt \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime> .\n " +
372- "\n " +
373- "n4ind:5 a n4sch:Cable;\n " +
374- " n4sch:createdAt \" 2017-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
375- " n4sch:HAS_ROUTING_POINT n4ind:7, n4ind:9;\n " +
376- " n4sch:id \" 3\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
377- " n4sch:name \" cable_3\" .\n " +
378- "\n " +
379- "<<n4ind:5 n4sch:HAS_ROUTING_POINT n4ind:9>> n4sch:labels \" foo\" , \" bar\" ;\n " +
380- " n4sch:createdAt \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime> .\n " +
381- "\n " +
382- "n4ind:9 a n4sch:CableRoutingPoint;\n " +
383- " n4sch:inspectionDates \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>,\n " +
384- " \" 2019-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>, \" 2020-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
385- " n4sch:id \" 2\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
386- " n4sch:typeCodes \" A\" , \" B\" , \" C\" ;\n " +
387- " n4sch:location \" Point(-0.1275 51.507222222)\" ^^<http://www.opengis.net/ont/geosparql#wktLiteral> .\n " +
388- "\n " +
389- "n4ind:8 a n4sch:Cable;\n " +
318+ "n4ind:" + cableid + " a n4sch:Cable;\n " +
390319 " n4sch:name \" cable_4\" ;\n " +
391320 " n4sch:createdAt \" 2017-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
392321 " n4sch:id \" 4\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
393- " n4sch:HAS_ROUTING_POINT n4ind:12, n4ind:10 .\n " +
322+ " n4sch:HAS_ROUTING_POINT n4ind:" + crpid + " .\n " +
394323 "\n " +
395- "n4ind:12 a n4sch:CableRoutingPoint;\n " +
324+ "n4ind:" + crpid + " a n4sch:CableRoutingPoint;\n " +
396325 " n4sch:inspectionDates \" 2019-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>,\n " +
397326 " \" 2020-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>, \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
398327 " n4sch:id \" 2\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
399328 " n4sch:typeCodes \" A\" , \" B\" , \" C\" ;\n " +
400329 " n4sch:location \" Point(-0.1275 51.507222222)\" ^^<http://www.opengis.net/ont/geosparql#wktLiteral> .\n " +
401- "\n " +
402- "<<n4ind:8 n4sch:HAS_ROUTING_POINT n4ind:12>> n4sch:labels \" bar\" , \" foo\" ;\n " +
403- " n4sch:createdAt \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime> .\n " +
404- "\n " +
405- "n4ind:10 a n4sch:CableRoutingPoint;\n " +
406- " n4sch:inspectionDates \" 2019-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>,\n " +
407- " \" 2020-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>, \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
408- " n4sch:id \" 1\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
409- " n4sch:typeCodes \" A\" , \" C\" , \" B\" ;\n " +
410- " n4sch:location \" Point(-0.1275 51.507222222)\" ^^<http://www.opengis.net/ont/geosparql#wktLiteral> .\n " +
411- "\n " +
412- "<<n4ind:8 n4sch:HAS_ROUTING_POINT n4ind:10>> n4sch:labels \" bar\" , \" foo\" ;\n " +
413- " n4sch:createdAt \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime> .\n " +
414- "\n " +
415- "n4ind:13 a n4sch:CableRoutingPoint;\n " +
416- " n4sch:inspectionDates \" 2019-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>,\n " +
417- " \" 2020-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>, \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
418- " n4sch:id \" 1\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
419- " n4sch:typeCodes \" A\" , \" B\" , \" C\" ;\n " +
420- " n4sch:location \" Point(-0.1275 51.507222222)\" ^^<http://www.opengis.net/ont/geosparql#wktLiteral> .\n " +
421- "\n " +
422- "n4ind:11 a n4sch:Cable;\n " +
423- " n4sch:id \" 5\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
424- " n4sch:HAS_ROUTING_POINT n4ind:13, n4ind:14;\n " +
425- " n4sch:name \" cable_5\" ;\n " +
426- " n4sch:createdAt \" 2017-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime> .\n " +
427- "\n " +
428- "<<n4ind:11 n4sch:HAS_ROUTING_POINT n4ind:13>> n4sch:labels \" foo\" , \" bar\" ;\n " +
429- " n4sch:createdAt \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime> .\n " +
430- "\n " +
431- "n4ind:14 a n4sch:CableRoutingPoint;\n " +
432- " n4sch:inspectionDates \" 2019-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>,\n " +
433- " \" 2020-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>, \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime>;\n " +
434- " n4sch:id \" 2\" ^^<http://www.w3.org/2001/XMLSchema#long>;\n " +
435- " n4sch:typeCodes \" C\" , \" B\" , \" A\" ;\n " +
436- " n4sch:location \" Point(-0.1275 51.507222222)\" ^^<http://www.opengis.net/ont/geosparql#wktLiteral> .\n " +
437- "\n " +
438- "<<n4ind:11 n4sch:HAS_ROUTING_POINT n4ind:14>> n4sch:labels \" foo\" , \" bar\" ;\n " +
330+ "<<n4ind:" + cableid + " n4sch:HAS_ROUTING_POINT n4ind:" + crpid + ">> n4sch:labels \" bar\" , \" foo\" ;\n " +
439331 " n4sch:createdAt \" 2018-04-05T12:34:00+02:00\" ^^<http://www.w3.org/2001/XMLSchema#dateTime> .\n " +
440- "\n " ;
332+ "\n " ;
441333
442334 assertEquals (200 , response .status ());
443335 assertTrue (ModelTestUtils
@@ -447,7 +339,6 @@ public void testCypherCgnt() throws Exception {
447339
448340 @ Test
449341 public void testCypherReturnsList () throws Exception {
450- // Given
451342
452343 try (Transaction tx = graphDatabaseService .beginTx ()) {
453344 tx .execute ("call n10s.nsprefixes.add('sch','http://schema.org/')" );
@@ -503,7 +394,6 @@ public void testCypherReturnsList() throws Exception {
503394
504395 @ Test
505396 public void testPrefixwithHyphen () throws Exception {
506- // Given
507397
508398 //first import onto
509399 try (Transaction tx = graphDatabaseService .beginTx ()) {
@@ -568,7 +458,6 @@ public void testPrefixwithHyphen() throws Exception {
568458
569459 @ Test
570460 public void testCypherOnMovieDBReturnsList () throws Exception {
571- // Given
572461
573462 try (Transaction tx = graphDatabaseService .beginTx ()) {
574463 tx .execute ("call n10s.nsprefixes.add('sch','http://schema.org/')" );
@@ -640,7 +529,6 @@ public void testCypherOnMovieDBReturnsList() throws Exception {
640529
641530 @ Test
642531 public void testCypherReturnsListOnRDFGraph () throws Exception {
643- // Given
644532 try (Transaction tx = graphDatabaseService .beginTx ()) {
645533 tx .execute (UNIQUENESS_CONSTRAINT_STATEMENT );
646534 tx .commit ();
@@ -678,7 +566,6 @@ public void testCypherReturnsListOnRDFGraph() throws Exception {
678566
679567 @ Test
680568 public void testGetNodeByIdRDFStar () throws Exception {
681- // Given
682569 try (Transaction tx = graphDatabaseService .beginTx ()) {
683570
684571 String dataInsertion = "CREATE (Keanu:Actor {name:'Keanu Reeves', born:1964})\n " +
@@ -731,7 +618,6 @@ public void testGetNodeByIdRDFStar() throws Exception {
731618
732619 @ Test
733620 public void ImportGetNodeById () throws Exception {
734- // Given
735621
736622 try (Transaction tx = graphDatabaseService .beginTx ()) {
737623 String ontoCreation = "MERGE (p:Category {catName: ' Person'})\n " +
@@ -794,7 +680,6 @@ public void ImportGetNodeById() throws Exception {
794680
795681 @ Test
796682 public void ImportGetNodeByIdOnImportedOnto () throws Exception {
797- // Given
798683
799684 //first import onto
800685 try (Transaction tx = graphDatabaseService .beginTx ()) {
@@ -843,7 +728,6 @@ public void ImportGetNodeByIdOnImportedOnto() throws Exception {
843728
844729 @ Test
845730 public void ImportGetNodeByUriOnImportedOntoShorten () throws Exception {
846- // Given
847731
848732 //first import onto
849733 try (Transaction tx = graphDatabaseService .beginTx ()) {
@@ -907,7 +791,6 @@ public void ImportGetNodeByUriOnImportedOntoShorten() throws Exception {
907791
908792 @ Test
909793 public void ImportGetNodeByUriOnImportedOntoIgnore () throws Exception {
910- // Given
911794
912795 //first import onto
913796 try (Transaction tx = graphDatabaseService .beginTx ()) {
@@ -1218,7 +1101,6 @@ public void testGetNodeByUriOrIdNotFoundOrInvalid() throws Exception {
12181101
12191102 @ Test
12201103 public void testPing () throws Exception {
1221- // Given
12221104 HTTP .Response response = HTTP .GET (
12231105 HTTP .GET (neo4j .httpURI ().resolve ("rdf" ).toString ()).location () + "ping" );
12241106
@@ -2603,7 +2485,6 @@ public void testNodeByUriWithGraphUriOnQuadRDFNQuads() throws Exception {
26032485
26042486 @ Test
26052487 public void testCypherOnQuadRDFAfterDeleteRDFBNodes () throws Exception {
2606- // Given
26072488 try (Transaction tx = graphDatabaseService .beginTx ()) {
26082489 tx .execute ("CREATE INDEX uri_index FOR (r:Resource) ON (r.uri)" );
26092490 tx .commit ();
@@ -2652,7 +2533,6 @@ public void testCypherOnQuadRDFAfterDeleteRDFBNodes() throws Exception {
26522533
26532534 @ Test
26542535 public void testTicket13061 () throws Exception {
2655- // Given
26562536 //create constraint
26572537 try (Transaction tx = graphDatabaseService .beginTx ()) {
26582538 tx .execute (UNIQUENESS_CONSTRAINT_STATEMENT );
0 commit comments