150 likes | 227 Views
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
E N D
IVOA Interoperalibity 2003 JVO Query Language Naoki Yasuda (NAOJ/Japanese VO)
IVOA Interoperalibity 2003 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 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 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 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
Catalog A Catalog B Catalog C IVOA Interoperalibity 2003 XMATCH • XMATCH(A, B, !C, …) < 3 arcsec • Select objects whose celestial positions in catalog A and catalog B coincide within the tolerance of 3 arcsec but not found in catalog C.
IVOA Interoperalibity 2003 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 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 Sample Query create view myEROtable as select 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 Kimage from SUBARU s, 2MASS t, SUBARU.R sr, 2MASS.K tk where 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 Sample Query create view myEROtable as select 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 Kimage from SUBARU s, 2MASS t, SUBARU.R sr, 2MASS.K tk where 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) multiple DB constraints common constraint
IVOA Interoperalibity 2003 First count the number of objects which satisfies common constraints select count(*) from SUBARU s whereBOX(POINT(201.0, 27.4, J2000), 1.0, 1.0) count 1 select count(*) from 2MASS t Where BOX(POINT(201.0, 27.4, J2000), 1.0, 1.0) count 2 According to the counts, server access sequence will determined count 1 count 2 count 1 count 2 > < SUBARU 2MASS SUBARU 2MASS
IVOA Interoperalibity 2003 select s.ra, s.dec, s.Rmag from SUBARU s whereBOX(POINT(201.0, 27.4, J2000), 1.0, 1.0) select t.Kmag from 2MASS t whereXMATCH(s,t) < 3 arcsec and (s.Rmag-t.Kmag) > 6 mag Output Table A select sr.BOX(POINT(s.ra, s.dec, J2000),…) as Rimage from SUBARU.R sr Output Table B select tk.BOX(POINT(s.ra, s.dec, J2000),…) as Kimage from 2MASS.K tk Output Table C Result Table
IVOA Interoperalibity 2003 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 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.a from SUBARU.B x, SUBARU.B y where (DIFF(x.obs_date, Y.obs_date) > 30 days) and (s.AREA() OVERLAP t.AREA())) as a
AREA info Divide into pieces s t a1 a2 a3 cutout request s.AREA() t.AREA() OVERLAP IVOA Interoperalibity 2003