Accessing tables and catalogs through the Astronomical Data Query Language (ADQL)
ADQL (Astronomical Data Query Language) is the language used to retrieve data like observations, images, or spectra from VO (Virtual Observatory) services. It is based on SQL (Structured Query Language) which is a language used to retrieve information from tables stored in a database.
(References: ADQL 2.1 and SQL 92)
In Euclid the ADQL form option is available in the Search tab:
Basic syntax
In ADQL/SQL you write queries to the database. A query is compound of the table columns you want to retrieve (the SELECT part), the table or tables that store the data (the FROM part) and the conditions to restrict the data you obtain (the WHERE part). E.g.
SELECT <columns> FROM <tables> WHERE <conditions>
On the left side of the ADQL page you will see a list of schema names, which is basically a tree of tables. To get the information from a specific table you need to provide the schema name dot table name. To access some tables, like mer_final_cat_sc8, the user needs to be logged in. For instance, if you want to obtain Right Ascension and Declination of top 50 items from the table mer_final_cat_sc8, which is located inside the sascat_sc8 schema, you may write:
SELECT TOP
50
right_ascension, declination FROM sascat_sc8.mer_final_cat_sc8
'right_ascension' is the column name of Right Ascension in mer_final_cat_sc8 table.
'declination' is the column name of Declination in mer_final_cat_sc8 table.
Top results are random, if you execute again the same query it will show different results. One way to avoid it is to sort the results by the object_id in ascending way. Probably, you want to obtain also the object identification, that can later be used with Datalink to get spectra. So you can modify the query as follows:
SELECT top
50
object_id, right_ascension, declination FROM sascat_sc8.mer_final_cat_sc8 ORDER BY object_id ASC
Or to replace the list of fields with an asterisk *, to retrieve all columns in the table. In TAP+, you may obtain all the columns and descriptions of a table executing the following command (or opening the link in a browser):
curl
"https://eas.esac.esa.int/tap-server/tap/tables?table=sascat_sc8.mer_final_cat_sc8"
Now, suppose you are interested in an specific region (e.g. ra=225, dec=25, radius=0.05 decimal deg). So you want to restrict the results to that region. In order to do that, you may execute a 'cone search' to obtain all the objects where right_ascension, declination are inside a cone:
SELECT object_id, right_ascension, declination FROM sascat_sc8.mer_final_cat_sc8
WHERE
1
=CONTAINS(POINT(
'ICRS'
,right_ascension,declination),
CIRCLE(
'ICRS'
,
225
,
25
,
0.05
))
(You may read the ADQL reference for a description of the syntax and the list of functions that can be used).
Selecting complex data
You are not restricted to obtain column values only. You can obtain complex values too.
One way to create a complex query could be to use the CATALOGUES tab to create the basic query visually. Then you should press Show query button to show the query as ADQL in the ADQL FORM. And there, you can modify and execute it.
For instance, you may want to obtain the distance of each source to the center of an specific region. Then, you may type:
SELECT object_id, right_ascension, declination, DISTANCE(POINT(
'ICRS'
,right_ascension,declination),
POINT(
'ICRS'
,
225
,
25
)) AS dist
FROM sascat_sc8.mer_final_cat_sc8
WHERE
1
=CONTAINS(POINT(
'ICRS'
,right_ascension, declination),CIRCLE(
'ICRS'
,
225
,
25
,
0.05
))
'object_id' , 'right_ascension' and 'declination' are the Source Identifier, Right ascension and Declination of each item of the mer_final_cat_sc8 table.
'DISTANCE(POINT('ICRS',right_ascension, declination), POINT('ICRS',225,25)) AS dist' is an on the fly created column, with the name 'dist' that contains the distance of the item to the specified point.
Clicking on the icon to display the top results will show the following window: