Package dev.roanh.gmark.query
Class QueryBody
java.lang.Object
dev.roanh.gmark.query.QueryBody
- All Implemented Interfaces:
OutputXML
Represents the body of a query, this is essentially
the query without the projected head variables.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionThe conjuncts in this query body.private Selectivity
The selectivity of this query body.private QueryShape
The shape of this query body. -
Constructor Summary
ConstructorDescriptionQueryBody
(List<Conjunct> conjuncts, Selectivity selectivity, QueryShape shape) Constructs a new query body with the given conjuncts, selectivity and shape. -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
Converts a conjunct variable to SQL.int
Gets the number of conjuncts in this query body.double
Gets the multiplicity of this query body.Gets the selectivity of this query body.getShape()
Gets the shape of this query body.protected String
Converts this query body to SQL.toString()
void
writeXML
(IndentWriter writer) Writes this object as XML to the given writer.
-
Field Details
-
conjuncts
The conjuncts in this query body. -
selectivity
The selectivity of this query body. -
shape
The shape of this query body.
-
-
Constructor Details
-
QueryBody
public QueryBody(List<Conjunct> conjuncts, Selectivity selectivity, QueryShape shape) throws IllegalArgumentException Constructs a new query body with the given conjuncts, selectivity and shape.- Parameters:
conjuncts
- The conjuncts for this query body.selectivity
- The selectivity of this query body.shape
- The shape of this query body.- Throws:
IllegalArgumentException
- When the list of conjuncts is empty.
-
-
Method Details
-
getConjunctCount
public int getConjunctCount()Gets the number of conjuncts in this query body.- Returns:
- The number of conjuncts in this query body.
-
getMultiplicity
public double getMultiplicity()Gets the multiplicity of this query body. This is computed as the fraction of all conjuncts that has a Kleene star above it.- Returns:
- The multiplicity of this query body.
-
getSelectivity
Gets the selectivity of this query body.- Returns:
- The selectivity of this query body.
-
getShape
Gets the shape of this query body.- Returns:
- The shape of this query body.
-
toString
-
toSQL
Converts this query body to SQL.- Parameters:
lhs
- The projected head variables.- Returns:
- The SQL form of this query body.
-
conjunctVarToSQL
Converts a conjunct variable to SQL.- Parameters:
var
- The variable to convert.conj
- The conjunct this variable is a part of.idMap
- A map storing the ID of each conjunct.- Returns:
- The SQL version of this conjunct variable.
-
writeXML
Description copied from interface:OutputXML
Writes this object as XML to the given writer.
-