use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathIterationTests method setUpBeforeClass.
/**
* Sets the up before class.
*
* @throws Exception the exception
*/
@BeforeAll
static void setUpBeforeClass() throws Exception {
repositoryContext = new RepositoryContext();
repositoryContext.prefix("http://default/").prefix("local", "http://local/").prefix("rdfs", "http://rdfs/").prefix("id", "http://id/").prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
}
use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternPathTests method test_4.
/**
* Test 4.
*
* @throws RecognitionException the recognition exception
* @throws PathPatternException the path pattern exception
*/
@Test
@Order(4)
void test_4() throws RecognitionException, PathPatternException {
PathElement element = PathParser.parsePathPattern(repositoryContext, ":Location@:appearsOn[ eq [ rdfs:label \"Calc2Graph1\"] ]#/^:lat/:long/^:left/:right");
PathBinding pathBinding = new PathBinding();
pathBinding = element.visitPathBinding(pathBinding, 0);
assertEquals("[n0,r1:<http://default/Location>@http://default/appearsOn,r1,DIRECT,true]\r\n" + "[r1,http://default/lat,n2,INVERSE]\r\n" + "[n2,http://default/long,n3,DIRECT]\r\n" + "[n3,http://default/left,n4,INVERSE]\r\n" + "[n4,http://default/right,n5,DIRECT]\r\n" + "", pathBinding.toString());
}
use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternPathTests method test_2.
/**
* Test 2.
*
* @throws RecognitionException the recognition exception
* @throws PathPatternException the path pattern exception
*/
@Test
@Order(2)
void test_2() throws RecognitionException, PathPatternException {
PathElement element = PathParser.parsePathPattern(repositoryContext, ":parent1[:gender :female]/^:child2[:gender :male; :birthplace [rdfs:label 'Maidstone']]/:parent3");
PathBinding pathBinding = new PathBinding();
pathBinding = element.visitPathBinding(pathBinding, 0);
assertEquals("[n0,http://default/parent1,n1,DIRECT]\r\n" + "[n1,http://default/child2,n2,INVERSE]\r\n" + "[n2,http://default/parent3,n3,DIRECT]\r\n" + "", pathBinding.toString());
}
use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.
the class PathPatternQueryExpressionTests method test_35.
/**
* Test 35.
*/
@Test
@Order(35)
void test_35() {
try {
PathElement element = PathParser.parsePathPattern(repositoryContext, ":hasProductBatteryLimit[a :BatteryLimit]");
// Query.assertEqualsWOSpaces
assertEquals("Join\r\n" + " StatementPattern\r\n" + " Variable (name=n0)\r\n" + " Variable (name=p_n0_n1, value=http://default/hasProductBatteryLimit)\r\n" + " Variable (name=n1)\r\n" + " StatementPattern\r\n" + " Variable (name=n1)\r\n" + " Variable (name=p_n1_n1_1, value=http://www.w3.org/1999/02/22-rdf-syntax-ns#type)\r\n" + " Variable (name=n1_1, value=http://default/BatteryLimit)\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_18.
/**
* Test 18.
*/
@Test
@Order(18)
void test_18() {
try {
PathElement element = PathParser.parsePathPattern(repositoryContext, "*");
// Query.assertEqualsWOSpaces
assertEquals("StatementPattern\r\n" + " Variable (name=n0)\r\n" + " Variable (name=p_n0_n1)\r\n" + " Variable (name=n1)\r\n" + "", element.pathPatternQuery().toString());
} catch (Exception e) {
assertEquals("", e.getMessage());
}
}
Aggregations