Class Workload

java.lang.Object
dev.roanh.gmark.core.Workload
All Implemented Interfaces:
IDable
Direct Known Subclasses:
WorkloadCPQ, WorkloadRPQ

public abstract class Workload extends Object implements IDable
Represents a workload with all the important arguments required for query generation. Conjuncts specific settings are managed by subclasses of this class.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The unique ID of this workload.
    private int
    Them maximum arity of queries generated in this workload.
    private int
    The maximum number of conjuncts in queries generated in this workload.
    private int
    The minimum arity of queries generated in this workload (0 is allowed).
    private int
    The minimum number of conjuncts in queries generated in this workload.
    private Schema
    The graph schema this workload should be generated on.
    private Set<Selectivity>
    Set of valid query selectivities for queries generated in this workload.
    private Set<QueryShape>
    Set of valid queries shapes for queries generated in this workload.
    private int
    Number of queries in this workload.
    private double
    Probability that a conjunct has a Kleene star above it.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Workload(Element elem, Schema schema)
    Constructs a new workload by parsing data used by all workload types from the given configuration node.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addSelectivities(Selectivity... selectivities)
    Adds the given selectivities as valid selectivities for queries generated for this workload.
    void
    addShapes(QueryShape... shapes)
    Adds the given shapes as valid shapes for queries generated for this workload.
    Generates workload according to the parameters specified in this workload configuration.
    Generates a single queries according to the parameters specified in this workload configuration.
    Gets a generator for generating conjuncts according to this workload configuration.
    Gets the graph schema for this workload.
    int
    Gets the unique ID for this object.
    int
    Gets the maximum arity allowed for queries in this workload.
    int
    Gets the maximum number of conjuncts allowed for queries in this workload.
    abstract int
    Gets the maximum length of paths needed in the selectivity graph to generate queries in accordance with this workload.
    int
    Gets the minimum arity allowed for queries in this workload.
    int
    Gets the minimum number of conjuncts allowed for queries in this workload.
    Gets all the selectivities allowed for queries in this workload.
    Gets all the shapes allowed for queries in this workload.
    int
    Gets the total number of queries that should be generated for this workload.
    double
    Gets the probability that a conjunct has a Kleene star above it for this workload.
    abstract WorkloadType
    Gets the type of this workload.
    void
    removeSelectivities(Selectivity... selectivities)
    Removes the given selectivities as valid selectivities for queries generated for this workload.
    void
    Removes the given shapes as valid shapes for queries generated for this workload.
    void
    setMaxArity(int arity)
    Sets the maximum arity allowed for queries generated according to this workload.
    void
    setMaxConjuncts(int conj)
    Sets the maximum number of conjuncts allowed for queries generated according to this workload.
    void
    setMinArity(int arity)
    Sets the minimum arity allowed for queries generated according to this workload.
    void
    setMinConjuncts(int conj)
    Sets the minimum number of conjuncts allowed for queries generated according to this workload.
    void
    setSize(int size)
    Sets the total number of queries that should be generated for this workload.
    void
    setStarProbability(double factor)
    Gets the probability that a conjunct has a Kleene star above it (as a fraction).
    void
    Validates this workload by checking that all of the arguments are valid and usable for query generation.

    Methods inherited from class java.lang.Object

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

    • id

      private final int id
      The unique ID of this workload.
    • size

      private int size
      Number of queries in this workload.
    • minConjuncts

      private int minConjuncts
      The minimum number of conjuncts in queries generated in this workload.
    • maxConjuncts

      private int maxConjuncts
      The maximum number of conjuncts in queries generated in this workload.
    • minArity

      private int minArity
      The minimum arity of queries generated in this workload (0 is allowed).
    • maxArity

      private int maxArity
      Them maximum arity of queries generated in this workload.
    • starProbability

      private double starProbability
      Probability that a conjunct has a Kleene star above it.
    • shapes

      private Set<QueryShape> shapes
      Set of valid queries shapes for queries generated in this workload.
    • selectivities

      private Set<Selectivity> selectivities
      Set of valid query selectivities for queries generated in this workload.
    • schema

      private Schema schema
      The graph schema this workload should be generated on.
  • Constructor Details

    • Workload

      protected Workload(Element elem, Schema schema)
      Constructs a new workload by parsing data used by all workload types from the given configuration node.
      Parameters:
      elem - The configuration node to parse.
      schema - The schema for this workload.
  • Method Details

    • getType

      public abstract WorkloadType getType()
      Gets the type of this workload.
      Returns:
      The type of this workload.
    • getMaxSelectivityGraphLength

      public abstract int getMaxSelectivityGraphLength()
      Gets the maximum length of paths needed in the selectivity graph to generate queries in accordance with this workload.
      Returns:
      The maximum required selectivity graph path length.
    • validate

      public void validate() throws IllegalStateException
      Validates this workload by checking that all of the arguments are valid and usable for query generation. Subclasses should override this method to validate their own arguments.
      Throws:
      IllegalStateException - When it is determined that the workload is not valid.
    • getConjunctGenerator

      public abstract ConjunctGenerator getConjunctGenerator()
      Gets a generator for generating conjuncts according to this workload configuration.
      Returns:
      A worklaod conjunct generator.
    • generateSingleQuery

      public Query generateSingleQuery() throws GenerationException
      Generates a single queries according to the parameters specified in this workload configuration.
      Returns:
      The generated query.
      Throws:
      GenerationException - When an exception occurs when generating the query.
    • generateQueries

      public QuerySet generateQueries() throws GenerationException
      Generates workload according to the parameters specified in this workload configuration.
      Returns:
      The generated queries.
      Throws:
      GenerationException - When an exception occurs when generating queries.
    • getGraphSchema

      public Schema getGraphSchema()
      Gets the graph schema for this workload.
      Returns:
      The graph schema for this workload.
    • getStarProbability

      public double getStarProbability()
      Gets the probability that a conjunct has a Kleene star above it for this workload.
      Returns:
      The Kleene start probability.
    • setMinArity

      public void setMinArity(int arity)
      Sets the minimum arity allowed for queries generated according to this workload.
      Parameters:
      arity - The new minimum query arity.
    • setMaxArity

      public void setMaxArity(int arity)
      Sets the maximum arity allowed for queries generated according to this workload.
      Parameters:
      arity - The new maximum query arity.
    • setMinConjuncts

      public void setMinConjuncts(int conj)
      Sets the minimum number of conjuncts allowed for queries generated according to this workload.
      Parameters:
      conj - The new minimum number of conjuncts.
    • setMaxConjuncts

      public void setMaxConjuncts(int conj)
      Sets the maximum number of conjuncts allowed for queries generated according to this workload.
      Parameters:
      conj - The new maximum number of conjuncts.
    • addSelectivities

      public void addSelectivities(Selectivity... selectivities)
      Adds the given selectivities as valid selectivities for queries generated for this workload.
      Parameters:
      selectivities - The selectivities to add.
    • removeSelectivities

      public void removeSelectivities(Selectivity... selectivities)
      Removes the given selectivities as valid selectivities for queries generated for this workload.
      Parameters:
      selectivities - The selectivities to remove.
    • addShapes

      public void addShapes(QueryShape... shapes)
      Adds the given shapes as valid shapes for queries generated for this workload.
      Parameters:
      shapes - The shapes to add.
    • removeShapes

      public void removeShapes(QueryShape... shapes)
      Removes the given shapes as valid shapes for queries generated for this workload.
      Parameters:
      shapes - The shapes to remove.
    • setSize

      public void setSize(int size)
      Sets the total number of queries that should be generated for this workload.
      Parameters:
      size - The total number of queries for this workload.
    • setStarProbability

      public void setStarProbability(double factor)
      Gets the probability that a conjunct has a Kleene star above it (as a fraction).
      Parameters:
      factor - The conjunct Kleene star probability.
    • getSize

      public int getSize()
      Gets the total number of queries that should be generated for this workload.
      Returns:
      The total number of queries for this workload.
    • getMinArity

      public int getMinArity()
      Gets the minimum arity allowed for queries in this workload.
      Returns:
      The minimum arity.
    • getMaxArity

      public int getMaxArity()
      Gets the maximum arity allowed for queries in this workload.
      Returns:
      The maximum arity.
    • getMinConjuncts

      public int getMinConjuncts()
      Gets the minimum number of conjuncts allowed for queries in this workload.
      Returns:
      The minimum number of conjuncts.
    • getMaxConjuncts

      public int getMaxConjuncts()
      Gets the maximum number of conjuncts allowed for queries in this workload.
      Returns:
      The maximum number of conjuncts.
    • getShapes

      public Set<QueryShape> getShapes()
      Gets all the shapes allowed for queries in this workload.
      Returns:
      All allowed query shapes.
    • getSelectivities

      public Set<Selectivity> getSelectivities()
      Gets all the selectivities allowed for queries in this workload.
      Returns:
      All allowed query selectivities.
    • getID

      public int getID()
      Description copied from interface: IDable
      Gets the unique ID for this object. This ID uniquely identifies all objects of this type.
      Specified by:
      getID in interface IDable
      Returns:
      The unique ID for this object.