Package dev.roanh.gmark.core
Class Workload
java.lang.Object
dev.roanh.gmark.core.Workload
- All Implemented Interfaces:
IDable
- Direct Known Subclasses:
WorkloadCPQ
,WorkloadRPQ
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
Modifier and TypeFieldDescriptionprivate 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.abstract ConjunctGenerator
Gets a generator for generating conjuncts according to this workload configuration.Gets the graph schema for this workload.int
getID()
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
getSize()
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
getType()
Gets the type of this workload.void
removeSelectivities
(Selectivity... selectivities) Removes the given selectivities as valid selectivities for queries generated for this workload.void
removeShapes
(QueryShape... shapes) 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
validate()
Validates this workload by checking that all of the arguments are valid and usable for query generation.
-
Field Details
-
id
private final int idThe unique ID of this workload. -
size
private int sizeNumber of queries in this workload. -
minConjuncts
private int minConjunctsThe minimum number of conjuncts in queries generated in this workload. -
maxConjuncts
private int maxConjunctsThe maximum number of conjuncts in queries generated in this workload. -
minArity
private int minArityThe minimum arity of queries generated in this workload (0 is allowed). -
maxArity
private int maxArityThem maximum arity of queries generated in this workload. -
starProbability
private double starProbabilityProbability that a conjunct has a Kleene star above it. -
shapes
Set of valid queries shapes for queries generated in this workload. -
selectivities
Set of valid query selectivities for queries generated in this workload. -
schema
The graph schema this workload should be generated on.
-
-
Constructor Details
-
Workload
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
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
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
Gets a generator for generating conjuncts according to this workload configuration.- Returns:
- A worklaod conjunct generator.
-
generateSingleQuery
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
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
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
Adds the given selectivities as valid selectivities for queries generated for this workload.- Parameters:
selectivities
- The selectivities to add.
-
removeSelectivities
Removes the given selectivities as valid selectivities for queries generated for this workload.- Parameters:
selectivities
- The selectivities to remove.
-
addShapes
Adds the given shapes as valid shapes for queries generated for this workload.- Parameters:
shapes
- The shapes to add.
-
removeShapes
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
Gets all the shapes allowed for queries in this workload.- Returns:
- All allowed query shapes.
-
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.
-