jvo query language
DESCRIPTION
JVO Query Language. Naoki Yasuda (NAOJ/Japanese VO). Basic Functions of JVOQL. Query and retrieve required data Describe query condition Describe what to retrieve Describe analyses on retrieved data Federate distributed databases Describe queries for multi databases in one unit - PowerPoint PPT PresentationTRANSCRIPT
IVOA Interoperalibity 2003 1
JVO Query Language
Naoki Yasuda (NAOJ/Japanese VO)
IVOA Interoperalibity 2003 2
Basic Functions of JVOQL
• Query and retrieve required data– Describe query condition– Describe what to retrieve– Describe analyses on retrieved data
• Federate distributed databases– Describe queries for multi databases in one unit
• Federate catalogs (tables) and images– Need not to discriminate catalogs and images
IVOA Interoperalibity 2003 3
Requirement for JVOQL
• Platform independent– VO will be constructed as heterogeneous
system– Query must be transferable among systems
• Sufficient to describe astronomical queries– QL must describe what astronomers want to do
• Easy to understand for human and machine– Necessary for debugging and programming
IVOA Interoperalibity 2003 4
Format of JVOQL
• JVOQL adopted SQL as a base language– SQL is a well-defined query language optimized for
relational database– SQL is easy to understand for human and machine– Backend queries can be done by DBMS
• Astronomy specific functions are defined as extensions for SQL– SQL is not sufficient enough for astronomical queries
• XMATCH (Cross Matching)• AREA (Image cutout / Celestial area limit)
IVOA Interoperalibity 2003 5
Extension 1 : Cross-Matching
• Astronomical objects will be identified mainly based on its celestial position (and distance from the earth).
• Distributed databases can be related through celestial positions.
• Similar to ‘join’ in SQL– where A.id = B.id
– where XMATCH(A, B) < 3 arcsec
IVOA Interoperalibity 2003 6
XMATCH
• XMATCH(A, B, !C, …) < 3 arcsec– Select objects whose celestial positions in catal
og A and catalog B coincide within the tolerance of 3 arcsec but not found in catalog C.
Catalog A Catalog B Catalog C
IVOA Interoperalibity 2003 7
Extension 2 : Image cutout
• In most cases, astronomers request images associated with objects selected from catalogs.– Cutout area will be defined as celestial area.
• Celestial area definition can be used to limit searching celestial area.
• Image cutout can be easily expressed like SQL– select A.ra, A.dec, A.BOX(POINT(A.ra, A.dec, J2000), 3 arcmin, 3 arcmin)
IVOA Interoperalibity 2003 8
AREA
• POINT(long, lat, coord) will define a point on the celestial sphere.– coord could be J2000, B1950, GAL, …
• AREA will be defined based on POINT– BOX(POINT(…), width, height[, PA])CIRCLE(POINT(…), radius)OVAL(POINT(…), rad1, rad2[, PA])TRIANGLE(POINT(…), POINT(…), POINT(…))
IVOA Interoperalibity 2003 9
Sample Querycreate view myEROtable asselect s.ra, s.dec, s.Rmag, t.Kmag, sr.BOX(POINT(s.ra, s.dec, J2000), 1 arcmin, 1 arcmin) as Rimage, tk.BOX(POINT(s.ra, s.dec, J2000), 1 arcmin, 1 arcmin) as Kimagefrom SUBARU s, 2MASS t, SUBARU.R sr, 2MASS.K tkwhere XMATCH(s,t) < 3 arcsec and (s.Rmag-t.Kmag) > 6 mag and BOX(POINT(201.0 deg, 27.4 deg, J2000), 1 deg, 1 deg)
IVOA Interoperalibity 2003 10
Sample Querycreate view myEROtable asselect s.ra, s.dec, s.Rmag, t.Kmag, sr.BOX(POINT(s.ra, s.dec, J2000), 1 arcmin, 1 arcmin) as Rimage, tk.BOX(POINT(s.ra, s.dec, J2000), 1 arcmin, 1 arcmin) as Kimagefrom SUBARU s, 2MASS t, SUBARU.R sr, 2MASS.K tkwhere XMATCH(s,t) < 3 arcsec and (s.Rmag-t.Kmag) > 6 mag and BOX(POINT(201.0 deg, 27.4 deg, J2000), 1 deg, 1 deg)
common constraint
multiple DB constraints
IVOA Interoperalibity 2003 11
select count(*)from SUBARU swhere BOX(POINT(201.0, 27.4, J2000), 1.0, 1.0)
select count(*)from 2MASS tWhere BOX(POINT(201.0, 27.4, J2000), 1.0, 1.0)
count 1
count 2
First count the number of objects which satisfies common constraints
According to the counts, server access sequence will determined
count 1 count 2>
2MASS
SUBARU
count 1 count 2<
2MASS
SUBARU
IVOA Interoperalibity 2003 12
select s.ra, s.dec, s.Rmagfrom SUBARU swhere BOX(POINT(201.0, 27.4, J2000), 1.0, 1.0)
select t.Kmagfrom 2MASS twhere XMATCH(s,t) < 3 arcsec and (s.Rmag-t.Kmag) > 6 mag
select sr.BOX(POINT(s.ra, s.dec, J2000),…) as Rimagefrom SUBARU.R sr
select tk.BOX(POINT(s.ra, s.dec, J2000),…) as Kimagefrom 2MASS.K tk
Output Table A
Output Table B
Output Table C
Result Table
IVOA Interoperalibity 2003 13
Extension of AREA
• Usual queries are for catalogs• There is a need for query for area like
– Search for area where V band, I band, and K band observations are available.
– Search for area where observed in B band more than 3 times and their intervals are more than 1 month.
– …
• These queries will expand the usefulness of astronomical data archives.
IVOA Interoperalibity 2003 14
Sample Queries
select s.a, t.a, ...from SUBARU.R s, 2MASS.K t, ...where (s.AREA() OVERLAP t.AREA()) as a
select x.a, y.afrom SUBARU.B x, SUBARU.B ywhere (DIFF(x.obs_date, Y.obs_date) > 30 days) and (s.AREA() OVERLAP t.AREA())) as a
IVOA Interoperalibity 2003 15
s.AREA() t.AREA()
AREA info
OVERLAP
cutout request
Div
ide
into
pi
eces
s ta1a2a3