Commit f2b3914ece0e4d350665f704fab23018fa4ae931
1 parent
09eaa620
Exists in
master
Add Queries.java, containing usual ADQL queries.
Showing
1 changed file
with
46 additions
and
0 deletions
Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/utils/Queries.java
0 → 100644
@@ -0,0 +1,46 @@ | @@ -0,0 +1,46 @@ | ||
1 | +/** | ||
2 | + * This file is a part of EpnTAPClient. | ||
3 | + * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | ||
4 | + * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | ||
5 | + * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | ||
6 | + * | ||
7 | + * This program is free software: you can | ||
8 | + * redistribute it and/or modify it under the terms of the GNU General Public License as published | ||
9 | + * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | ||
10 | + * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
11 | + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
12 | + * PURPOSE. See the GNU General Public License for more details. You should have received a copy of | ||
13 | + * the GNU General Public License along with this program. If not, see | ||
14 | + * <http://www.gnu.org/licenses/>. | ||
15 | + */ | ||
16 | +package eu.omp.irap.vespa.epntapclient.utils; | ||
17 | + | ||
18 | +/** | ||
19 | + * @author N. Jourdane | ||
20 | + */ | ||
21 | +public class Queries { | ||
22 | + | ||
23 | + /** Query to get all EPN-TAP services. */ | ||
24 | + public static final String GET_EPN_TAP_SERVICES = "SELECT ivoid, short_name, res_title, reference_url, base_role, role_name, " | ||
25 | + + "email, intf_index, access_url, standard_id, cap_type, cap_description, " | ||
26 | + + "std_version, res_subjects " | ||
27 | + + "FROM rr.resource AS res " | ||
28 | + + "NATURAL JOIN rr.interface " | ||
29 | + + "NATURAL JOIN rr.capability " | ||
30 | + + "NATURAL LEFT OUTER JOIN rr.res_role " | ||
31 | + + "NATURAL LEFT OUTER JOIN (SELECT ivoid, ivo_string_agg(res_subject, ', ') " | ||
32 | + + "AS res_subjects " | ||
33 | + + "FROM rr.res_subject GROUP BY ivoid) AS sbj " | ||
34 | + + "WHERE (base_role='contact' OR base_role='publisher' OR base_role IS NULL) " | ||
35 | + + "AND standard_id='ivo://ivoa.net/std/tap' AND intf_type='vs:paramhttp' " | ||
36 | + + "AND ((1=ivo_nocasematch(short_name, '%epn%') " | ||
37 | + + "OR 1=ivo_hasword(res_title, 'epn') OR 1=ivo_hasword(res_subjects, 'epn') " | ||
38 | + + "OR 1=ivo_nocasematch(ivoid, '%epn%') OR (base_role='publisher' " | ||
39 | + + "AND 1=ivo_nocasematch(role_name, '%epn%'))))"; | ||
40 | + | ||
41 | + /** Query to get all services of the registry. */ | ||
42 | + public static final String GET_ALL_SERVICES = "SELECT ivoid, short_name, res_title, res_description, accessurl, ntable " | ||
43 | + + "FROM (SELECT ivoid, accessurl, COUNT ( ivoid ) AS ntable FROM glots.services " | ||
44 | + + "JOIN glots.tables USING ( ivoid ) GROUP BY ivoid) AS t " | ||
45 | + + "JOIN rr.resource USING ( ivoid )"; | ||
46 | +} |