Search in sources :

Example 1 with PathEltOrInverseContext

use of com.inova8.pathql.pathPattern.PathPatternParser.PathEltOrInverseContext in project com.inova8.intelligentgraph by peterjohnlawrence.

the class PathParser method parsePredicate.

/**
 * Parses the predicate.
 *
 * @param repositoryContext the repository context
 * @param uriPattern the uri pattern
 * @return the predicate element
 * @throws RecognitionException the recognition exception
 * @throws PathPatternException the path pattern exception
 */
public static PredicateElement parsePredicate(RepositoryContext repositoryContext, String uriPattern) throws RecognitionException, PathPatternException {
    pathPatternVisitor = new PathPatternVisitor(repositoryContext);
    CharStream input = CharStreams.fromString(uriPattern);
    PathPatternLexer lexer = new PathPatternLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    PathPatternParser parser = new PathPatternParser(tokens);
    PathEltOrInverseContext pathPatternTree = parser.pathEltOrInverse();
    PathElement iriRefValueElement = pathPatternVisitor.visit(pathPatternTree);
    return (PredicateElement) iriRefValueElement;
}
Also used : PathPatternVisitor(com.inova8.pathql.processor.PathPatternVisitor) CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) PathElement(com.inova8.pathql.element.PathElement) PredicateElement(com.inova8.pathql.element.PredicateElement) PathPatternParser(com.inova8.pathql.pathPattern.PathPatternParser) PathPatternLexer(com.inova8.pathql.pathPattern.PathPatternLexer) PathEltOrInverseContext(com.inova8.pathql.pathPattern.PathPatternParser.PathEltOrInverseContext) CharStream(org.antlr.v4.runtime.CharStream)

Aggregations

PathElement (com.inova8.pathql.element.PathElement)1 PredicateElement (com.inova8.pathql.element.PredicateElement)1 PathPatternLexer (com.inova8.pathql.pathPattern.PathPatternLexer)1 PathPatternParser (com.inova8.pathql.pathPattern.PathPatternParser)1 PathEltOrInverseContext (com.inova8.pathql.pathPattern.PathPatternParser.PathEltOrInverseContext)1 PathPatternVisitor (com.inova8.pathql.processor.PathPatternVisitor)1 CharStream (org.antlr.v4.runtime.CharStream)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1