use of com.inova8.pathql.element.Iterations in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathIterationTests method test_4.
/**
* Test 4.
*/
@Test
@Order(4)
void test_4() {
try {
PathElement element = PathParser.parsePathPattern(repositoryContext, "((^:hasProductBatteryLimit/:hasUnit){1, 2}/:massThroughput){1,3}");
assertEquals("((^<http://default/hasProductBatteryLimit> / <http://default/hasUnit>){1,2} / <http://default/massThroughput>){1,3}", element.toString());
assertEquals("{0=3, 1=5, 2=6, 3=10, 4=9, 5=15}", element.getIterations().toString());
Iterations sortedIterations = element.getIterations().sortByPathLength();
assertEquals("{0=3, 1=5, 2=6, 4=9, 3=10, 5=15}", sortedIterations.toString());
assertEquals("(({1,1,1}/{1,1,1}){1,2,2}/{1,1,1}){1,1,3}", element.getPathShareString(1));
assertEquals("(({1,1,1}/{1,1,1}){1,1,2}/{1,1,1}){1,2,3}", element.getPathShareString(2));
assertEquals("(({1,1,1}/{1,1,1}){1,2,2}/{1,1,1}){1,2,3}", element.getPathShareString(3));
assertEquals("(({1,1,1}/{1,1,1}){1,1,2}/{1,1,1}){1,3,3}", element.getPathShareString(4));
assertEquals("(({1,1,1}/{1,1,1}){1,2,2}/{1,1,1}){1,3,3}", element.getPathShareString(5));
} catch (Exception e) {
assertEquals("", e.getMessage());
}
}
use of com.inova8.pathql.element.Iterations in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathIterationTests method test_5.
/**
* Test 5.
*/
@Test
@Order(5)
void test_5() {
try {
PathElement element = PathParser.parsePathPattern(repositoryContext, ":hasProductBatteryLimit{0, 4}/:massThroughput{1,2}");
assertEquals("<http://default/hasProductBatteryLimit>{0,4} / <http://default/massThroughput>{1,2}", element.toString());
assertEquals("{0=1, 1=2, 2=2, 3=3, 4=3, 5=4, 6=4, 7=5, 8=5, 9=6}", element.getIterations().toString());
Iterations sortedIterations = element.getIterations().sortByPathLength();
assertEquals("{0=1, 1=2, 2=2, 3=3, 4=3, 5=4, 6=4, 7=5, 8=5, 9=6}", sortedIterations.toString());
assertEquals("({0,0,4}/{1,2,2}){1,1,1}", element.getPathShareString(1));
assertEquals("({0,1,4}/{1,2,2}){1,1,1}", element.getPathShareString(3));
} catch (Exception e) {
assertEquals("", e.getMessage());
}
}
Aggregations