voruby 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. data/LICENSE +339 -0
  2. data/REQUIREMENTS +4 -0
  3. data/Rakefile.rb +296 -0
  4. data/lib/voruby/adql/adql.rb +2735 -0
  5. data/lib/voruby/adql/ext.rb +15 -0
  6. data/lib/voruby/adql/loader.rb +5 -0
  7. data/lib/voruby/adql/operations.rb +54 -0
  8. data/lib/voruby/adql/parser.rb +160 -0
  9. data/lib/voruby/adql/transforms.rb +573 -0
  10. data/lib/voruby/ext.rb +17 -0
  11. data/lib/voruby/loader.rb +4 -0
  12. data/lib/voruby/misc/propertyfile.rb +36 -0
  13. data/lib/voruby/plastic/applications.rb +174 -0
  14. data/lib/voruby/plastic/constants.rb +30 -0
  15. data/lib/voruby/plastic/loader.rb +10 -0
  16. data/lib/voruby/plastic/plastic.rb +1 -0
  17. data/lib/voruby/resources/conesearch/conesearch.rb +9 -0
  18. data/lib/voruby/resources/conesearch/conesearch_v0_2.rb +55 -0
  19. data/lib/voruby/resources/conesearch/conesearch_v0_3.rb +50 -0
  20. data/lib/voruby/resources/conesearch/conesearch_v1_0.rb +72 -0
  21. data/lib/voruby/resources/conesearch/loader.rb +4 -0
  22. data/lib/voruby/resources/loader.rb +50 -0
  23. data/lib/voruby/resources/nodes.rb +190 -0
  24. data/lib/voruby/resources/openskynode/loader.rb +4 -0
  25. data/lib/voruby/resources/openskynode/openskynode.rb +9 -0
  26. data/lib/voruby/resources/openskynode/openskynode_v0_1.rb +54 -0
  27. data/lib/voruby/resources/sia/loader.rb +5 -0
  28. data/lib/voruby/resources/sia/sia.rb +9 -0
  29. data/lib/voruby/resources/sia/sia_v0_6.rb +90 -0
  30. data/lib/voruby/resources/sia/sia_v0_7.rb +89 -0
  31. data/lib/voruby/resources/sia/sia_v1_0.rb +122 -0
  32. data/lib/voruby/resources/stsci.rb +59 -0
  33. data/lib/voruby/resources/vodataservice/coverage_v0_2.rb +195 -0
  34. data/lib/voruby/resources/vodataservice/coverage_v0_3.rb +158 -0
  35. data/lib/voruby/resources/vodataservice/loader.rb +5 -0
  36. data/lib/voruby/resources/vodataservice/vodataservice.rb +9 -0
  37. data/lib/voruby/resources/vodataservice/vodataservice_v0_4.rb +189 -0
  38. data/lib/voruby/resources/vodataservice/vodataservice_v0_5.rb +163 -0
  39. data/lib/voruby/resources/vodataservice/vodataservice_v1_0.rb +221 -0
  40. data/lib/voruby/resources/voregistry/loader.rb +4 -0
  41. data/lib/voruby/resources/voregistry/voregistry.rb +9 -0
  42. data/lib/voruby/resources/voregistry/voregistry_v0_2.rb +40 -0
  43. data/lib/voruby/resources/voregistry/voregistry_v0_3.rb +30 -0
  44. data/lib/voruby/resources/voregistry/voregistry_v1_0.rb +86 -0
  45. data/lib/voruby/resources/voresource/loader.rb +17 -0
  46. data/lib/voruby/resources/voresource/voresource.rb +9 -0
  47. data/lib/voruby/resources/voresource/voresource_v0_10.rb +322 -0
  48. data/lib/voruby/resources/voresource/voresource_v0_9.rb +405 -0
  49. data/lib/voruby/resources/voresource/voresource_v1_0.rb +230 -0
  50. data/lib/voruby/services/ext.rb +11 -0
  51. data/lib/voruby/services/gestalt/footprint.rb +95 -0
  52. data/lib/voruby/services/gestalt/wcs_fixer.rb +105 -0
  53. data/lib/voruby/services/gestalt/wesix.rb +155 -0
  54. data/lib/voruby/services/loader.rb +7 -0
  55. data/lib/voruby/services/registry/registry.rb +53 -0
  56. data/lib/voruby/services/resolver/resolver.rb +35 -0
  57. data/lib/voruby/sesame/loader.rb +6 -0
  58. data/lib/voruby/sesame/sesame_v1_0.rb +64 -0
  59. data/lib/voruby/simple/loader.rb +6 -0
  60. data/lib/voruby/simple/parameters.rb +196 -0
  61. data/lib/voruby/simple/sap.rb +446 -0
  62. data/lib/voruby/spacetime/loader.rb +3 -0
  63. data/lib/voruby/spacetime/spacetime.rb +607 -0
  64. data/lib/voruby/stc/coords_v1_20.rb +900 -0
  65. data/lib/voruby/stc/loader.rb +55 -0
  66. data/lib/voruby/stc/region_v1_20.rb +274 -0
  67. data/lib/voruby/stc/stc_v1_20.rb +1196 -0
  68. data/lib/voruby/util.rb +27 -0
  69. data/lib/voruby/voevent/loader.rb +7 -0
  70. data/lib/voruby/voevent/voevent_v1_0.rb +213 -0
  71. data/lib/voruby/voevent/voevent_v1_1.rb +196 -0
  72. data/lib/voruby/votables/chandra.rb +410 -0
  73. data/lib/voruby/votables/cnoc.rb +393 -0
  74. data/lib/voruby/votables/data.rb +179 -0
  75. data/lib/voruby/votables/galex.rb +390 -0
  76. data/lib/voruby/votables/hst.rb +391 -0
  77. data/lib/voruby/votables/int.rb +391 -0
  78. data/lib/voruby/votables/libxml_parser.rb +411 -0
  79. data/lib/voruby/votables/libxml_votable.rb +67 -0
  80. data/lib/voruby/votables/loader.rb +10 -0
  81. data/lib/voruby/votables/meta.rb +763 -0
  82. data/lib/voruby/votables/misc.rb +51 -0
  83. data/lib/voruby/votables/nsa.rb +393 -0
  84. data/lib/voruby/votables/nsar3.rb +410 -0
  85. data/lib/voruby/votables/rexml_parser.rb +408 -0
  86. data/lib/voruby/votables/rexml_votable.rb +67 -0
  87. data/lib/voruby/votables/sdss.rb +393 -0
  88. data/lib/voruby/votables/transforms.rb +388 -0
  89. data/lib/voruby/votables/tree.rb +45 -0
  90. data/lib/voruby/votables/types.rb +391 -0
  91. data/lib/voruby/votables/votable.rb +630 -0
  92. data/lib/voruby/votables/xmm.rb +394 -0
  93. data/test/adql/test1.adql +49 -0
  94. data/test/adql/test2.adql +51 -0
  95. data/test/adql/test3.adql +81 -0
  96. data/test/adql/test4.adql +53 -0
  97. data/test/adql/test5.adql +55 -0
  98. data/test/adql/test6.adql +18 -0
  99. data/test/adql/test7.adql +48 -0
  100. data/test/adql/unittest.rb +1672 -0
  101. data/test/plastic/test.rb +44 -0
  102. data/test/plastic/test.vot +5385 -0
  103. data/test/plastic/unittest.rb +66 -0
  104. data/test/resources/conesearch/conesearch_v0_3.xml +31 -0
  105. data/test/resources/conesearch/conesearch_v1_0.xml +86 -0
  106. data/test/resources/conesearch/unittest_v0_3.rb +22 -0
  107. data/test/resources/conesearch/unittest_v1_0.rb +24 -0
  108. data/test/resources/openskynode/open_sky_node_v0_1.xml +32 -0
  109. data/test/resources/openskynode/unittest_v0_1.rb +31 -0
  110. data/test/resources/sia/simple_image_access_v0_7.xml +36 -0
  111. data/test/resources/sia/simple_image_access_v1_0.xml +122 -0
  112. data/test/resources/sia/unittest_v0_7.rb +24 -0
  113. data/test/resources/sia/unittest_v1_0.rb +29 -0
  114. data/test/resources/stsci.xml +336 -0
  115. data/test/resources/unittest_stsci.rb +25 -0
  116. data/test/resources/vodataservice/catalog_service_resource_v1_0.xml +128 -0
  117. data/test/resources/vodataservice/data_collection_resource_v0_5.xml +54 -0
  118. data/test/resources/vodataservice/data_collection_resource_v1_0.xml +117 -0
  119. data/test/resources/vodataservice/data_service_resource_v1_0.xml +115 -0
  120. data/test/resources/vodataservice/sky_service_resource_v0_10.xml +45 -0
  121. data/test/resources/vodataservice/table_service_resource_v1_0.xml +122 -0
  122. data/test/resources/vodataservice/tabular_sky_service_resource_v0_10.xml +60 -0
  123. data/test/resources/vodataservice/unittest_v0_5.rb +126 -0
  124. data/test/resources/vodataservice/unittest_v1_0.rb +151 -0
  125. data/test/resources/voregistry/authority_resource_v0_3.xml +20 -0
  126. data/test/resources/voregistry/authority_resource_v1_0.xml +82 -0
  127. data/test/resources/voregistry/registry_service_v0_3.xml +20 -0
  128. data/test/resources/voregistry/registry_service_v1_0.xml +107 -0
  129. data/test/resources/voregistry/unittest_v0_3.rb +31 -0
  130. data/test/resources/voregistry/unittest_v1_0.rb +34 -0
  131. data/test/resources/voresource/organisation_resource_v1_0.xml +90 -0
  132. data/test/resources/voresource/resource_organisation_v0_10.xml +22 -0
  133. data/test/resources/voresource/resource_service_v0_10.xml +19 -0
  134. data/test/resources/voresource/resource_v0_10.xml +19 -0
  135. data/test/resources/voresource/resource_v1_0.xml +79 -0
  136. data/test/resources/voresource/service_resource_v1_0.xml +91 -0
  137. data/test/resources/voresource/unittest_v0_10.rb +61 -0
  138. data/test/resources/voresource/unittest_v0_9.rb +4 -0
  139. data/test/resources/voresource/unittest_v1_0.rb +190 -0
  140. data/test/services/gestalt/unittest.rb +74 -0
  141. data/test/services/registry/unittest.rb +34 -0
  142. data/test/services/resolver/unittest.rb +38 -0
  143. data/test/simple/unittest.rb +46 -0
  144. data/test/spacetime/unittest.rb +39 -0
  145. data/test/stc/catalog_entry_location_v1_20.xml +112 -0
  146. data/test/stc/obs_data_location_v1_20.xml +108 -0
  147. data/test/stc/search_location_v1_20.xml +54 -0
  148. data/test/stc/stc_resource_profile_v1_20.xml +60 -0
  149. data/test/stc/unittest_v1_20.rb +620 -0
  150. data/test/voevent/unittest_v1_0.rb +79 -0
  151. data/test/voevent/unittest_v1_1.rb +70 -0
  152. data/test/voevent/voevent_v1_0.xml +96 -0
  153. data/test/voevent/voevent_v1_1.xml +76 -0
  154. data/test/votables/test.vot +366 -0
  155. data/test/votables/unittest.rb +54 -0
  156. metadata +256 -0
@@ -0,0 +1,394 @@
1
+ # A set of classes designed to read and manipulate
2
+ # especific VOTables[http://www.ivoa.net/Documents/latest/VOT.html].
3
+ # This class represents a XMM VOTable.
4
+
5
+ require 'voruby/votables/votable'
6
+
7
+ module VORuby
8
+ module VOTables
9
+
10
+ module VOTable
11
+ class XMMVOTable < VOTable
12
+
13
+ # Our object's contructor
14
+ # [_votable:_]
15
+ # The VOTable object
16
+ def initialize(votable)
17
+ super(votable.id, votable.version, votable.description,
18
+ votable.definitions, votable.coosys, votable.params,
19
+ votable.info, votable.resources)
20
+ end
21
+
22
+ # Find a field in XMM configuration file given a key.
23
+ # Returns a hash with the field's attributes
24
+ # [_key_:]
25
+ # The key indexing on field's attribute. This key is the same
26
+ # UCD, because I guess that XMM always uses the UCDs on its
27
+ # fields
28
+ def find_field_in_conf_file(key)
29
+ xmm_field = {'id'=> nil, 'name'=> nil, 'ucd'=> nil}
30
+
31
+ if key != nil
32
+ XMM_ARCHIVE_CONFIG.each do |archive|
33
+ archive['votable_fields'].each do |field|
34
+ if field['key'] == key
35
+ xmm_field['id'] = field['id'] if field['id'] != 'nil'
36
+ xmm_field['name'] = field['name'] if field['name'] != 'nil'
37
+ xmm_field['ucd'] = field['ucd'] if field['ucd'] != 'nil'
38
+ break
39
+ end
40
+ end
41
+ end
42
+ end
43
+ return xmm_field
44
+ end
45
+
46
+ # Find the column number(s) associated with the
47
+ # VOX:imageAccessReference UCD. XMM uses a DATA_LINK UCD
48
+ # instead of VOX:imageAccessReference.
49
+ # Returns a list of column positions.
50
+ def image_access_reference_columns()
51
+ xmm_ucd_access = find_field_in_conf_file('DATA_LINK')['ucd']
52
+
53
+ if find_columns(xmm_ucd_access).first != nil
54
+ find_columns(xmm_ucd_access).first
55
+ end
56
+ end
57
+
58
+ def image_ra_columns
59
+ ucd_ra = find_field_in_conf_file('POS_EQ_RA_MAIN')['ucd']
60
+
61
+ if find_columns(ucd_ra).first != nil
62
+ find_columns(ucd_ra).first
63
+ end
64
+ end
65
+
66
+ def image_dec_columns
67
+ ucd_dec = find_field_in_conf_file('POS_EQ_DEC_MAIN')['ucd']
68
+
69
+ if find_columns(ucd_dec).first != nil
70
+ find_columns(ucd_dec).first
71
+ end
72
+ end
73
+
74
+ def image_filter_columns
75
+ #ucd_filter = find_field_in_conf_file('')['ucd']
76
+
77
+ #if find_columns(ucd_filter).first != nil
78
+ # find_columns(ucd_filter).first
79
+ #end
80
+ end
81
+
82
+ def image_date_obs_columns
83
+ ucd_date_obs = find_field_in_conf_file('VOX:OBS_START_TIME')['ucd']
84
+
85
+ if find_columns(ucd_date_obs).first != nil
86
+ find_columns(ucd_date_obs).first
87
+ end
88
+ end
89
+
90
+ def image_telescope_columns
91
+ #ucd_telescope = find_field_in_conf_file('')['ucd']
92
+
93
+ #if find_columns(ucd_telescope).first != nil
94
+ # find_columns(ucd_telescope).first
95
+ #end
96
+ end
97
+
98
+ def image_survey_columns
99
+ #ucd_survey = find_field_in_conf_file('')['ucd']
100
+
101
+ #if find_columns(ucd_survey).first != nil
102
+ # find_columns(ucd_survey).first
103
+ #end
104
+ end
105
+
106
+ def image_instrument_columns
107
+ #ucd_instrument = find_field_in_conf_file('')['ucd']
108
+
109
+ #if find_columns(ucd_instrument).first != nil
110
+ # find_columns(ucd_instrument).first
111
+ #end
112
+ end
113
+
114
+ def image_sky_columns
115
+ #ucd_sky = find_field_in_conf_file('')['ucd']
116
+
117
+ #if find_columns(ucd_sky).first != nil
118
+ # find_columns(ucd_sky).first
119
+ #end
120
+ end
121
+
122
+ def image_zeropoint_columns
123
+ #ucd_zeropoint = find_field_in_conf_file('')['ucd']
124
+
125
+ #if find_columns(ucd_zeropoint).first != nil
126
+ # find_columns(ucd_zeropoint).first
127
+ #end
128
+ end
129
+
130
+ def image_seeing_columns
131
+ #ucd_seeing = find_field_in_conf_file('')['ucd']
132
+
133
+ #if find_columns(ucd_seeing).first != nil
134
+ # find_columns(ucd_seeing).first
135
+ #end
136
+ end
137
+
138
+ def image_depth_columns
139
+ #ucd_depth = find_field_in_conf_file('')['ucd']
140
+
141
+ #if find_columns(ucd_depth).first != nil
142
+ # find_columns(ucd_depth).first
143
+ #end
144
+ end
145
+
146
+ def image_exptime_columns
147
+ #ucd_exptime = find_field_in_conf_file('')['ucd']
148
+
149
+ #if find_columns(ucd_exptime).first != nil
150
+ # find_columns(ucd_exptime).first
151
+ #end
152
+ end
153
+
154
+ # Create headers for HTML table
155
+ # [_res_:]
156
+ # The resource from which to extract the table in question.
157
+ # [_tbl_:]
158
+ # The table inside the resource from which to extract the rows in question.
159
+ # [_infer_add_to_cart_ref_:]
160
+ #
161
+ # [_add_to_cart_header_value_:]
162
+ #
163
+ # [_infer_access_ref_:]
164
+ # Link the access reference URL associated with a row.
165
+ # [_access_ref_header_value_:]
166
+ # For the access reference column, place this value in the header.
167
+ # [_access_ref_col_:]
168
+ # A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
169
+ # [_header_class_:]
170
+ # The class to assign the header of the HTML table.
171
+ def create_headers(res, tbl,
172
+ infer_add_to_cart_ref, add_to_cart_header_value,
173
+ infer_access_ref, access_ref_header_value, access_ref_col,
174
+ header_class)
175
+
176
+ headers = Array.new
177
+ thead = "<thead class=\"#{header_class}\">\n"
178
+
179
+ thead << "<tr>\n"
180
+ if infer_add_to_cart_ref
181
+ thead << "<th>#{add_to_cart_header_value}</th>\n"
182
+ headers.push('&nbsp')
183
+ end
184
+ if infer_access_ref
185
+ thead << "<th>#{access_ref_header_value}</th>\n"
186
+ headers.push('&nbsp')
187
+ end
188
+ col_count = 0
189
+ fields(res, tbl).each do |field|
190
+ field_archive = find_field_in_conf_file(field.ucd.value())
191
+ field_ucd = field_archive['ucd']
192
+ if infer_access_ref and col_count == access_ref_col
193
+ headers[1] = field_ucd if field_ucd != 'nil'
194
+ else
195
+ thead << "<th>#{field_archive['name']}</th>\n"
196
+ if field_ucd != 'nil'
197
+ headers.push(field_ucd)
198
+ else
199
+ headers.push('&nbsp')
200
+ end
201
+ end
202
+ col_count += 1
203
+ end
204
+ thead << " </tr>\n"
205
+
206
+ thead << "<tr>\n"
207
+ headers.each do |h|
208
+ thead << "<th>#{h}</th>\n"
209
+ end
210
+ thead << "</tr>\n"
211
+
212
+ thead << "</thead>"
213
+
214
+ return thead
215
+ end
216
+
217
+ def create_add_to_cart_link(link_ref, columns)
218
+ access_ref_col = image_access_reference_columns()
219
+ link_ref << '&resource=' + CGI.escape(columns[access_ref_col].value).to_s if access_ref_col
220
+ ra_col = image_ra_columns()
221
+ link_ref << '&rac=' + columns[ra_col].value.to_s if ra_col
222
+ dec_col = image_dec_columns()
223
+ link_ref << '&decc=' + columns[dec_col].value.to_s if dec_col
224
+ filter_col = image_filter_columns()
225
+ link_ref << '&filter=' + columns[filter_col].value.to_s if filter_col
226
+ date_obs_col = image_date_obs_columns()
227
+ link_ref << '&date_obs=' + columns[date_obs_col].value.to_s if date_obs_col
228
+ teles_col = image_telescope_columns()
229
+ link_ref << '&telescop=' + columns[teles_col].value.to_s if teles_col
230
+ survey_col = image_survey_columns()
231
+ link_ref << '&survey=' + columns[survey_col].value.to_s if survey_col
232
+ instrum_col = image_instrument_columns()
233
+ link_ref << '&instrument=' + columns[instrum_col].value.to_s if instrum_col
234
+ sky_col = image_sky_columns()
235
+ link_ref << '&sky=' + columns[sky_col].value.to_s if sky_col
236
+ zerop_col = image_zeropoint_columns()
237
+ link_ref << '&zeropoint=' + columns[zerop_col].value.to_s if zerop_col
238
+ seeing_col = image_seeing_columns()
239
+ link_ref << '&seeing=' + columns[seeing_col].value.to_s if seeing_col
240
+ depth_col = image_depth_columns()
241
+ link_ref << '&depth=' + columns[depth_col].value.to_s if depth_col
242
+ exptime_col = image_exptime_columns()
243
+ link_ref << '&exptime=' + columns[exptime_col].value.to_s if exptime_col
244
+
245
+ return link_ref
246
+ end
247
+
248
+ # Create body for HTML table
249
+ # [_res_:]
250
+ # The resource from which to extract the table in question.
251
+ # [_tbl_:]
252
+ # The table inside the resource from which to extract the rows in question.
253
+ # [_infer_add_to_cart_ref_:]
254
+ #
255
+ # [_add_to_cart_link_value_:]
256
+ #
257
+ # [_add_to_cart_link_ref_:]
258
+ #
259
+ # [_infer_access_ref_:]
260
+ # Link the access reference URL associated with a row.
261
+ # [_access_ref_link_value_:]
262
+ # For the access reference column, link this word.
263
+ # [_access_ref_col_:]
264
+ # A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
265
+ # [_body_class_:]
266
+ # The class to assign the body of the HTML table.
267
+ # [_row_classes_:]
268
+ # The class to assign the HTML table body rows.
269
+ def create_body(res, tbl,
270
+ infer_add_to_cart_ref, add_to_cart_link_value, add_to_cart_link_ref,
271
+ infer_access_ref, access_ref_link_value, access_ref_col,
272
+ body_class, row_classes)
273
+
274
+ tbody = "<tbody class=\"#{body_class}\">\n"
275
+ row_count = 0
276
+ rows(res, tbl).each do |tr|
277
+ tbody << "<tr class=\"#{row_classes[row_count % 2]}\">\n"
278
+
279
+ # Specially mark up the first column to link to the image.
280
+ columns = tr.tds()
281
+
282
+ if infer_add_to_cart_ref
283
+ archive = add_to_cart_link_ref.slice(add_to_cart_link_ref.index('&archive='), add_to_cart_link_ref.length)
284
+ archive = archive.slice('&archive='.length, archive.length)
285
+ archive = archive.slice(0, archive.index('&')) if archive.index('&')
286
+ link_id = 'add_' + archive.to_s + '_' + row_count.to_s
287
+ url = create_add_to_cart_link(add_to_cart_link_ref, columns)
288
+ js = "new Ajax.Request('#{url}', " +
289
+ " {method: 'post', " +
290
+ " onComplete: function(request){Element.hide('#{link_id}');}});"
291
+ tbody << "<td><a id=\"#{link_id}\" href=\"javascript:void(0);\" " +
292
+ "onclick=\"#{js};return false;\"" +
293
+ ">#{add_to_cart_link_value}</a></td>\n"
294
+ end
295
+ if infer_access_ref
296
+ link_ref = columns[access_ref_col].value
297
+ tbody << "<td><a href=\"#{link_ref}\">#{access_ref_link_value}</a></td>\n"
298
+ end
299
+
300
+ col_count = 0
301
+ columns.each do |td|
302
+ tbody << "<td>#{td.value}</td>\n" if infer_access_ref and col_count != access_ref_col
303
+ col_count += 1
304
+ end
305
+ tbody << "</tr>\n"
306
+ row_count += 1
307
+ end
308
+ tbody << "</tbody>"
309
+
310
+ return tbody
311
+ end
312
+
313
+ # Convert the specified table in the specified resource into an HTML
314
+ # table.
315
+ # [_id_:]
316
+ # The ID to assign to the HTML table as a whole.
317
+ # [_add_to_cart_link_ref_:]
318
+ #
319
+ # [_res_:]
320
+ # The resource from which to extract the table in question.
321
+ # [_tbl_:]
322
+ # The table inside the resource from which to extract the rows in question.
323
+ # [_infer_add_to_cart_ref_:]
324
+ #
325
+ # [_add_to_cart_header_value_:]
326
+ #
327
+ # [_add_to_cart_link_value_:]
328
+ #
329
+ # [_infer_access_ref_:]
330
+ # Link the access reference URL associated with a row.
331
+ # [_access_ref_header_value_:]
332
+ # For the access reference column, place this value in the header.
333
+ # [_access_ref_link_value_:]
334
+ # For the access reference column, link this word.
335
+ # [_show_border_:]
336
+ # The boolean value to show HTML table border
337
+ # [_table_class_:]
338
+ # The class to assign the HTML table as a whole.
339
+ # [_header_class_:]
340
+ # The class to assign the header of the HTML table.
341
+ # [_body_class_:]
342
+ # The class to assign the body of the HTML table.
343
+ # [_row_classes_:]
344
+ # The class to assign the HTML table body rows.
345
+ def to_html(id=nil, add_to_cart_link_ref=nil, res=0, tbl=0,
346
+ infer_add_to_cart_ref=true,
347
+ add_to_cart_header_value='Add to Cart',
348
+ add_to_cart_link_value='Add',
349
+ infer_access_ref=true,
350
+ access_ref_header_value='URL',
351
+ access_ref_link_value='Retrieve',
352
+ show_border=false,
353
+ table_class='votable',
354
+ header_class='header',
355
+ body_class='body',
356
+ row_classes=['row1', 'row2'])
357
+ begin
358
+ # A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
359
+ access_ref_col = image_access_reference_columns()
360
+
361
+ if access_ref_col
362
+ # Create headers
363
+ thead = create_headers(res, tbl,
364
+ infer_add_to_cart_ref, add_to_cart_header_value,
365
+ infer_access_ref, access_ref_header_value, access_ref_col,
366
+ header_class)
367
+
368
+ # Create body
369
+ tbody = create_body(res, tbl,
370
+ infer_add_to_cart_ref, add_to_cart_link_value, add_to_cart_link_ref,
371
+ infer_access_ref, access_ref_link_value, access_ref_col,
372
+ body_class, row_classes)
373
+
374
+ return create_table(id, show_border, table_class, thead, tbody)
375
+ else
376
+ title = 'No Data'
377
+ message = 'VOTable not contains data.'
378
+ return create_message_table(table_class, header_class,
379
+ body_class, row_classes, title, message)
380
+ end
381
+
382
+ rescue Exception => e
383
+ title = 'Error'
384
+ message = @resources[0].info[0].text().to_s()
385
+ table = create_message_table(table_class, header_class,
386
+ body_class, row_classes, title, message)
387
+ end
388
+ end
389
+
390
+ end
391
+ end
392
+
393
+ end
394
+ end
@@ -0,0 +1,49 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <Select xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+ xmlns="http://www.ivoa.net/xml/ADQL/v1.0">
6
+
7
+ <SelectionList>
8
+ <Item xsi:type="columnReferenceType" Table="o" Name="objid" />
9
+ <Item xsi:type="columnReferenceType" Table="o" Name="ra" />
10
+ <Item xsi:type="columnReferenceType" Table="o" Name="dec" />
11
+ <Item xsi:type="columnReferenceType" Table="o" Name="type" />
12
+ <Item xsi:type="columnReferenceType" Table="t" Name="objid" />
13
+ <Item xsi:type="columnReferenceType" Table="t" Name="ra" />
14
+ <Item xsi:type="columnReferenceType" Table="t" Name="dec" />
15
+ <Item xsi:type="columnReferenceType" Table="t" Name="j_m" />
16
+ <Item xsi:type="columnReferenceType" Table="o" Name="i" />
17
+ </SelectionList>
18
+
19
+ <From>
20
+ <Table xsi:type="archiveTableType" Archive="SDSS"
21
+ Name="PhotoPrimary" Alias="o" />
22
+ <Table xsi:type="archiveTableType" Archive="TWOMASS"
23
+ Name="PhotoPrimary" Alias="t" />
24
+ <Table xsi:type="joinTableType">
25
+ <Qualifier>INNER</Qualifier>
26
+ <Tables>
27
+ <Table xsi:type="archiveTableType" Archive="SDSS"
28
+ Name="PhotoPrimary" Alias="o" />
29
+ <Table xsi:type="archiveTableType" Archive="TWOMASS"
30
+ Name="PhotoPrimary" Alias="t" />
31
+ </Tables>
32
+ <Condition Comparison="=" xsi:type="comparisonPredType">
33
+ <Arg xsi:type="columnReferenceType" Table="o" Name="objid"/>
34
+ <Arg xsi:type="columnReferenceType" Table="t" Name="objid"/>
35
+ </Condition>
36
+ </Table>
37
+ </From>
38
+
39
+ <Where>
40
+ <Condition xsi:type="regionSearchType">
41
+ <Region xmlns:q1="http://www.ivoa.net/xml/STC/STCregion/v1.10"
42
+ xsi:type="q1:circleType" unit="deg">
43
+ <q1:Center>182.5 -0.89</q1:Center>
44
+ <q1:Radius>8</q1:Radius>
45
+ </Region>
46
+ </Condition>
47
+ </Where>
48
+
49
+ </Select>
@@ -0,0 +1,51 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <Select xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+ xmlns="http://www.ivoa.net/xml/ADQL/v1.0">
6
+
7
+ <SelectionList>
8
+ <Item xsi:type="columnReferenceType" Table="o" Name="objid" />
9
+ <Item xsi:type="columnReferenceType" Table="o" Name="ra" />
10
+ <Item xsi:type="columnReferenceType" Table="o" Name="dec" />
11
+ <Item xsi:type="columnReferenceType" Table="o" Name="r" />
12
+ <Item xsi:type="columnReferenceType" Table="o" Name="type" />
13
+ <Item xsi:type="columnReferenceType" Table="t" Name="objid" />
14
+ <Item xsi:type="columnReferenceType" Table="t" Name="ra" />
15
+ <Item xsi:type="columnReferenceType" Table="t" Name="dec" />
16
+ </SelectionList>
17
+
18
+ <From>
19
+ <Table xsi:type="archiveTableType" Archive="SDSS"
20
+ Name="PhotoPrimary" Alias="o" />
21
+ <Table xsi:type="archiveTableType" Archive="TWOMASS"
22
+ Name="PhotoPrimary" Alias="t" />
23
+ </From>
24
+
25
+ <Where>
26
+ <Condition xsi:type="intersectionSearchType">
27
+ <Condition xsi:type="intersectionSearchType">
28
+ <Condition xsi:type="xMatchType">
29
+ <Table xsi:type="includeTableType" Name="o" />
30
+ <Table xsi:type="includeTableType" Name="t" />
31
+ <Nature Comparison="&lt;" />
32
+ <Sigma xsi:type="realType" Value="3.5" />
33
+ </Condition>
34
+ <Condition xsi:type="regionSearchType">
35
+ <Region xmlns:q1="http://www.ivoa.net/xml/STC/STCregion/v1.10"
36
+ xsi:type="q1:circleType" unit="deg">
37
+ <q1:Center>181.3 -0.76</q1:Center>
38
+ <q1:Radius>6.5</q1:Radius>
39
+ </Region>
40
+ </Condition>
41
+ </Condition>
42
+ <Condition xsi:type="comparisonPredType" Comparison="=">
43
+ <Arg xsi:type="columnReferenceType" Table="o" Name="type" />
44
+ <Arg xsi:type="atomType">
45
+ <Literal xsi:type="integerType" Value="3" />
46
+ </Arg>
47
+ </Condition>
48
+ </Condition>
49
+ </Where>
50
+
51
+ </Select>
@@ -0,0 +1,81 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <Select xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+ xmlns="http://www.ivoa.net/xml/ADQL/v1.0">
6
+
7
+ <SelectionList>
8
+ <Item xsi:type="columnReferenceType" Table="o" Name="objid" />
9
+ <Item xsi:type="columnReferenceType" Table="o" Name="ra" />
10
+ <Item xsi:type="columnReferenceType" Table="o" Name="dec" />
11
+ <Item xsi:type="columnReferenceType" Table="o" Name="type" />
12
+ <Item xsi:type="columnReferenceType" Table="t" Name="objid" />
13
+ <Item xsi:type="columnReferenceType" Table="t" Name="ra" />
14
+ <Item xsi:type="columnReferenceType" Table="t" Name="dec" />
15
+ <Item xsi:type="columnReferenceType" Table="t" Name="j_m" />
16
+ <Item xsi:type="columnReferenceType" Table="o" Name="i" />
17
+ </SelectionList>
18
+
19
+ <From>
20
+ <Table xsi:type="archiveTableType" Archive="SDSS"
21
+ Name="PhotoPrimary" Alias="o" />
22
+ <Table xsi:type="archiveTableType" Archive="TWOMASS"
23
+ Name="PhotoPrimary" Alias="t" />
24
+ </From>
25
+
26
+ <Where>
27
+ <Condition xsi:type="intersectionSearchType">
28
+ <Condition xsi:type="intersectionSearchType">
29
+ <Condition xsi:type="intersectionSearchType">
30
+ <Condition xsi:type="intersectionSearchType">
31
+ <Condition xsi:type="intersectionSearchType">
32
+ <Condition xsi:type="xMatchType">
33
+ <Table xsi:type="includeTableType" Name="o" />
34
+ <Table xsi:type="includeTableType" Name="t" />
35
+ <Nature Comparison="&lt;" />
36
+ <Sigma xsi:type="realType" Value="3.5" />
37
+ </Condition>
38
+ <Condition xsi:type="regionSearchType">
39
+ <Region xmlns:q1="http://www.ivoa.net/xml/STC/STCregion/v1.10"
40
+ xsi:type="q1:circleType" unit="deg">
41
+ <q1:Center>182.5 -0.89</q1:Center>
42
+ <q1:Radius>8</q1:Radius>
43
+ </Region>
44
+ </Condition>
45
+ </Condition>
46
+ <Condition xsi:type="comparisonPredType" Comparison="=">
47
+ <Arg xsi:type="columnReferenceType" Table="o" Name="type" />
48
+ <Arg xsi:type="atomType">
49
+ <Literal xsi:type="integerType" Value="3" />
50
+ </Arg>
51
+ </Condition>
52
+ </Condition>
53
+ <Condition xsi:type="comparisonPredType" Comparison="&lt;">
54
+ <Arg xsi:type="columnReferenceType" Table="o" Name="i" />
55
+ <Arg xsi:type="atomType">
56
+ <Literal xsi:type="integerType" Value="21" />
57
+ </Arg>
58
+ </Condition>
59
+ </Condition>
60
+ <Condition xsi:type="comparisonPredType" Comparison="&lt;">
61
+ <Arg xsi:type="columnReferenceType" Table="t" Name="j_m" />
62
+ <Arg xsi:type="atomType">
63
+ <Literal xsi:type="integerType" Value="18" />
64
+ </Arg>
65
+ </Condition>
66
+ </Condition>
67
+ <Condition xsi:type="comparisonPredType" Comparison="&gt;">
68
+ <Arg xsi:type="closedExprType">
69
+ <Arg xsi:type="binaryExprType" Oper="-">
70
+ <Arg xsi:type="columnReferenceType" Table="o" Name="i" />
71
+ <Arg xsi:type="columnReferenceType" Table="t" Name="j_m" />
72
+ </Arg>
73
+ </Arg>
74
+ <Arg xsi:type="atomType">
75
+ <Literal xsi:type="integerType" Value="2" />
76
+ </Arg>
77
+ </Condition>
78
+ </Condition>
79
+ </Where>
80
+
81
+ </Select>
@@ -0,0 +1,53 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <Select xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+ xmlns="http://www.ivoa.net/xml/ADQL/v1.0">
6
+
7
+ <SelectionList>
8
+ <Item xsi:type="columnReferenceType" Table="o" Name="objid" />
9
+ <Item xsi:type="columnReferenceType" Table="o" Name="ra" />
10
+ <Item xsi:type="columnReferenceType" Table="o" Name="dec" />
11
+ <Item xsi:type="columnReferenceType" Table="t" Name="ra" />
12
+ <Item xsi:type="columnReferenceType" Table="t" Name="dec" />
13
+ <Item xsi:type="columnReferenceType" Table="t" Name="objid" />
14
+ <Item xsi:type="columnReferenceType" Table="o" Name="type" />
15
+ </SelectionList>
16
+
17
+ <From>
18
+ <Table xsi:type="archiveTableType" Archive="SDSS"
19
+ Name="PhotoPrimary" Alias="o" />
20
+ <Table xsi:type="archiveTableType" Archive="TWOMASS"
21
+ Name="PhotoPrimary" Alias="t" />
22
+ <Table xsi:type="archiveTableType" Archive="USNOB"
23
+ Name="PhotoPrimary" Alias="p" />
24
+ </From>
25
+
26
+ <Where>
27
+ <Condition xsi:type="intersectionSearchType">
28
+ <Condition xsi:type="intersectionSearchType">
29
+ <Condition xsi:type="xMatchType">
30
+ <Table xsi:type="includeTableType" Name="o" />
31
+ <Table xsi:type="includeTableType" Name="t" />
32
+ <Table xsi:type="dropTableType" Name="p" />
33
+ <Nature Comparison="&lt;" />
34
+ <Sigma xsi:type="realType" Value="3.5" />
35
+ </Condition>
36
+ <Condition xsi:type="regionSearchType">
37
+ <Region xmlns:q1="http://www.ivoa.net/xml/STC/STCregion/v1.10"
38
+ xsi:type="q1:circleType" unit="deg">
39
+ <q1:Center>182.5 -0.89</q1:Center>
40
+ <q1:Radius>8</q1:Radius>
41
+ </Region>
42
+ </Condition>
43
+ </Condition>
44
+ <Condition xsi:type="comparisonPredType" Comparison="=">
45
+ <Arg xsi:type="columnReferenceType" Table="o" Name="type" />
46
+ <Arg xsi:type="atomType">
47
+ <Literal xsi:type="integerType" Value="3" />
48
+ </Arg>
49
+ </Condition>
50
+ </Condition>
51
+ </Where>
52
+
53
+ </Select>