Package dev.roanh.gmark.lang.cpq
Class GeneratorCPQ
java.lang.Object
dev.roanh.gmark.lang.cpq.GeneratorCPQ
Simple generator for CPQs (Conjunctive Path Queries).
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static CPQ
generatePlainCPQ
(int ruleApplications, boolean allowId, List<Predicate> labels) Generates a random CPQ created by applying the intersection (conjunction) and concatenation steps from the CPQ grammar the given number of times.static CPQ
generatePlainCPQ
(int ruleApplications, int labels) Generates a random CPQ created by applying the intersection (conjunction) and concatenation steps from the CPQ grammar the given number of times.static CPQ
generatePlainCPQ
(int ruleApplications, List<Predicate> labels) Generates a random CPQ created by applying the intersection (conjunction) and concatenation steps from the CPQ grammar the given number of times.
-
Constructor Details
-
GeneratorCPQ
private GeneratorCPQ()Prevent instantiation.
-
-
Method Details
-
generatePlainCPQ
public static CPQ generatePlainCPQ(int ruleApplications, int labels) throws IllegalArgumentException Generates a random CPQ created by applying the intersection (conjunction) and concatenation steps from the CPQ 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. Three relatively meaningless but technically valid patterns are intentionally never generated:- Concatenation with identity.
- Intersection of identity with identity.
- The query consisting of only identity and nothing else.
- Parameters:
ruleApplications
- The number of times the intersection and concatenation steps are allowed to be applied.labels
- The number of distinct labels to use (upper limit).- Returns:
- The randomly generated CPQ.
- Throws:
IllegalArgumentException
- When the given number of labels is 0 or less.- See Also:
-
generatePlainCPQ
public static CPQ generatePlainCPQ(int ruleApplications, List<Predicate> labels) throws IllegalArgumentException Generates a random CPQ created by applying the intersection (conjunction) and concatenation steps from the CPQ grammar the given number of times. Labels and inverse labels are drawn from the given set of labels. Three relatively meaningless but technically valid patterns are intentionally never generated:- Concatenation with identity.
- Intersection of identity with identity.
- The query consisting of only identity and nothing else.
- Parameters:
ruleApplications
- The number of times the intersection and concatenation steps are allowed to be applied.labels
- The set of labels to draw from.- Returns:
- The randomly generated CPQ.
- Throws:
IllegalArgumentException
- When the list of labels is empty.- See Also:
-
generatePlainCPQ
Generates a random CPQ created by applying the intersection (conjunction) and concatenation steps from the CPQ grammar the given number of times. Labels and inverse labels are drawn from the given set of labels. Two relatively meaningless but technically valid patterns are intentionally never generated:- Concatenation with identity.
- Intersection of identity with identity.
- Parameters:
ruleApplications
- The number of times the intersection and concatenation steps are allowed to be applied.allowId
- Whether the result of this call is allowed to be the identity CPQ.labels
- The set of labels to draw from.- Returns:
- The randomly generated CPQ.
-