Package dev.roanh.gmark.lang.rpq
Class GeneratorRPQ
java.lang.Object
dev.roanh.gmark.lang.rpq.GeneratorRPQ
Simple generator for RPQs (Regular Path Queries).
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.static RPQ
generatePlainRPQ
(int ruleApplications, List<Predicate> labels) Generates a random RPQ created by applying the disjunction, Kleene and concatenation steps from the RPQ grammar the given number of times.private static RPQ
generatePlainRPQImpl
(int ruleApplications, List<Predicate> labels) Generates a random RPQ created by applying the disjunction, Kleene and concatenation steps from the RPQ grammar the given number of times.
-
Constructor Details
-
GeneratorRPQ
private GeneratorRPQ()Prevent instantiation.
-
-
Method Details
-
generatePlainRPQ
public static RPQ generatePlainRPQ(int ruleApplications, int labels) throws IllegalArgumentException 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:
-
generatePlainRPQ
public static RPQ generatePlainRPQ(int ruleApplications, List<Predicate> labels) throws IllegalArgumentException Generates a random RPQ created by applying the disjunction, Kleene and concatenation steps from the RPQ grammar the given number of times. Labels and inverse labels are drawn from the given set of labels. 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 set of labels to draw from.- Returns:
- The randomly generated RPQ.
- Throws:
IllegalArgumentException
- When the list of labels is empty.- See Also:
-
generatePlainRPQImpl
Generates a random RPQ created by applying the disjunction, Kleene and concatenation steps from the RPQ grammar the given number of times. Labels and inverse labels are drawn from the given set of labels. 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 set of labels to draw from.- Returns:
- The randomly generated RPQ.
-