Class ADQLQueryFactory
- Direct Known Subclasses:
SQLServer_ADQLQueryFactory
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.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateArea
(GeometryFunction param) createBetween
(boolean not, ADQLOperand value, ADQLOperand min, ADQLOperand max) createBox
(ADQLOperand coordinateSystem, ADQLOperand firstCoord, ADQLOperand secondCoord, ADQLOperand boxWidth, ADQLOperand boxHeight) createBox
(ADQLOperand coordinateSystem, GeometryFunction.GeometryValue<GeometryFunction> center, ADQLOperand boxWidth, ADQLOperand boxHeight) createCastFunction
(ADQLOperand value, TargetType type) Create aCastFunction
.createCentroid
(GeometryFunction param) createCircle
(ADQLOperand coordSys, ADQLOperand coord1, ADQLOperand coord2, ADQLOperand radius) createCircle
(ADQLOperand coordSys, GeometryFunction.GeometryValue<GeometryFunction> center, ADQLOperand radius) createCoalesceFunction
(Collection<ADQLOperand> operands) Create aCoalesceFunction
.createColRef
(int index, TextPosition position) createColumn
(IdentifierItems idItems) createColumn
(IdentifierItems.IdentifierItem columnName) createComparison
(ADQLOperand leftOp, ComparisonOperator op, ADQLOperand rightOp) createContains
(GeometryFunction.GeometryValue<GeometryFunction> left, GeometryFunction.GeometryValue<GeometryFunction> right) createContains
(GeometryFunction left, GeometryFunction right) createCoord1
(ADQLColumn point) createCoord1
(PointFunction point) createCoord2
(ADQLColumn point) createCoord2
(PointFunction point) createDistance
(GeometryFunction.GeometryValue<GeometryFunction> point1, GeometryFunction.GeometryValue<GeometryFunction> point2) createDistance
(GeometryFunction point1, GeometryFunction point2) createDistance
(PointFunction point1, PointFunction point2) Deprecated.createExists
(ADQLSet query) createExtractCoordSys
(ADQLColumn param) createIn
(ADQLOperand leftOp, ADQLSet query, boolean notIn) createIn
(ADQLOperand leftOp, ADQLOperand[] valuesList, boolean notIn) createIntersects
(GeometryFunction.GeometryValue<GeometryFunction> left, GeometryFunction.GeometryValue<GeometryFunction> right) createIntersects
(GeometryFunction left, GeometryFunction right) createInUnitFunction
(ADQLOperand value, ADQLOperand targetUnit) createIsNull
(boolean notNull, ADQLColumn column) createJoin
(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable) createJoin
(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable, ClauseConstraints condition) createJoin
(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable, Collection<ADQLColumn> lstColumns) createMathFunction
(MathFunctionType type, ADQLOperand param1, ADQLOperand param2) createNegativeOperand
(ADQLOperand opToNegativate) createNot
(ADQLConstraint constraintToNot) Create aNullValue
.createNumericConstant
(String value) createOffset
(int offsetValue) Create aClauseOffset
.createOperation
(ADQLOperand leftOp, OperationType op, ADQLOperand rightOp) createOrder
(int ind, boolean desc) createOrder
(int ind, boolean desc, TextPosition position) Deprecated.since 1.4 ; Replaced bycreateOrder(int, boolean)
createOrder
(IdentifierItems.IdentifierItem colName, boolean desc) Deprecated.Since 2.0, a column reference can be a qualified column (i.e.createOrder
(IdentifierItems idItems, boolean desc) 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.createOrder
(ADQLOperand expr, boolean desc) createPoint
(ADQLOperand coordSys, ADQLOperand coords, ADQLOperand coords2) createPolygon
(ADQLOperand coordSys, Collection<? extends ADQLOperand> coords) final ADQLQuery
Deprecated.Since v2.0,createQuery(ADQLVersion)
must be used/extended instead.createQuery
(ADQLParser.ADQLVersion version) Create an instance ofADQLQuery
.createRegion
(ADQLOperand param) createSelectItem
(ADQLOperand operand, String alias) createSetOperation
(ADQLParser.ADQLVersion version, ADQLSet leftSet, SetOperationType operation, ADQLSet rightSet) createSQLFunction
(SQLFunctionType type, ADQLOperand op, boolean distinctValues) createStringConstant
(String value) createTable
(IdentifierItems idItems, IdentifierItems.IdentifierItem alias) createTable
(ADQLSet query, IdentifierItems.IdentifierItem alias) createUserDefinedFunction
(String name, ADQLOperand[] params) Creates the user defined function with the given name and parameters.createWithItem
(IdentifierItems.IdentifierItem queryLabel, ADQLSet query) createWrappedOperand
(ADQLOperand opToWrap)
-
Constructor Details
-
ADQLQueryFactory
public ADQLQueryFactory()Create a query factory.
-
-
Method Details
-
createQuery
Deprecated.Since v2.0,createQuery(ADQLVersion)
must be used/extended instead.- Throws:
Exception
-
createQuery
Create an instance ofADQLQuery
. -
createSetOperation
public SetOperation createSetOperation(ADQLParser.ADQLVersion version, ADQLSet leftSet, SetOperationType operation, ADQLSet rightSet) throws Exception - Throws:
Exception
- Since:
- 2.0
-
createTable
public ADQLTable createTable(IdentifierItems idItems, IdentifierItems.IdentifierItem alias) throws Exception - Throws:
Exception
-
createTable
- Throws:
Exception
-
createJoin
public ADQLJoin createJoin(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable) throws Exception - Throws:
Exception
-
createJoin
public ADQLJoin createJoin(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable, ClauseConstraints condition) throws Exception - Throws:
Exception
-
createJoin
public ADQLJoin createJoin(ADQLQueryFactory.JoinType type, FromContent leftTable, FromContent rightTable, Collection<ADQLColumn> lstColumns) throws Exception - Throws:
Exception
-
createWithItem
public WithItem createWithItem(IdentifierItems.IdentifierItem queryLabel, ADQLSet query) throws Exception - Throws:
Exception
- Since:
- 2.0
-
createSelectItem
- Throws:
Exception
-
createColumn
- Throws:
Exception
-
createColumn
- Throws:
Exception
-
createNumericConstant
- Throws:
Exception
-
createStringConstant
- Throws:
Exception
-
createOperation
public Operation createOperation(ADQLOperand leftOp, OperationType op, ADQLOperand rightOp) throws Exception - Throws:
Exception
-
createNegativeOperand
- Throws:
Exception
-
createConcatenation
- Throws:
Exception
-
createWrappedOperand
- Throws:
Exception
-
createGroupOfConstraints
- Throws:
Exception
-
createNot
- Throws:
Exception
-
createComparison
public Comparison createComparison(ADQLOperand leftOp, ComparisonOperator op, ADQLOperand rightOp) throws Exception - Throws:
Exception
-
createBetween
public Between createBetween(boolean not, ADQLOperand value, ADQLOperand min, ADQLOperand max) throws Exception - Throws:
Exception
-
createIsNull
- Throws:
Exception
-
createExists
- Throws:
Exception
-
createIn
- Throws:
Exception
-
createIn
- Throws:
Exception
-
createSQLFunction
public SQLFunction createSQLFunction(SQLFunctionType type, ADQLOperand op, boolean distinctValues) throws Exception - Throws:
Exception
-
createLowerFunction
- Throws:
Exception
- Since:
- 2.0
-
createUpperFunction
- Throws:
Exception
- Since:
- 2.0
-
createMathFunction
public MathFunction createMathFunction(MathFunctionType type, ADQLOperand param1, ADQLOperand param2) throws Exception - Throws:
Exception
-
createInUnitFunction
public InUnitFunction createInUnitFunction(ADQLOperand value, ADQLOperand targetUnit) throws Exception - Throws:
Exception
- Since:
- 2.0
-
createUserDefinedFunction
public UserDefinedFunction createUserDefinedFunction(String name, ADQLOperand[] params) throws Exception Creates the user defined function with the given name and parameters.By default, this function returns a
UserDefinedFunction
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 asUserDefinedFunction
instances.IMPORTANT: The tests done to check whether a user defined function is allowed/supported in this implementation, is done later by the
QueryChecker
provided byADQLParser.getQueryChecker()
. Only UDFs declared in the supportedfeatures
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 aFunctionDef
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
UserDefinedFunction
). - Throws:
Exception
- If there is a problem while creating the function.
-
createDistance
@Deprecated public DistanceFunction createDistance(PointFunction point1, PointFunction point2) throws Exception Deprecated.Since 2.0, prefer to use directlycreateDistance(GeometryFunction, GeometryFunction)
- Throws:
Exception
-
createDistance
public DistanceFunction createDistance(GeometryFunction point1, GeometryFunction point2) throws Exception - Throws:
Exception
- Since:
- 2.0
-
createDistance
public DistanceFunction createDistance(GeometryFunction.GeometryValue<GeometryFunction> point1, GeometryFunction.GeometryValue<GeometryFunction> point2) throws Exception - Throws:
Exception
-
createPoint
public PointFunction createPoint(ADQLOperand coordSys, ADQLOperand coords, ADQLOperand coords2) throws Exception - Throws:
Exception
-
createBox
public BoxFunction createBox(ADQLOperand coordinateSystem, ADQLOperand firstCoord, ADQLOperand secondCoord, ADQLOperand boxWidth, ADQLOperand boxHeight) throws Exception - Throws:
Exception
-
createBox
public BoxFunction createBox(ADQLOperand coordinateSystem, GeometryFunction.GeometryValue<GeometryFunction> center, ADQLOperand boxWidth, ADQLOperand boxHeight) throws Exception - Throws:
Exception
- Since:
- 2.0
-
createCircle
public CircleFunction createCircle(ADQLOperand coordSys, ADQLOperand coord1, ADQLOperand coord2, ADQLOperand radius) throws Exception - Throws:
Exception
-
createCircle
public CircleFunction createCircle(ADQLOperand coordSys, GeometryFunction.GeometryValue<GeometryFunction> center, ADQLOperand radius) throws Exception - Throws:
Exception
- Since:
- 2.0
-
createCentroid
- Throws:
Exception
-
createCentroid
public CentroidFunction createCentroid(GeometryFunction.GeometryValue<GeometryFunction> param) throws Exception - Throws:
Exception
-
createRegion
- Throws:
Exception
-
createPolygon
public PolygonFunction createPolygon(ADQLOperand coordSys, Collection<? extends ADQLOperand> coords) throws Exception - Throws:
Exception
-
createArea
- Throws:
Exception
-
createArea
public AreaFunction createArea(GeometryFunction.GeometryValue<GeometryFunction> param) throws Exception - Throws:
Exception
-
createCoord1
- Throws:
Exception
-
createCoord1
- Throws:
Exception
-
createCoord2
- Throws:
Exception
-
createCoord2
- Throws:
Exception
-
createExtractCoordSys
- Throws:
Exception
-
createExtractCoordSys
- Throws:
Exception
-
createExtractCoordSys
public ExtractCoordSys createExtractCoordSys(GeometryFunction.GeometryValue<GeometryFunction> param) throws Exception - Throws:
Exception
-
createContains
public ContainsFunction createContains(GeometryFunction left, GeometryFunction right) throws Exception - Throws:
Exception
-
createContains
public ContainsFunction createContains(GeometryFunction.GeometryValue<GeometryFunction> left, GeometryFunction.GeometryValue<GeometryFunction> right) throws Exception - Throws:
Exception
-
createIntersects
public IntersectsFunction createIntersects(GeometryFunction left, GeometryFunction right) throws Exception - Throws:
Exception
-
createIntersects
public IntersectsFunction createIntersects(GeometryFunction.GeometryValue<GeometryFunction> left, GeometryFunction.GeometryValue<GeometryFunction> right) throws Exception - Throws:
Exception
-
createOrder
- Throws:
Exception
- Since:
- 1.4
-
createOrder
@Deprecated public ADQLOrder createOrder(int ind, boolean desc, TextPosition position) throws Exception Deprecated.since 1.4 ; Replaced bycreateOrder(int, boolean)
- Throws:
Exception
-
createOrder
@Deprecated public ADQLOrder createOrder(IdentifierItems.IdentifierItem colName, boolean desc) throws Exception Deprecated.Since 2.0, a column reference can be a qualified column (i.e. anADQLColumn
). You should usecreateOrder(ADQLOperand, boolean)
instead.- Throws:
Exception
-
createOrder
- Throws:
Exception
- Since:
- 2.0
-
createOrder
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:
Exception
-
createColRef
- Throws:
Exception
-
createOffset
Create aClauseOffset
.- Parameters:
offsetValue
- The OFFSET's value. MUST be POSITIVE- Returns:
- The created
ClauseOffset
. - Throws:
Exception
- If the given OFFSET value is incorrect.- Since:
- 2.0
-
createCastFunction
Create aCastFunction
.- Parameters:
value
- The value to convert.type
- Type into which the value must be converted.- Returns:
- The created
CastFunction
. - Throws:
Exception
- If one or both parameters are incorrect.- Since:
- 2.0
-
createCoalesceFunction
Create aCoalesceFunction
.- Parameters:
operands
- All values to take into account (only the first non-NULL will be kept).- Returns:
- The created
CoalesceFunction
: - Throws:
Exception
- If one or both parameters are incorrect.- Since:
- 2.0
-
createNullValue
Create aNullValue
.- Returns:
- The created
NullValue
instance. - Since:
- 2.0
-
createDistance(GeometryFunction, GeometryFunction)