Package dev.roanh.gmark.lang.rpq
Interface RPQ
- All Superinterfaces:
OutputFormal
,OutputSQL
,OutputXML
,QueryFragment
,QueryLanguageSyntax
- All Known Implementing Classes:
ConcatRPQ
,DisjunctionRPQ
,EdgeRPQ
,KleeneRPQ
Interface for regular path queries (RPQs).
- See Also:
-
Field Summary
Fields inherited from interface dev.roanh.gmark.lang.QueryLanguageSyntax
CHAR_DISJUNCTION, CHAR_INTERSECTION, CHAR_INVERSE, CHAR_JOIN, CHAR_KLEENE
-
Method Summary
Modifier and TypeMethodDescriptionstatic RPQ
Returns an RPQ representing the concatenation in order of the given RPQs.static RPQ
Returns an RPQ representing the concatenation in order of the given RPQs.static RPQ
Returns an RPQ representing the disjunction of the given RPQs from left to right.static RPQ
Returns an RPQ representing the disjunction of the given RPQs from left to right.static RPQ
generatePlainRPQ
(int ruleApplications, int labels) Generates a random RPQ created by applying the disjunction, Kleene and concatenation steps from the RPQ grammar the given number of times.default QueryLanguage
Gets the concrete query language used to defined this query.static RPQ
Returns an RPQ representing the transitive closure of the given RPQ.static RPQ
Returns an RPQ representing a single labelled edge traversal.static RPQ
Returns an RPQ representing a chain of labelled edge traversals.static RPQ
Returns an RPQ representing a chain of labelled edge traversals.static RPQ
Attempts to parse the given AST to an RPQ.static RPQ
Parses the given RPQ in string form to an RPQ instance.Methods inherited from interface dev.roanh.gmark.output.OutputFormal
toFormalSyntax
Methods inherited from interface dev.roanh.gmark.ast.QueryFragment
getOperationType, toAbstractSyntaxTree
-
Method Details
-
getQueryLanguage
Description copied from interface:QueryLanguageSyntax
Gets the concrete query language used to defined this query.- Specified by:
getQueryLanguage
in interfaceQueryLanguageSyntax
- Returns:
- The query language for this query.
-
kleene
Returns an RPQ representing the transitive closure of the given RPQ.- Parameters:
rpq
- The RPQ for the transitive closure.- Returns:
- The transitive closure of the given RPQ.
-
disjunct
Returns an RPQ representing the disjunction of the given RPQs from left to right. For example((q1 ∪ q2) ∪ q3)
.- Parameters:
rpqs
- The RPQs for the disjunction.- Returns:
- The disjunction of the given RPQs.
- Throws:
IllegalArgumentException
- When less than 2 RPQs are provided.
-
disjunct
Returns an RPQ representing the disjunction of the given RPQs from left to right. For example((q1 ∪ q2) ∪ q3)
. Note that the given list is not copied.- Parameters:
rpqs
- The RPQs for the disjunction.- Returns:
- The disjunction of the given RPQs.
- Throws:
IllegalArgumentException
- When less than 2 RPQs are provided.
-
concat
Returns an RPQ representing the concatenation in order of the given RPQs.- Parameters:
rpqs
- The RPQs to concatenate (in order).- Returns:
- The concatenation of the given RPQs.
- Throws:
IllegalArgumentException
- When the given list of RPQs is empty.
-
concat
Returns an RPQ representing the concatenation in order of the given RPQs. Note that the given list is not copied.- Parameters:
rpqs
- The RPQs to concatenate (in order).- Returns:
- The concatenation of the given RPQs.
- Throws:
IllegalArgumentException
- When the given list of RPQs is empty.
-
label
Returns an RPQ representing a single labelled edge traversal.- Parameters:
label
- The label of the traversed edge.- Returns:
- The label traversal RPQ.
-
labels
Returns an RPQ representing a chain of labelled edge traversals.- Parameters:
labels
- The labels of the traversed edges.- Returns:
- The label traversal RPQ.
-
labels
Returns an RPQ representing a chain of labelled edge traversals.- Parameters:
labels
- The labels of the traversed edges.- Returns:
- The label traversal RPQ.
-
generatePlainRPQ
Generates a random RPQ created by applying the disjunction, Kleene and concatenation steps from the RPQ grammar the given number of times. A set of labels of the given size is automatically generated together with corresponding inverse labels for each label. It is worth noting that concatenation will be generated at double the rate of the relatively more expensive Kleene and disjunction operations.- Parameters:
ruleApplications
- The number of times the disjunction, Kleene, and concatenation steps are allowed to be applied.labels
- The number of distinct labels to use (upper limit).- Returns:
- The randomly generated RPQ.
- Throws:
IllegalArgumentException
- When the given number of labels is 0 or less.- See Also:
-
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
Attempts to parse the given AST to an RPQ.- Parameters:
ast
- The AST to parse to a RPQ.- Returns:
- The RPQ represented by the given AST.
- Throws:
IllegalArgumentException
- When the given AST does not represent a valid RPQ.- See Also:
-