Package dev.roanh.gmark.lang.cpq
Class ParserCPQ
java.lang.Object
dev.roanh.gmark.lang.generic.GenericParser
dev.roanh.gmark.lang.cpq.ParserCPQ
Parser for CPQs (Conjunctive Path Queries).
- See Also:
-
Constructor Summary
-
Method Summary
Methods inherited from class dev.roanh.gmark.lang.generic.GenericParser
parsePredicate, split
-
Constructor Details
-
ParserCPQ
private ParserCPQ()Prevent instantiation.
-
-
Method Details
-
parse
Parses the given CPQ in string form to a CPQ instance. The input is assumed to use brackets where possible and to use the 'id
', ''\u25e6'', ''\u2229'' and ''\u207b'' symbols to denote operations. Example input:(0◦(((1◦0) ∩ (1◦1))◦1⁻))
.- Parameters:
query
- The CPQ to parse.- Returns:
- The parsed CPQ.
- Throws:
IllegalArgumentException
- When the given string is not a valid CPQ.- See Also:
-
parse
public static CPQ parse(String query, char join, char intersect, char inverse) throws IllegalArgumentException Parses the given CPQ in string form to a CPQ instance. Unlikeparse(String)
this subroutine allows custom symbols to be used to input the CPQ.- Parameters:
query
- The CPQ to parse.join
- The symbol to use for the join/concatenation operation.intersect
- The symbol to use for the intersection/conjunction operation.inverse
- The symbol to use for the inverse edge label operation.- Returns:
- The parsed CPQ.
- Throws:
IllegalArgumentException
- When the given string is not a valid CPQ.- See Also:
-
parse
public static CPQ parse(String query, Map<String, Predicate> labels, char join, char intersect, char inverse) throws IllegalArgumentExceptionParses the given CPQ in string form to a CPQ instance. Unlikeparse(String)
this subroutine allows custom symbols to be used to input the CPQ.- Parameters:
query
- The CPQ to parse.labels
- A map with predicates found so far.join
- The symbol to use for the join/concatenation operation.intersect
- The symbol to use for the intersection/conjunction operation.inverse
- The symbol to use for the inverse edge label operation.- Returns:
- The parsed CPQ.
- Throws:
IllegalArgumentException
- When the given string is not a valid CPQ.
-