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