Search in sources :

Example 31 with PathPatternException

use of com.inova8.pathql.processor.PathPatternException in project com.inova8.intelligentgraph by peterjohnlawrence.

the class PathPatternSPARQLTests 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");
    assertEquals("?n1 <http://default/hasProductBatteryLimit> ?n0 .\r\n" + "?n1 <http://default/massThroughput> ?n2 .\r\n" + "", ((PathElement) element).toSPARQL());
}
Also used : PathElement(com.inova8.pathql.element.PathElement) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 32 with PathPatternException

use of com.inova8.pathql.processor.PathPatternException in project com.inova8.intelligentgraph by peterjohnlawrence.

the class PathPatternSPARQLTests method test_9.

/**
 * Test 9.
 *
 * @throws RecognitionException the recognition exception
 * @throws PathPatternException the path pattern exception
 */
@Test
@Order(9)
void test_9() throws RecognitionException, PathPatternException {
    PathElement element = PathParser.parsePathPattern(repositoryContext, ":Location@:appearsOn#[:location.Map  id:Calc2Graph2 ]/:long");
    assertEquals("?r1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?n0\r\n" + "?r1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://default/appearsOn>\r\n" + "?r1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?n1\r\n" + "?r1 <http://default/location.Map> <http://id/Calc2Graph2> .\r\n" + "?r1 <http://default/long> ?n2 .\r\n" + "", element.toSPARQL());
}
Also used : PathElement(com.inova8.pathql.element.PathElement) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 33 with PathPatternException

use of com.inova8.pathql.processor.PathPatternException in project com.inova8.intelligentgraph by peterjohnlawrence.

the class PathPatternSPARQLTests 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, "<http://local#volumeFlow>");
    assertEquals("?n0 <http://local#volumeFlow> ?n1 .\r\n" + "", element.toSPARQL());
}
Also used : PathElement(com.inova8.pathql.element.PathElement) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 34 with PathPatternException

use of com.inova8.pathql.processor.PathPatternException in project com.inova8.intelligentgraph by peterjohnlawrence.

the class PathPatternSPARQLTests method test_0.

/**
 * Test 0.
 *
 * @throws RecognitionException the recognition exception
 * @throws PathPatternException the path pattern exception
 */
@Test
@Order(0)
void test_0() throws RecognitionException, PathPatternException {
    PathElement element = PathParser.parsePathPattern(repositoryContext, ":parent1[:gender :female]/:parent2[:gender :male; :birthplace [rdfs:label 'Maidstone']]/:parent3");
    assertEquals("?n0 <http://default/parent1> ?n1 .\r\n" + "?n1 <http://default/gender> <http://default/female> .\r\n" + "?n1 <http://default/parent2> ?n2 .\r\n" + "?n2 <http://default/gender> <http://default/male> .\r\n" + "?n2 <http://default/birthplace> ?n2_1 .\r\n" + "?n2_1 <http://rdfs/label> 'Maidstone' .\r\n" + "?n2 <http://default/parent3> ?n3 .\r\n" + "", element.toSPARQL());
}
Also used : PathElement(com.inova8.pathql.element.PathElement) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 35 with PathPatternException

use of com.inova8.pathql.processor.PathPatternException in project com.inova8.intelligentgraph by peterjohnlawrence.

the class PathPatternSPARQLTests method test_8.

/**
 * Test 8.
 *
 * @throws RecognitionException the recognition exception
 * @throws PathPatternException the path pattern exception
 */
@Test
@Order(8)
void test_8() throws RecognitionException, PathPatternException {
    PathElement element = PathParser.parsePathPattern(repositoryContext, ":Location@:appearsOn[ rdfs:label \"eastman3d\" ]#[a :Location ]/:lat");
    assertEquals("?r1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?n0\r\n" + "?r1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://default/appearsOn>\r\n" + "?r1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?n1\r\n" + "?n1 <http://rdfs/label> 'eastman3d' .\r\n" + "?r1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://default/Location> .\r\n" + "?r1 <http://default/lat> ?n2 .\r\n" + "", element.toSPARQL());
}
Also used : PathElement(com.inova8.pathql.element.PathElement) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Aggregations

PathElement (com.inova8.pathql.element.PathElement)25 Order (org.junit.jupiter.api.Order)17 Test (org.junit.jupiter.api.Test)17 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)17 Thing (com.inova8.intelligentgraph.model.Thing)15 Graph (com.inova8.intelligentgraph.intelligentGraphRepository.Graph)9 IntelligentGraphRepository (com.inova8.intelligentgraph.intelligentGraphRepository.IntelligentGraphRepository)6 PathBinding (com.inova8.intelligentgraph.path.PathBinding)5 PredicateElement (com.inova8.pathql.element.PredicateElement)4 PathPatternLexer (com.inova8.pathql.pathPattern.PathPatternLexer)3 PathPatternParser (com.inova8.pathql.pathPattern.PathPatternParser)3 PathPatternVisitor (com.inova8.pathql.processor.PathPatternVisitor)3 CharStream (org.antlr.v4.runtime.CharStream)3 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)3 IRI (org.eclipse.rdf4j.model.IRI)3 ReificationType (com.inova8.pathql.context.ReificationType)2 PathPatternException (com.inova8.pathql.processor.PathPatternException)2 IriRefValueElement (com.inova8.pathql.element.IriRefValueElement)1 IriRefContext (com.inova8.pathql.pathPattern.PathPatternParser.IriRefContext)1 PathEltOrInverseContext (com.inova8.pathql.pathPattern.PathPatternParser.PathEltOrInverseContext)1