Search in sources :

Example 86 with RepositoryContext

use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.

the class QueryStringParserTests 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#");
}
Also used : RepositoryContext(com.inova8.pathql.context.RepositoryContext) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 87 with RepositoryContext

use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.

the class PathPatternSPARQLTests method setUpBeforeClass.

/**
 * Sets the up before class.
 *
 * @throws Exception the exception
 */
@BeforeAll
static void setUpBeforeClass() throws Exception {
    repositoryContext = new RepositoryContext();
    repositoryContext.getReifications().addReificationType(PathConstants.RDF_STATEMENT_IRI, PathConstants.RDF_SUBJECT_IRI, PathConstants.RDF_PREDICATE_IRI, PathConstants.RDF_OBJECT_IRI, null, null, null);
    repositoryContext.getReifications().addReificationType(iri("http://default/Attribute"), PathConstants.RDF_SUBJECT_IRI, PathConstants.RDF_PREDICATE_IRI, PathConstants.RDF_OBJECT_IRI, PathConstants.RDF_ISSUBJECTOF_IRI, PathConstants.RDF_ISPREDICATEOF_IRI, PathConstants.RDF_ISOBJECTOF_IRI);
    repositoryContext.getReifications().addReificationType(iri("http://default/Location"), PathConstants.RDF_SUBJECT_IRI, PathConstants.RDF_PREDICATE_IRI, PathConstants.RDF_OBJECT_IRI, null, null, null);
    repositoryContext.getReifications().setReificationsAreLazyLoaded(true);
    repositoryContext.prefix("http://default/").prefix("local", "http://local/").prefix("rdfs", "http://rdfs/").prefix("id", "http://id/").prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
}
Also used : RepositoryContext(com.inova8.pathql.context.RepositoryContext) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 88 with RepositoryContext

use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.

the class PathPatternTests method test_24.

/**
 * Test 24.
 */
@Test
@Order(24)
void test_24() {
    try {
        PathElement element = PathParser.parsePathPattern(repositoryContext, "^:hasProductBatteryLimit/(:massFlow |:volumeFlow  |:density)");
        assertEquals("^<http://default/hasProductBatteryLimit> / ((<http://default/massFlow> | <http://default/volumeFlow>) | <http://default/density>)", element.toString());
    } catch (Exception e) {
        assertEquals("", e.getMessage());
    }
}
Also used : PathElement(com.inova8.pathql.element.PathElement) RecognitionException(org.antlr.v4.runtime.RecognitionException) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 89 with RepositoryContext

use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.

the class PathPatternTests method test_30.

/**
 * Test 30.
 */
@Test
@Order(30)
void test_30() {
    try {
        PathElement element = PathParser.parsePathPattern(repositoryContext, "^:measurementOf[:hasOrdinal  %1]/:hasBMI");
        // Query.assertEqualsWOSpaces
        assertEquals("^<http://default/measurementOf>[<http://default/hasOrdinal> %1 ] / <http://default/hasBMI>", element.toString());
    } catch (Exception e) {
        assertEquals("", e.getMessage());
    }
}
Also used : PathElement(com.inova8.pathql.element.PathElement) RecognitionException(org.antlr.v4.runtime.RecognitionException) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Order(org.junit.jupiter.api.Order) Test(org.junit.jupiter.api.Test)

Example 90 with RepositoryContext

use of com.inova8.pathql.context.RepositoryContext in project com.inova8.intelligentgraph by peterjohnlawrence.

the class PathPatternTests 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#");
}
Also used : RepositoryContext(com.inova8.pathql.context.RepositoryContext) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

PathElement (com.inova8.pathql.element.PathElement)116 Order (org.junit.jupiter.api.Order)110 Test (org.junit.jupiter.api.Test)110 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)110 RecognitionException (org.antlr.v4.runtime.RecognitionException)78 PathPatternException (com.inova8.pathql.processor.PathPatternException)26 PathTupleExpr (com.inova8.intelligentgraph.path.PathTupleExpr)10 PathPatternVisitor (com.inova8.pathql.processor.PathPatternVisitor)8 RepositoryContext (com.inova8.pathql.context.RepositoryContext)7 Iterations (com.inova8.pathql.element.Iterations)7 PathPatternLexer (com.inova8.pathql.pathPattern.PathPatternLexer)7 PathPatternParser (com.inova8.pathql.pathPattern.PathPatternParser)7 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)7 BeforeAll (org.junit.jupiter.api.BeforeAll)7 PathBinding (com.inova8.intelligentgraph.path.PathBinding)5 PathPatternContext (com.inova8.pathql.pathPattern.PathPatternParser.PathPatternContext)4 CharStream (org.antlr.v4.runtime.CharStream)4 PathErrorListener (com.inova8.pathql.processor.PathErrorListener)2 IriRefValueElement (com.inova8.pathql.element.IriRefValueElement)1 PredicateElement (com.inova8.pathql.element.PredicateElement)1