use of com.inova8.intelligentgraph.results.PathResults in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_TFL_GetPath_Tests method test_6.
/**
* Test 6.
*/
@Test
@Order(6)
void test_6() {
try {
Thing _this = source.getThing("londontube:Mornington_Crescent");
PathResults paths = _this.getPaths("(:onLine|:hasStationOnLine){1,4}/:hasStationOnLine[eq londontube:Oakleigh_Park]");
assertEquals("Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/onLine,http://in4mium.com/londontube/id/Northern,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Northern,http://in4mium.com/londontube/ref/hasStationOnLine,http://in4mium.com/londontube/id/Old_Street,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Old_Street,http://in4mium.com/londontube/ref/onLine,http://in4mium.com/londontube/id/Great_Northern,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Great_Northern,http://in4mium.com/londontube/ref/hasStationOnLine,http://in4mium.com/londontube/id/Oakleigh_Park,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/onLine,http://in4mium.com/londontube/id/Northern,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Northern,http://in4mium.com/londontube/ref/hasStationOnLine,http://in4mium.com/londontube/id/Moorgate,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Moorgate,http://in4mium.com/londontube/ref/onLine,http://in4mium.com/londontube/id/Great_Northern,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Great_Northern,http://in4mium.com/londontube/ref/hasStationOnLine,http://in4mium.com/londontube/id/Oakleigh_Park,DIRECT]\r\n" + "]\r\n" + "", paths.toString());
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
use of com.inova8.intelligentgraph.results.PathResults in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_TFL_GetPath_Tests method test_7.
/**
* Test 7.
*/
@Test
@Order(7)
void test_7() {
try {
Thing _this = source.getThing("londontube:Mornington_Crescent");
PathResults paths = _this.getPaths(":onLine/(:hasStationOnLine/:onLine){0,4}/:hasStationOnLine[eq londontube:Oakleigh_Park]");
for (Path path : paths) {
assertEquals("Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/onLine,http://in4mium.com/londontube/id/Northern,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Northern,http://in4mium.com/londontube/ref/hasStationOnLine,http://in4mium.com/londontube/id/Old_Street,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Old_Street,http://in4mium.com/londontube/ref/onLine,http://in4mium.com/londontube/id/Great_Northern,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Great_Northern,http://in4mium.com/londontube/ref/hasStationOnLine,http://in4mium.com/londontube/id/Oakleigh_Park,DIRECT]\r\n" + "]\r\n" + "", path.toString());
break;
}
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
use of com.inova8.intelligentgraph.results.PathResults in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_TFL_GetPath_Tests method test_2.
/**
* Test 2.
*/
@Test
@Order(2)
void test_2() {
try {
Thing _this = source.getThing("londontube:Mornington_Crescent");
PathResults paths = _this.getPaths(":connectsFrom|:connectsTo");
assertEquals("Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsFrom,http://in4mium.com/londontube/id/Camden_Town,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsFrom,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Camden_Town,DIRECT]\r\n" + "]\r\n" + "", paths.toString());
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
use of com.inova8.intelligentgraph.results.PathResults in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Local_TFL_GetPath_Tests method test_4.
/**
* Test 4.
*/
@Test
@Order(4)
void test_4() {
try {
Thing _this = source.getThing("londontube:Mornington_Crescent");
PathResults paths = _this.getPaths(":connectsTo{1,2}/:connectsTo[eq londontube:Kentish_Town]");
assertEquals("Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Camden_Town,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Camden_Town,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Kentish_Town,DIRECT]\r\n" + "]\r\n" + "Path=[[http://in4mium.com/londontube/id/Mornington_Crescent,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Euston,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Euston,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Camden_Town,DIRECT]\r\n" + "[http://in4mium.com/londontube/id/Camden_Town,http://in4mium.com/londontube/ref/connectsTo,http://in4mium.com/londontube/id/Kentish_Town,DIRECT]\r\n" + "]\r\n" + "", paths.toString());
} catch (Exception e) {
assertEquals("", e.getMessage());
e.printStackTrace();
}
}
use of com.inova8.intelligentgraph.results.PathResults in project com.inova8.intelligentgraph by peterjohnlawrence.
the class Thing method getPath.
/**
* Gets the path.
*
* @param predicatePattern the predicate pattern
* @return the path
*/
public Path getPath(String predicatePattern) {
logger.debug("getPath{}\n", predicatePattern);
PathResults pathValues = getPaths(predicatePattern, null);
if (pathValues == null) {
this.getEvaluationContext().getTracer().tracePathReturnNull(this, predicatePattern);
return new NullPath();
} else if (pathValues.hasNext()) {
Path path = (Path) pathValues.next();
this.getEvaluationContext().getTracer().tracePathReturn(this, predicatePattern, path);
return path;
} else {
this.getEvaluationContext().getTracer().tracePathEmpty(this, predicatePattern);
pathValues.close();
return new NullPath();
}
}
Aggregations