Dear all,
there has been a great deal of work behind the scenes by Pat, Inaki, Jeff and Alex to try to define the Region, as we agreed some time ago, and during our last Cambridge meeting.
The process has not ben easy at all, but I believe we are in a position to expose to the whole VOQL community a mature document that could be proposed for PR in the coming month.
We are still lacking the text for the Region stuff within the document, which we agreed will be written by two native Enlgish speakers (Pat and Jeff) with support from Alex and Inaki if needed. Nevertheless, we do have a neat BNF (which is the most important thing) written by Inaki and Jeff, and this is what will form the basis for the ADQL.
I would like you -voql-teg- to review the document and give your comments, and whether you are happy enough so it goes to the general VOQL community.
I attach the latest document produced by Inaki and inline his description of the latest changes in the document. Please let us know your comments if any. I will call for a teleconf meeting once you have had time enough to read the document.
I want to thank here Inaki, Pat, Jeff and Alex for their hard work ont he Region issue.
Cheers,
P.
Please find attached the latest ADQL-BNF that I have compiled with
recent inputs. The main changes are as follows:
Region is no longer a boolean predicate but a function.
Region construct is now able to accommodate a subset of OpenGIS-like
definitions.
Region is now considered as a system defined function.
New coordinates construct to encapsulate latitude and longitude sets.
Point construct changed to be like other geometry types.
Coordsys explicitly defined to allow literals and column references.
Geometry types built from single coord_sys to avoid redundancy.
1. Before
Before we had the region defined as a boolean predicate containing
either a contains or an intersects predicate.
<predicate> ::=
<comparison_predicate> | <between_predicate> |
<in_predicate> | <like_predicate>
| <null_predicate> | <exists_predicate> | <region_predicate>
<region_predicate> ::= <contains_predicate> | <intersects_predicate>
<contains_predicate> ::=
[ NOT ]CONTAINS <left_paren> <region>
<comma> <coordsys>
<comma> <coord_lon>
<comma> <coord_lat> <right_paren>
<coord_sys_keyword> ::= ICRS | GAL
<coord_sys_value> ::= <column_reference> | <user_defined_function>
<coord_sys> ::= <coord_sys_keyword> | <coord_sys_value>
<intersects_predicate> ::=
INTERSECTS <left_paren> <region>
<comma> <region> <right_paren>
<region> ::= <region_expression> | <region_value>
<region_expression> ::= <circle> | <rectangle> | <polygon>
<circle> ::=
CIRCLE <left_paren> <coord_sys>
<comma> <coord_lon>
<comma> <coord_lat>
<comma> <radius> <right_paren>
<region_value> ::= <column_reference> | <user_defined_function>
2. After
We now reuse the 'numeric value function' container and append to it a
new placeholder for system defined functions. Initially this container
includes all the region stuff plus, e.g., an explicit distance
function (as per request).
Hence, we have no more boolean predicates to define the geometrical
functions, just SQL92 compatible functions that could be described
following the OpenGIS syntax. We also include the point construct and
make any region function (contains, intersects, ...) deal with a more
abstract concept: the Geometry, which include for the time being
point, circle, rectangle and polygon (and could be extended if
necessary to any element of the OpenGIS Geometry class hierarchy).
With this approach we would be now dealing with SQL-compatible
functions (easy to implement) rather than boolean predicates. This
could be done as follows:
<numeric_value_function> ::=
<trigonometric_function>
| <math_function> | <user_defined_function> | <system_defined_function>
<system_defined_function> ::= <distance_function> | <region_function>
!! others could fit here
<distance_function> ::=
DISTANCE <left_paren> <point> <comma> <point> <right_paren>
<region_function> ::= <contains_function> | <intersects_function>
!! other functions could fit here: Equals, Disjoint, Touches, Crosses,
Within, Overlaps, Relate
<contains_function> ::=
CONTAINS <left_paren> <geometry>
<comma> <geometry> <right_paren>
<intersects_function> ::=
INTERSECTS <left_paren> <geometry>
<comma> <geometry> <right_paren>
<geometry> ::= <point> | <circle> | <rectangle> | <polygon>
<point> ::=
POINT <left_paren>
<coord_sys> <comma> <coordinates>
<right_paren>
<coordinates> ::= <coord_lon> <comma> <coord_lat>
<coord_sys> ::= <string_value_expression>
<coord_lat> ::= <numeric_value_expression>
!! generic latitude
<coord_lon> ::= <numeric_value_expression>
!! generic longitude
<circle> ::=
CIRCLE <left_paren>
<coord_sys> <comma>
<coordinates> <comma> <radius>
<radius> ::= <numeric_value_expression>
<rectangle> ::=
RECTANGLE <left_paren>
<coord_sys> <comma>
<coordinates> <comma> <coordinates>
<right_paren>
<polygon> ::=
POLYGON <left_paren>
<coordsys> <comma>
<coordinates> <comma> <coordinates> <comma> <coordinates>
{ <comma> <coordinates> } ?
<right_paren>
--
Iņaki Ortiz de Landaluce
European Space Agency (ESA)
European Space Astronomy Centre (ESAC)
Science Operations Department (SCI-O)
Science Archives Engineering Unit (SCI-OE)
E-mail: Inaki.Ortiz-at-sciops.esa.int
Tel: +34 91 813 13 67 Fax: +34 91 813 13 22
European Space Astronomy Centre (ESAC)
28691 Villanueva de la Caņada
P.O. Box 78, Madrid, SPAIN
* Region is no longer a boolean predicate but a function.
* Region construct is now able to accommodate a subset of OpenGIS-
like definitions.
* Region is now considered as a system defined function.
* New coordinates construct to encapsulate latitude and longitude
sets.
* Point construct changed to be like other geometry types.
* Coordsys explicitly defined to allow literals and column
references.
* Geometry types built from single coord_sys to avoid redundancy.
* UDF, REGION, GAL, ICRS taken out from ADQL reserved word list
* POINT added to ADQL reserved word list
<ADQL_language_character> ::=
<simple_Latin_letter>
| <digit>
| <SQL_special_character>
<ADQL_reserved_word> ::=
ABS
| ACOS
| ASIN
| ATAN
| ATAN2
| CEILING
| CIRCLE
| CONTAINS
| COS
| DEGREES
| EXP
| FLOOR
| INTERSECTS
| LOG
| LOG10
| MODE
| PI
| POINT
| POLYGON
| POWER
| RADIANS
| RECTANGLE
| RAND
| ROUND
| SIN
| SQRT
| SQUARE
| TAN
| TOP
| TRUNCATE
<SQL_embedded_language_character> ::=
<left_bracket>
| <right_bracket>
<SQL_reserved_word> ::=
ABSOLUTE | ACTION | ADD | ALL | ALLOCATE | ALTER | AND | ANY | ARE
| AS | ASC | ASSERTION | AT | AUTHORIZATION | AVG
| BEGIN | BETWEEN | BIT | BIT_LENGTH | BOTH | BY
| CASCADE | CASCADED | CASE | CAST | CATALOG | CHAR | CHARACTER
| CHARACTER_LENGTH
| CHAR_LENGTH | CHECK | CLOSE | COALESCE | COLLATE | COLLATION
| COLUMN | COMMIT
| CONNECT | CONNECTION | CONSTRAINT | CONSTRAINTS | CONTINUE
| CONVERT | CORRESPONDING | COUNT
| CREATE | CROSS | CURRENT | CURRENT_DATE | CURRENT_TIME
| CURRENT_TIMESTAMP
| CURRENT_USER | CURSOR
| DATE | DAY | DEALLOCATE | DECIMAL | DECLARE | DEFAULT
| DEFERRABLE | DEFERRED | DELETE | DESC | DESCRIBE | DESCRIPTOR
| DIAGNOSTICS
| DISCONNECT | DISTINCT | DOMAIN | DOUBLE | DROP
| ELSE | END | END-EXEC | ESCAPE | EXCEPT | EXCEPTION | EXEC
| EXECUTE
| EXISTS | EXTERNAL | EXTRACT
| FALSE | FETCH | FIRST | FLOAT | FOR | FOREIGN | FOUND | FROM | FULL
| GET | GLOBAL | GO | GOTO | GRANT | GROUP
| HAVING | HOUR
| IDENTITY | IMMEDIATE | IN | INDICATOR | INITIALLY | INNER | INPUT
| INSENSITIVE
| INSERT | INT | INTEGER | INTERSECT | INTERVAL | INTO | IS
| ISOLATION
| JOIN
| KEY
| LANGUAGE | LAST | LEADING | LEFT | LEVEL | LIKE | LOCAL | LOWER
| MATCH | MAX | MIN | MINUTE | MODULE | MONTH
| NAMES | NATIONAL | NATURAL | NCHAR | NEXT | NO | NOT | NULL
| NULLIF | NUMERIC
| OCTET_LENGTH | OF | ON | ONLY | OPEN | OPTION | OR | ORDER | OUTER
| OUTPUT | OVERLAPS
| PAD | PARTIAL | POSITION | PRECISION | PREPARE | PRESERVE | PRIMARY
| PRIOR | PRIVILEGES | PROCEDURE | PUBLIC
| READ | REAL | REFERENCES | RELATIVE | RESTRICT | REVOKE | RIGHT
| ROLLBACK | ROWS
| SCHEMA | SCROLL | SECOND | SECTION | SELECT | SESSION
| SESSION_USER | SET
| SIZE | SMALLINT | SOME | SPACE | SQL | SQLCODE | SQLERROR
| SQLSTATE | SUBSTRING | SUM | SYSTEM_USER
| TABLE | TEMPORARY | THEN | TIME | TIMESTAMP | TIMEZONE_HOUR
| TIMEZONE_MINUTE
| TO | TRAILING | TRANSACTION | TRANSLATE | TRANSLATION | TRIM | TRUE
| UNION | UNIQUE | UNKNOWN | UPDATE | UPPER | USAGE | USER | USING
| VALUE | VALUES | VARCHAR | VARYING | VIEW
| WHEN | WHENEVER | WHERE | WITH | WORK | WRITE
| YEAR
| ZONE
<SQL_special_character> ::=
<ampersand>
| <asterisk>
| <colon>
| <comma>
| <double_quote>
| <equals_operator>
| <greater_than_operator>
| <left_paren>
| <less_than_operator>
| <minus_sign>
| <percent>
| <period>
| <plus_sign>
| <question_mark>
| <quote>
| <right_paren>
| <semicolon>
| <solidus>
| <space>
| <underscore>
| <vertical_bar>
<ampersand> ::= &
<approximate_numeric_literal> ::= <mantissa> E <exponent>
<as_clause> ::= [ AS ] <column_name>
<asterisk> ::= *
<between_predicate> ::=
<value_expression> [ NOT ] BETWEEN <value_expression> AND
<value_expression>
<boolean_factor> ::= [ NOT ] <boolean_primary>
<boolean_primary> ::=
<predicate> | <left_paren> <search_condition> <right_paren>
<boolean_term> ::= <boolean_factor> | <boolean_term> AND
<boolean_factor>
<catalog_name> ::= <identifier>
<character_factor> ::= <character_primary>
<character_primary> ::= <value_expression_primary> |
<user_defined_function>
<character_representation> ::= <nonquote_character> | <quote_symbol>
<character_string_literal> ::=
<quote> [ <character_representation>... ] <quote>
[ {<separator>... <quote>
[ <character_representation>... ]<quote>}... ]
<character_value_expression> ::= <concatenation> | <character_factor>
<circle> ::=
CIRCLE <left_paren>
<coord_sys> <comma>
<coordinates> <comma> <radius>
<right_paren>
<colon> ::= :
<column_name> ::= <identifier>
<column_name_list> ::= <column_name> [ { <comma> <column_name> }... ]
<column_reference> ::= [ <qualifier> <period> ] <column_name>
<comma> ::= ,
<comment> ::= <comment_introducer> [ <comment_character>... ] <newline>
<comment_character> ::= <nonquote_character> | <quote>
<comment_introducer> ::= <minus_sign><minus_sign> [<minus_sign>...]
<comp_operator> ::=
<equals_operator>
| <not_equals_operator>
| <less_than_operator>
| <greater_than_operator>
| <less_than_or_equals_operator>
| <greater_than_or_equals_operator>
<comparison_predicate> ::= <value_expression> <comp_operator>
<value_expression>
<concatenation> ::=
<character_value_expression> <concatenation_operator>
<character_factor>
<concatenation_operator> ::= ||
<contains_function> ::=
CONTAINS <left_paren> <geometry>
<comma> <geometry> <right_paren>
<coordinates> ::= <coord_lon> <comma> <coord_lat>
<coord_lat> ::= <numeric_value_expression>
!! generic latitude
<coord_lon> ::= <numeric_value_expression>
!! generic longitude
<coord_sys> ::= <string_value_expression>
<correlation_name> ::= <identifier>
<correlation_specification> ::= [ AS ] <correlation_name>
<default_function_prefix> ::=
!! The prefix is set by default to "udf_."
!! It should be possible to change the default prefix to accommodate
local preferences
<delimited_identifier> ::= <double_quote> <delimited_identifier_body>
<double_quote>
<delimited_identifier_body> ::= <delimited_identifier_part>?
<delimited_identifier_part> ::= <nondoublequote_character> |
<doublequote_symbol>
<delimiter_token> ::=
<character_string_literal>
| <delimited_identifier>
| <ADQL_special_character>
| <SQL_special_character>
| <not_equals_operator>
| <greater_than_or_equals_operator>
| <less_than_or_equals_operator>
| <concatenation_operator>
| <double_period>
| <left_bracket>
| <right_bracket>
<derived_column> ::= <value_expression> [ <as_clause> ]
<derived_table> ::= <table_subquery>
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<distance_function> ::
DISTANCE <left_paren> <point> <comma> <point> <right_paren>
<double_period> ::= ..
<double_quote> ::= "
<double_quote_symbol> ::= <double_quote><double_quote>
<equals_operator> ::= =
<exact_numeric_literal> ::=
<unsigned_integer> [ <period> [ <unsigned_integer> ] ]
| <period> <unsigned_integer>
<exists_predicate> ::= EXISTS <table_subquery>
<exponent> ::= <signed_integer>
<factor> ::= [ <sign> ] <numeric_primary>
<from_clause> ::= FROM <table_reference> [ { <comma>
<table_reference> }... ]
<general_literal> ::= <character_string_literal>
<general_set_function> ::=
<set_function_type> <left_paren> [ <set_quantifier> ]
<value_expression> <right_paren>
<geometry> ::= <point> | <circle> | <rectangle> | <polygon>
<greater_than_operator> ::= >
<greater_than_or_equals_operator> ::= >=
<group_by_clause> ::= GROUP BY <grouping_column_reference_list>
<grouping_column_reference> ::= <column_reference>
<grouping_column_reference_list> ::=
<grouping_column_reference> [ { <comma>
<grouping_column_reference> }... ]
<having_clause> ::= HAVING <search_condition>
<identifier> ::= <regular_identifier> | <delimited_identifier>
<in_predicate> ::= <value_expression> [ NOT ] IN <in_predicate_value>
<in_predicate_value> ::=
<table_subquery> | <left_paren> <in_value_list> <right_paren>
<in_value_list> ::=
<value_expression> { <comma> <value_expression> } ...
<intersects_function> ::=
INTERSECTS <left_paren> <geometry>
<comma> <geometry> <right_paren>
<join_column_list> ::= <column_name_list>
<join_condition> ::= ON <search_condition>
<join_specification> ::= <join_condition> | <named_columns_join>
<join_type> ::=
INNER
| <outer_join_type> [ OUTER ]
<joined_table> ::=
<qualified_join>
| <left_paren> <joined_table> <right_paren>
<keyword> ::= <SQL_reserved_word> | <ADQL_reserved_word>
<left_bracket> ::= [
<left_paren> ::= (
<less_than_operator> ::= <
<less_than_or_equals_operator> ::= <=
<like_predicate> ::=
<match_value> [ NOT ] LIKE <pattern>
<mantissa> ::= <exact_numeric_literal>
<match_value> ::= <character_value_expression>
<math_function> ::=
ABS <left_paren> <numeric_value_expression> <right_paren>
| CEILING <left_paren> <numeric_value_expression> <right_paren>
| DEGREES <left_paren> <numeric_value_expression> <right_paren>
| EXP <left_paren> <numeric_value_expression> <right_paren>
| FLOOR <left_paren> <numeric_value_expression> <right_paren>
| LOG <left_paren> <numeric_value_expression> <right_paren>
| PI <left_paren><right_paren>
| POWER <left_paren> <numeric_value_expression> <comma>
<unsigned_integer> <right_paren>
| RADIANS <left_paren> <numeric_value_expression> <right_paren>
| SQUARE <left_paren> <numeric_value_expression> <right_paren>
| SQRT <left_paren> <numeric_value_expression> <right_paren>
| LOG10 <left_paren> <numeric_value_expression> <right_paren>
| RAND <left_paren> [ <numeric_value_expression> ] <right_paren>
| ROUND <left_paren> <numeric_value_expression> <right_paren>
| TRUNCATE <left_paren> <numeric_value_expression> <right_paren>
<minus_sign> ::= -
<named_columns_join> ::= USING <left_paren> <join_column_list>
<right_paren>
<newline> ::= !! implementation defined end of line indicator
<nondelimiter_token> ::=
<regular_identifier>
| <keyword>
| <unsigned_numeric_literal>
<nondoublequote_character> ::= !! See syntax rules
<nonquote_character> ::= !! One ASCII character
<not_equals_operator> ::= <not_equals_operator1> |
<not_equals_operator2>
<not_equals_operator1> ::= <>
<not_equals_operator2> ::= !=
<null_predicate> ::= <column_reference> IS [ NOT ] NULL
<numeric_primary> ::= <value_expression_primary> |
<numeric_value_function>
<numeric_value_expression> ::=
<term>
| <numeric_value_expression> <plus_sign> <term>
| <numeric_value_expression> <minus_sign> <term>
<numeric_value_function> ::=
<trigonometric_function>
| <math_function>
| <user_defined_function>
| <system_defined_function>
<order_by_clause> ::= ORDER BY <sort_specification_list>
<ordering_specification> ::= ASC | DESC
<outer_join_type> ::= LEFT | RIGHT | FULL
<pattern> ::= <character_value_expression>
<percent> ::= %
<period> ::= .
<plus_sign> ::= +
<polygon> ::=
POLYGON <left_paren>
<coordsys> <comma>
<coordinates> <comma> <coordinates> <comma> <coordinates>
{ <comma> <coordinates> } ?
<right_paren>
<point> ::=
POINT <left_paren>
<coord_sys> <comma> <coordinates>
<right_paren>
<predicate> ::=
<comparison_predicate>
| <between_predicate>
| <in_predicate>
| <like_predicate>
| <null_predicate>
| <exists_predicate>
<qualified_join> ::=
<table_reference> [ NATURAL ] [ <join_type> ] JOIN
<table_reference> [ <join_specification> ]
<qualifier> ::= <table_name> | <correlation_name>
<query_expression> ::=
<query_specification>
| <joined_table>
<query_specification> ::=
SELECT [ <set_quantifier> ] [ <set_limit> ] <select_list>
<table_expression>
<question_mark> ::= ?
<quote> ::= '
<quote_symbol> ::= <quote> <quote>
<radius> ::= <numeric_value_expression>
<rectangle> ::=
RECTANGLE <left_paren>
<coord_sys> <comma>
<coordinates> <comma> <coordinates>
<right_paren>
<region_function> ::= <contains_function> | <intersects_function>
!! other functions could fit here: Equals, Disjoint, Touches, Crosses,
Within, Overlaps, Relate
<regular_identifier> ::=
<simple_Latin_letter>... [ { <underscore> | <simple_Latin_letter>
| <digit> } ... ]
<right_bracket> ::= ]
<right_paren> ::= )
<schema_name> ::= [ <catalog_name> <period> ] <unqualified_schema_name>
<search_condition> ::=
<boolean_term>
| <search_condition> OR <boolean_term>
<select_list> ::=
<asterisk>
| <select_sublist> [ { <comma> <select_sublist> }... ]
<select_sublist> ::= <derived_column> | <qualifier> <period> <asterisk>
<semicolon> ::= ;
<separator> ::= { <comment> | <space> | <newline> }...
<set_function_specification> ::=
COUNT <left_paren> <asterisk> <right_paren>
| <general_set_function>
<set_function_type> ::= AVG | MAX | MIN | SUM | COUNT
<set_limit> ::= TOP <unsigned_integer>
<set_quantifier> ::= DISTINCT | ALL
<sign> ::= <plus_sign> | <minus_sign>
<signed_integer> ::= [ <sign> ] <unsigned_integer>
<simple_Latin_letter> ::=
<simple_Latin_upper_case_letter>
| <simple_Latin_lower_case_letter>
<simple_Latin_lower_case_letter> ::=
a | b | c | d | e | f | g | h | i | j | k | l | m | n
| o | p | q | r | s | t | u | v | w | x | y | z
<simple_Latin_upper_case_letter> ::=
A | B | C | D | E | F | G | H | I | J | K | L | M | N
| O | P | Q | R | S | T | U | V | W | X | Y | Z
<solidus> ::= /
<sort_key> ::= <column_name> | <unsigned_integer>
<sort_specification> ::= <sort_key> [ <ordering_specification> ]
<sort_specification_list> ::= <sort_specification> [ { <comma>
<sort_specification> }... ]
<space> ::= !! space character here
<string_value_expression> ::= <character_value_expression>
<subquery> ::=
<left_paren> <query_expression> <right_paren>
<system_defined_function> ::= <distance_function> | <region_function>
!! others could fit here
<table_expression> ::=
<from_clause>
[ <where_clause> ]
[ <group_by_clause> ]
[ <having_clause> ]
[ <order_by_clause> ]
<table_name> ::= [ <schema_name> <period> ] <identifier>
<table_reference> ::=
<table_name> [ <correlation_specification> ]
| <derived_table> <correlation specification>
| <joined_table>
<table_subquery> ::= <subquery>
<term> ::=
<factor>
| <term> <asterisk> <factor>
| <term> <solidus> <factor>
<token> ::=
<nondelimiter_token>
| <delimiter_token>
<trigonometric_function> ::=
ACOS <left_paren> <numeric_value_expression> <right_paren>
| ASIN <left_paren> <numeric_value_expression> <right_paren>
| ATAN <left_paren> <numeric_value_expression> <right_paren>
| ATAN2 <left_paren> <numeric_value_expression> <comma>
<numeric_value_expression> <right_paren>
| COS <left_paren> <numeric_value_expression> <right_paren>
| COT <left_paren> <numeric_value_expression> <right_paren>
| SIN <left_paren> <numeric_value_expression> <right_paren>
| TAN <left_paren> <numeric_value_expression> <right_paren>
<underscore> ::= _
<unqualified_schema_name> ::= <identifier>
<unsigned_integer> ::= <digit> ...
<unsigned_literal> ::= <unsigned_numeric_literal> | <general_literal>
<unsigned_numeric literal> ::=
<exact_numeric_literal>
| <approximate_numeric_literal>
<unsigned_value_specification> ::= <unsigned_literal>
<user_defined_function> ::=
<user_defined_function_name>
<left_paren>
[ <user_defined_function_param> [ { <comma>
<user_defined_function_param> } ?] ]
<right_paren>
<user_defined_function_name> ::=
[ <default_function_prefix> ] <regular_identifier>
<user_defined_function_param> ::=
<numeric_value_expression> | <character_value_expression>
<value_expression> ::=
<numeric_value_expression>
| <string_value_expression>
<value_expression_primary> ::=
<unsigned_value_specification>
| <column_reference>
| <set_function_specification>
| <left_paren> <value_expression> <right_paren>
<vertical_bar> ::= |
<where_clause> ::= WHERE <search_condition>
_________________________________________
Pedro Osuna Alcalaya
European Space Agency (ESA)
European Space Astronomy Centre (ESAC)
Science Operations Department (SCI-O)
Science Archives and Computer Support Engineering Unit (SCI-OE)
e-mail: Pedro.Osuna-at-esa.int
Tel + 34 91 813 13 14 Fax: +34 91 813 11 72
_________________________________________
European Space Astronomy Centre (ESAC)
P.O. Box 78
E-28691 Villanueva de la Caņada
MADRID - SPAIN
================================================================================================
This message and any attachments are intended for the use of the addressee or addressees only. The
unauthorised disclosure, use, dissemination or copying (either in whole or in part) of its content
is prohibited. If you received this message in error, please delete it from your system and notify
the sender. E-mails can be altered and their integrity cannot be guaranteed. ESA shall not be liable
for any e-mail if modified.
=================================================================================================
Received on 2008-01-25Z16:24:00