Class GeneratorCPQ

java.lang.Object
dev.roanh.gmark.lang.cpq.GeneratorCPQ

public final class GeneratorCPQ extends Object
Simple generator for CPQs (Conjunctive Path Queries).
See Also:
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Prevent instantiation.
  • Method Summary

    Modifier and Type
    Method
    Description
    private 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      1. Concatenation with identity.
      2. Intersection of identity with identity.
      3. 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:
      1. Concatenation with identity.
      2. Intersection of identity with identity.
      3. 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

      private 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. Labels and inverse labels are drawn from the given set of labels. Two relatively meaningless but technically valid patterns are intentionally never generated:
      1. Concatenation with identity.
      2. 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.