Class ShapeGenerator

java.lang.Object
dev.roanh.gmark.query.shape.ShapeGenerator
Direct Known Subclasses:
ChainGenerator, CycleGenerator, StarChainGenerator, StarGenerator

public abstract class ShapeGenerator extends Object
Base class for generators that generate a query made up of a number conjuncts that are connected in a certain shape.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final ConjunctGenerator
    The generator to use to populate the conjuncts.
    protected final SelectivityGraph
    The selectivity graph for the graph schema.
    protected final Workload
    The workload specification.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructs a new shape generator for the given workload.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<Variable>
    Generates am ordered list of variables numbered from 0 to n (exclusive).
    abstract Query
    Generates a new query with a specific shape following the provided workload specification.
    protected int
    randomArity(int maxVariables)
    Generates a random arity for the query within the limits set by the workload specification.
    protected int
    Generates a random number of conjuncts for the query within the limits set by the workload specification.
    protected Selectivity
    Generates a random selectivity for the query from the selectivities allowed by the workload specification.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • conjGen

      protected final ConjunctGenerator conjGen
      The generator to use to populate the conjuncts.
    • workload

      protected final Workload workload
      The workload specification.
    • gSel

      protected final SelectivityGraph gSel
      The selectivity graph for the graph schema.
  • Constructor Details

    • ShapeGenerator

      protected ShapeGenerator(Workload workload)
      Constructs a new shape generator for the given workload.
      Parameters:
      workload - The workload instance.
  • Method Details

    • generateQuery

      public abstract Query generateQuery() throws GenerationException
      Generates a new query with a specific shape following the provided workload specification.
      Returns:
      The generated query.
      Throws:
      GenerationException - When generating the query failed for some reason.
    • randomConjunctNumber

      protected int randomConjunctNumber()
      Generates a random number of conjuncts for the query within the limits set by the workload specification.
      Returns:
      The randomly selected number of conjuncts to generate.
    • randomSelectivity

      protected Selectivity randomSelectivity()
      Generates a random selectivity for the query from the selectivities allowed by the workload specification.
      Returns:
      The randomly selected selectivity.
    • createVariables

      protected List<Variable> createVariables(int n)
      Generates am ordered list of variables numbered from 0 to n (exclusive).
      Parameters:
      n - The total number of variables to create.
      Returns:
      An ordered list of numbered variables.
    • randomArity

      protected int randomArity(int maxVariables)
      Generates a random arity for the query within the limits set by the workload specification.
      Parameters:
      maxVariables - The maximum number of variables the generated arity can never be more than this.
      Returns:
      The randomly generated arity.