Class ADQLQueryFactory
- java.lang.Object
-
- adql.parser.ADQLQueryFactory
-
- Direct Known Subclasses:
SQLServer_ADQLQueryFactory
public class ADQLQueryFactory extends java.lang.Object
This class lets the
ADQLParser
to build an object representation of an ADQL query.To customize the object representation you merely have to extends the appropriate functions of this class.
- Version:
- 1.4 (04/2017)
- Author:
- Grégory Mantelet (CDS;ARI)
- See Also:
ADQLParser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ADQLQueryFactory.JoinType
Type of table JOIN.
-
Constructor Summary
Constructors Constructor Description ADQLQueryFactory()
Create a query factory.
-
Method Summary
-
-
-
Method Detail
-
createQuery
public ADQLQuery createQuery() throws java.lang.Exception
- Throws:
java.lang.Exception
-
createTable
public ADQLTable createTable(IdentifierItems idItems, IdentifierItems.IdentifierItem alias) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createTable
public ADQLTable createTable(ADQLQuery query, IdentifierItems.IdentifierItem alias) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createJoin
public ADQLJoin createJoin(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createJoin
public ADQLJoin createJoin(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable, ClauseConstraints condition) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createJoin
public ADQLJoin createJoin(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable, java.util.Collection<ADQLColumn> lstColumns) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createSelectItem
public SelectItem createSelectItem(ADQLOperand operand, java.lang.String alias) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createColumn
public ADQLColumn createColumn(IdentifierItems idItems) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createColumn
public ADQLColumn createColumn(IdentifierItems.IdentifierItem columnName) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createNumericConstant
public NumericConstant createNumericConstant(java.lang.String value) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createStringConstant
public StringConstant createStringConstant(java.lang.String value) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createOperation
public Operation createOperation(ADQLOperand leftOp, OperationType op, ADQLOperand rightOp) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createNegativeOperand
public NegativeOperand createNegativeOperand(ADQLOperand opToNegativate) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createConcatenation
public Concatenation createConcatenation() throws java.lang.Exception
- Throws:
java.lang.Exception
-
createWrappedOperand
public WrappedOperand createWrappedOperand(ADQLOperand opToWrap) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createGroupOfConstraints
public ConstraintsGroup createGroupOfConstraints() throws java.lang.Exception
- Throws:
java.lang.Exception
-
createNot
public NotConstraint createNot(ADQLConstraint constraintToNot) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createComparison
public Comparison createComparison(ADQLOperand leftOp, ComparisonOperator op, ADQLOperand rightOp) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createBetween
public Between createBetween(boolean not, ADQLOperand value, ADQLOperand min, ADQLOperand max) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createIsNull
public IsNull createIsNull(boolean notNull, ADQLColumn column) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createExists
public Exists createExists(ADQLQuery query) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createIn
public In createIn(ADQLOperand leftOp, ADQLQuery query, boolean notIn) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createIn
public In createIn(ADQLOperand leftOp, ADQLOperand[] valuesList, boolean notIn) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createSQLFunction
public SQLFunction createSQLFunction(SQLFunctionType type, ADQLOperand op, boolean distinctValues) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createMathFunction
public MathFunction createMathFunction(MathFunctionType type, ADQLOperand param1, ADQLOperand param2) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createUserDefinedFunction
public UserDefinedFunction createUserDefinedFunction(java.lang.String name, ADQLOperand[] params) throws java.lang.Exception
Creates the user defined functions called as the given name and with the given parameters.
By default, this function returns a
DefaultUDF
instance. It is generic enough to cover every kind of functions. But you can of course override this function in order to return your own instance ofUserDefinedFunction
. In this case, you may not forget to call the super function (super.createUserDefinedFunction(name, params)) so that all other unknown functions are still returned asDefaultUDF
instances.IMPORTANT: The tests done to check whether a user defined function is allowed/managed in this implementation, is done later by the parser. Only declared UDF will pass the test of the parser. For that, you should give it a list of allowed UDFs (each UDF will be then represented by a
FunctionDef
object).- Parameters:
name
- Name of the user defined function to create.params
- Parameters of the user defined function to create.- Returns:
- The corresponding user defined function (by default an instance of
DefaultUDF
). - Throws:
java.lang.Exception
- If there is a problem while creating the function.
-
createDistance
public DistanceFunction createDistance(PointFunction point1, PointFunction point2) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createDistance
public DistanceFunction createDistance(GeometryFunction.GeometryValue<PointFunction> point1, GeometryFunction.GeometryValue<PointFunction> point2) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createPoint
public PointFunction createPoint(ADQLOperand coordSys, ADQLOperand coords, ADQLOperand coords2) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createBox
public BoxFunction createBox(ADQLOperand coordinateSystem, ADQLOperand firstCoord, ADQLOperand secondCoord, ADQLOperand boxWidth, ADQLOperand boxHeight) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createCircle
public CircleFunction createCircle(ADQLOperand coordSys, ADQLOperand coord1, ADQLOperand coord2, ADQLOperand radius) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createCentroid
public CentroidFunction createCentroid(GeometryFunction param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createCentroid
public CentroidFunction createCentroid(GeometryFunction.GeometryValue<GeometryFunction> param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createRegion
public RegionFunction createRegion(ADQLOperand param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createPolygon
public PolygonFunction createPolygon(ADQLOperand coordSys, java.util.Collection<? extends ADQLOperand> coords) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createArea
public AreaFunction createArea(GeometryFunction param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createArea
public AreaFunction createArea(GeometryFunction.GeometryValue<GeometryFunction> param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createCoord1
public ExtractCoord createCoord1(PointFunction point) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createCoord1
public ExtractCoord createCoord1(ADQLColumn point) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createCoord2
public ExtractCoord createCoord2(PointFunction point) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createCoord2
public ExtractCoord createCoord2(ADQLColumn point) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createExtractCoordSys
public ExtractCoordSys createExtractCoordSys(GeometryFunction param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createExtractCoordSys
public ExtractCoordSys createExtractCoordSys(ADQLColumn param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createExtractCoordSys
public ExtractCoordSys createExtractCoordSys(GeometryFunction.GeometryValue<GeometryFunction> param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createContains
public ContainsFunction createContains(GeometryFunction left, GeometryFunction right) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createContains
public ContainsFunction createContains(GeometryFunction.GeometryValue<GeometryFunction> left, GeometryFunction.GeometryValue<GeometryFunction> right) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createIntersects
public IntersectsFunction createIntersects(GeometryFunction left, GeometryFunction right) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createIntersects
public IntersectsFunction createIntersects(GeometryFunction.GeometryValue<GeometryFunction> left, GeometryFunction.GeometryValue<GeometryFunction> right) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createOrder
public ADQLOrder createOrder(int ind, boolean desc) throws java.lang.Exception
- Throws:
java.lang.Exception
- Since:
- 1.4
-
createOrder
@Deprecated public ADQLOrder createOrder(int ind, boolean desc, TextPosition position) throws java.lang.Exception
Deprecated.since 1.4 ; Replaced bycreateOrder(int, boolean)
- Throws:
java.lang.Exception
-
createOrder
public ADQLOrder createOrder(IdentifierItems.IdentifierItem colName, boolean desc) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createOrder
@Deprecated public ADQLOrder createOrder(IdentifierItems idItems, boolean desc) throws java.lang.Exception
Deprecated.since 1.4 ; Former version's mistake: an ORDER BY item is either a regular/delimited column name or an integer, not a qualified column name ; Replaced bycreateOrder(adql.parser.IdentifierItems.IdentifierItem, boolean)
; This function is no longer used by ADQLParser.- Throws:
java.lang.Exception
-
createColRef
public ColumnReference createColRef(IdentifierItems.IdentifierItem idItem) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createColRef
public ColumnReference createColRef(IdentifierItems idItems) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createColRef
public ColumnReference createColRef(int index, TextPosition position) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-