Class QueryAnalyzer
java.lang.Object
org.apache.sis.internal.sql.feature.FeatureAnalyzer
org.apache.sis.internal.sql.feature.QueryAnalyzer
Constructor for a
Table
based on a query, to be considered as a virtual table.
User should build a query where each column has a distinct name (using "AS" if needed).
Current implementation follows "import" foreigner keys but not "export" foreigner keys.- Since:
- 1.1
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Column[]
All columns, without filtering for separating attributes from associations.private final Map<TableReference,
Map<String, Column>> Columns grouped by the tables that contain them.private final String
The query submitted by user.Fields inherited from class org.apache.sis.internal.sql.feature.FeatureAnalyzer
analyzer, feature, hasGeometry, hasRaster, id, primaryKey
-
Constructor Summary
ConstructorsConstructorDescriptionQueryAnalyzer
(Analyzer analyzer, org.opengis.util.GenericName name, String query, String definition) Creates a new analyzer for a query. -
Method Summary
Modifier and TypeMethodDescription(package private) Column[]
Configures the feature builder with attributes inferred from the query.(package private) Relation[]
getForeignerKeys
(Relation.Direction direction) Returns a list of associations between the table read by this method and other tables.Methods inherited from class org.apache.sis.internal.sql.feature.FeatureAnalyzer
addForeignerKeys, buildFeatureType, createAssociations, createAttribute, duplicatedColumn, getRemarks
-
Field Details
-
query
The query submitted by user. -
columns
All columns, without filtering for separating attributes from associations. -
columnsPerTable
Columns grouped by the tables that contain them. TheString
keys of innerMap
s areColumn.name
values.
-
-
Constructor Details
-
QueryAnalyzer
QueryAnalyzer(Analyzer analyzer, org.opengis.util.GenericName name, String query, String definition) throws Exception Creates a new analyzer for a query.- Parameters:
name
- name to give to the virtual table.query
- the query submitted by user.definition
- concise definition of the resource in natural language.- Throws:
Exception
-
-
Method Details
-
getForeignerKeys
Returns a list of associations between the table read by this method and other tables. Current implementation supports only "import" foreigner keys, i.e. associations from the query to another table (not the opposite direction).- Specified by:
getForeignerKeys
in classFeatureAnalyzer
- Parameters:
direction
- direction of the foreigner key for which to return components.- Returns:
- components of the foreigner key for the requested direction.
- Throws:
SQLException
- if an error occurred while fetching information from the database.DataStoreException
- if a logical error occurred while analyzing the relations.
-
createAttributes
Configures the feature builder with attributes inferred from the query.- Specified by:
createAttributes
in classFeatureAnalyzer
- Returns:
- the columns for attribute values (not including associations).
- Throws:
SQLException
- if an error occurred while fetching information from the database.DataStoreException
- if a logical error occurred while analyzing the relations.Exception
- for WKB parsing error or other kinds of errors.
-