Package dev.roanh.gmark.query.shape
Class ShapeGenerator
java.lang.Object
dev.roanh.gmark.query.shape.ShapeGenerator
- Direct Known Subclasses:
ChainGenerator
,CycleGenerator
,StarChainGenerator
,StarGenerator
Base class for generators that generate a query made up
of a number conjuncts that are connected in a certain shape.
-
Field Summary
Modifier and TypeFieldDescriptionprotected 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
ModifierConstructorDescriptionprotected
ShapeGenerator
(Workload workload) Constructs a new shape generator for the given workload. -
Method Summary
Modifier and TypeMethodDescriptioncreateVariables
(int n) 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.
-
Field Details
-
conjGen
The generator to use to populate the conjuncts. -
workload
The workload specification. -
gSel
The selectivity graph for the graph schema.
-
-
Constructor Details
-
ShapeGenerator
Constructs a new shape generator for the given workload.- Parameters:
workload
- The workload instance.
-
-
Method Details
-
generateQuery
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
Generates a random selectivity for the query from the selectivities allowed by the workload specification.- Returns:
- The randomly selected selectivity.
-
createVariables
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.
-