use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternQueryExpressionTests method test_27.
/**
* Test 27.
*/
@Test
@Order(27)
void test_27() {
try {
/**
************************************************Negation not yet supported
*/
PathElement element = PathParser.parsePathPattern(repositoryContext, "(* | !^:hasProductBatteryLimit)/(* | !(:massFlow |:volumeFlow |:density))");
// Query.assertEqualsWOSpaces
assertEquals("Join\r\n" + " Union\r\n" + " StatementPattern\r\n" + " Variable (name=n0)\r\n" + " Variable (name=p_n0_n1_alt_L)\r\n" + " Variable (name=n1)\r\n" + " Filter\r\n" + " Compare (!=)\r\n" + " Variable (name=p0_1)\r\n" + " Variable (name=p2, value=http://default/hasProductBatteryLimit)\r\n" + " StatementPattern\r\n" + " Variable (name=n1)\r\n" + " Variable (name=p0_1)\r\n" + " Variable (name=n0)\r\n" + " Union\r\n" + " StatementPattern\r\n" + " Variable (name=n1)\r\n" + " Variable (name=p_n1_n2_alt_L)\r\n" + " Variable (name=n2)\r\n" + " Union\r\n" + " Union\r\n" + " StatementPattern\r\n" + " Variable (name=n1)\r\n" + " Variable (name=p_n1_n2_alt_LRLL, value=http://default/massFlow)\r\n" + " Variable (name=n2)\r\n" + " StatementPattern\r\n" + " Variable (name=n1)\r\n" + " Variable (name=p_n1_n2_alt_LRLLR, value=http://default/volumeFlow)\r\n" + " Variable (name=n2)\r\n" + " StatementPattern\r\n" + " Variable (name=n1)\r\n" + " Variable (name=p_n1_n2_alt_LRLR, value=http://default/density)\r\n" + " Variable (name=n2)\r\n" + "", element.pathPatternQuery().toString());
} catch (Exception e) {
assertEquals("", e.getMessage());
}
}
use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternQueryExpressionTests method test_24.
/**
* Test 24.
*/
@Test
@Order(24)
void test_24() {
try {
PathElement element = PathParser.parsePathPattern(repositoryContext, "^:hasProductBatteryLimit/(:massFlow |:volumeFlow |:density)");
// Query.assertEqualsWOSpaces
assertEquals("Join\r\n" + " StatementPattern\r\n" + " Variable (name=n1)\r\n" + " Variable (name=p_n0_n1, value=http://default/hasProductBatteryLimit)\r\n" + " Variable (name=n0)\r\n" + " Union\r\n" + " Union\r\n" + " StatementPattern\r\n" + " Variable (name=n1)\r\n" + " Variable (name=p_n1_n2_alt_LL, value=http://default/massFlow)\r\n" + " Variable (name=n2)\r\n" + " StatementPattern\r\n" + " Variable (name=n1)\r\n" + " Variable (name=p_n1_n2_alt_LLR, value=http://default/volumeFlow)\r\n" + " Variable (name=n2)\r\n" + " StatementPattern\r\n" + " Variable (name=n1)\r\n" + " Variable (name=p_n1_n2_alt_LR, value=http://default/density)\r\n" + " Variable (name=n2)\r\n" + "", element.pathPatternQuery().toString());
} catch (Exception e) {
assertEquals("", e.getMessage());
}
}
use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternSPARQLTests method test_35.
/**
* Test 35.
*/
@Test
@Order(35)
void test_35() {
try {
PathElement element = PathParser.parsePathPattern(repositoryContext, ":hasProductBatteryLimit[a :BatteryLimit]");
assertEquals("?n0 <http://default/hasProductBatteryLimit> ?n1 .\r\n" + "?n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://default/BatteryLimit> .\r\n" + "", element.toSPARQL());
} catch (Exception e) {
assertEquals("", e.getMessage());
}
}
use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternPathTests method test_3.
/**
* Test 3.
*
* @throws RecognitionException the recognition exception
* @throws PathPatternException the path pattern exception
*/
@Test
@Order(3)
void test_3() throws RecognitionException, PathPatternException {
PathElement element = PathParser.parsePathPattern(repositoryContext, "^:hasProductBatteryLimit>:massThroughput");
PathBinding pathBinding = new PathBinding();
pathBinding = element.visitPathBinding(pathBinding, 0);
assertEquals("[n0,http://default/hasProductBatteryLimit,n1,INVERSE]\r\n" + "[n1,http://default/massThroughput,n2,DIRECT]\r\n" + "", pathBinding.toString());
}
use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternPathTests method test_1.
/**
* Test 1.
*
* @throws RecognitionException the recognition exception
* @throws PathPatternException the path pattern exception
*/
@Test
@Order(1)
void test_1() throws RecognitionException, PathPatternException {
PathElement element = PathParser.parsePathPattern(repositoryContext, ":parent1/:parent2/:parent3");
PathBinding pathBinding = new PathBinding();
pathBinding = element.visitPathBinding(pathBinding, 0);
assertEquals("[n0,http://default/parent1,n1,DIRECT]\r\n" + "[n1,http://default/parent2,n2,DIRECT]\r\n" + "[n2,http://default/parent3,n3,DIRECT]\r\n" + "", pathBinding.toString());
}
Aggregations