voruby 1.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile.rb +107 -224
- data/lib/misc.rb +1 -0
- data/lib/misc/misc.rb +60 -0
- data/lib/misc/propertyfile.rb +31 -0
- data/lib/symphony.rb +1 -0
- data/lib/symphony/symphony.rb +247 -0
- data/lib/voruby.rb +186 -0
- data/lib/voruby/active_votable/active_votable.rb +468 -347
- data/lib/voruby/adql/1.0/adql.rb +2418 -0
- data/lib/voruby/adql/support.rb +2 -0
- data/lib/voruby/misc.rb +351 -0
- data/lib/voruby/misc/connection_monitor.rb +97 -0
- data/lib/voruby/misc/libxml_ext.rb +121 -0
- data/lib/voruby/misc/rexml_ext.rb +223 -0
- data/lib/voruby/resolver/resolver.rb +12 -0
- data/lib/voruby/resolver/sesame.rb +299 -0
- data/lib/voruby/sky_query/sky_query.rb +192 -0
- data/lib/voruby/stc/1.10/coords.rb +2272 -0
- data/lib/voruby/stc/1.10/region.rb +892 -0
- data/lib/voruby/stc/1.10/stc.rb +3271 -0
- data/lib/voruby/stc/1.30/stc.rb +8666 -0
- data/lib/voruby/stc/support.rb +2 -0
- data/lib/voruby/ucd/ucd.rb +173 -0
- data/lib/voruby/voevent/1.1/voevent.rb +1124 -0
- data/lib/voruby/voevent/support.rb +5 -0
- data/lib/voruby/votable/1.0/votable.rb +1807 -0
- data/lib/voruby/votable/1.1/votable.rb +2100 -0
- data/lib/voruby/votable/votable.rb +305 -0
- data/lib/voruby/wesix/wesix.rb +491 -0
- data/lib/voruby/xlink/1.2/xlink.rb +21 -0
- data/test/voruby/active_votable/complex.vot +60 -0
- data/test/voruby/active_votable/error.vot +6 -0
- data/test/voruby/active_votable/large.vot +130040 -0
- data/test/voruby/active_votable/simple1.vot +38 -0
- data/test/voruby/active_votable/simple2.vot +38 -0
- data/test/voruby/active_votable/test.rb +193 -0
- data/test/voruby/adql/1.0/adql-alias.sql +1 -0
- data/test/voruby/adql/1.0/adql-alias.xml +26 -0
- data/test/voruby/adql/1.0/adql-avg.sql +1 -0
- data/test/voruby/adql/1.0/adql-avg.xml +31 -0
- data/test/voruby/adql/1.0/adql-circle.sql +1 -0
- data/test/voruby/adql/1.0/adql-circle.xml +46 -0
- data/test/voruby/adql/1.0/adql-expr.sql +1 -0
- data/test/voruby/adql/1.0/adql-expr.xml +34 -0
- data/test/voruby/adql/1.0/adql-function.sql +1 -0
- data/test/voruby/adql/1.0/adql-function.xml +41 -0
- data/test/voruby/adql/1.0/adql-group.sql +1 -0
- data/test/voruby/adql/1.0/adql-group.xml +51 -0
- data/test/voruby/adql/1.0/adql-having.sql +1 -0
- data/test/voruby/adql/1.0/adql-having.xml +25 -0
- data/test/voruby/adql/1.0/adql-like.sql +1 -0
- data/test/voruby/adql/1.0/adql-like.xml +17 -0
- data/test/voruby/adql/1.0/adql-order.sql +1 -0
- data/test/voruby/adql/1.0/adql-order.xml +37 -0
- data/test/voruby/adql/1.0/adql-simple.sql +1 -0
- data/test/voruby/adql/1.0/adql-simple.xml +12 -0
- data/test/voruby/adql/1.0/adql-top.sql +1 -0
- data/test/voruby/adql/1.0/adql-top.xml +33 -0
- data/test/voruby/adql/1.0/test.rb +2220 -0
- data/test/voruby/misc/test.rb +32 -0
- data/test/voruby/resolver/sesame/test.rb +56 -0
- data/test/voruby/sky_query/test.rb +107 -0
- data/test/voruby/stc/1.10/coords_test.rb +3704 -0
- data/test/voruby/stc/1.10/region_test.rb +993 -0
- data/test/voruby/stc/1.10/stc-catalog-entry-location.xml +112 -0
- data/test/voruby/stc/1.10/stc-obs-data-location.xml +126 -0
- data/test/voruby/stc/1.10/stc-region-circle.xml +5 -0
- data/test/voruby/stc/1.10/stc-region-convex.xml +11 -0
- data/test/voruby/stc/1.10/stc-region-convexhull.xml +5 -0
- data/test/voruby/stc/1.10/stc-region-ellipse.xml +7 -0
- data/test/voruby/stc/1.10/stc-region-intersection.xml +25 -0
- data/test/voruby/stc/1.10/stc-region-negation.xml +7 -0
- data/test/voruby/stc/1.10/stc-region-polygon.xml +13 -0
- data/test/voruby/stc/1.10/stc-region-sector.xml +6 -0
- data/test/voruby/stc/1.10/stc-region-union.xml +25 -0
- data/test/voruby/stc/1.10/stc-resource-profile.xml +60 -0
- data/test/voruby/stc/1.10/stc-search-location.xml +54 -0
- data/test/voruby/stc/1.10/stc_test.rb +4626 -0
- data/test/voruby/stc/1.30/stc-catalog-entry-location.xml +210 -0
- data/test/voruby/stc/1.30/stc-obs-data-location-arecibo.xml +353 -0
- data/test/voruby/stc/1.30/stc-obs-data-location-fits.xml +250 -0
- data/test/voruby/stc/1.30/stc-obs-data-location-xlink.xml +63 -0
- data/test/voruby/stc/1.30/stc-obs-data-location.xml +216 -0
- data/test/voruby/stc/1.30/stc-resource-profile-unusual-ref-pos.xml +39 -0
- data/test/voruby/stc/1.30/stc-resource-profile.xml +129 -0
- data/test/voruby/stc/1.30/stc-search-location-arecibo.xml +86 -0
- data/test/voruby/stc/1.30/stc-search-location.xml +101 -0
- data/test/voruby/stc/1.30/test.rb +6274 -0
- data/test/voruby/ucd/test.rb +48 -0
- data/test/voruby/voevent/1.1/test.rb +812 -0
- data/test/{voevent/voevent_v1_1.xml → voruby/voevent/1.1/voevent.xml} +2 -2
- data/test/voruby/voregistry/0.3/test.rb +137 -0
- data/test/voruby/votable/1.0/test.rb +714 -0
- data/test/voruby/votable/1.0/votable.basic.xml +660 -0
- data/test/voruby/votable/1.0/votable.html +86 -0
- data/test/voruby/votable/1.0/votable.ns.xml +56 -0
- data/test/voruby/votable/1.1/test.rb +785 -0
- data/test/voruby/votable/1.1/votable.basic.xml +38 -0
- data/test/voruby/votable/1.1/votable.html +86 -0
- data/test/voruby/votable/1.1/votable.ns.xml +56 -0
- data/test/voruby/votable/test.rb +15 -0
- data/test/voruby/wesix/test.rb +268 -0
- data/test/voruby/wesix/testr.fits +28 -0
- metadata +234 -247
- data/REQUIREMENTS +0 -6
- data/lib/voruby/active_votable/loader.rb +0 -5
- data/lib/voruby/adql/adql.rb +0 -2787
- data/lib/voruby/adql/ext.rb +0 -14
- data/lib/voruby/adql/loader.rb +0 -6
- data/lib/voruby/adql/operations.rb +0 -54
- data/lib/voruby/adql/parser.rb +0 -160
- data/lib/voruby/adql/transforms.rb +0 -573
- data/lib/voruby/ext.rb +0 -17
- data/lib/voruby/loader.rb +0 -4
- data/lib/voruby/misc/propertyfile.rb +0 -36
- data/lib/voruby/plastic/applications.rb +0 -174
- data/lib/voruby/plastic/constants.rb +0 -30
- data/lib/voruby/plastic/loader.rb +0 -10
- data/lib/voruby/plastic/plastic.rb +0 -1
- data/lib/voruby/resources/conesearch/conesearch.rb +0 -9
- data/lib/voruby/resources/conesearch/conesearch_v0_2.rb +0 -55
- data/lib/voruby/resources/conesearch/conesearch_v0_3.rb +0 -50
- data/lib/voruby/resources/conesearch/conesearch_v1_0.rb +0 -72
- data/lib/voruby/resources/conesearch/loader.rb +0 -4
- data/lib/voruby/resources/loader.rb +0 -50
- data/lib/voruby/resources/nodes.rb +0 -190
- data/lib/voruby/resources/openskynode/loader.rb +0 -4
- data/lib/voruby/resources/openskynode/openskynode.rb +0 -9
- data/lib/voruby/resources/openskynode/openskynode_v0_1.rb +0 -54
- data/lib/voruby/resources/sia/loader.rb +0 -5
- data/lib/voruby/resources/sia/sia.rb +0 -9
- data/lib/voruby/resources/sia/sia_v0_6.rb +0 -90
- data/lib/voruby/resources/sia/sia_v0_7.rb +0 -89
- data/lib/voruby/resources/sia/sia_v1_0.rb +0 -122
- data/lib/voruby/resources/stsci.rb +0 -59
- data/lib/voruby/resources/vodataservice/coverage_v0_2.rb +0 -195
- data/lib/voruby/resources/vodataservice/coverage_v0_3.rb +0 -158
- data/lib/voruby/resources/vodataservice/loader.rb +0 -5
- data/lib/voruby/resources/vodataservice/vodataservice.rb +0 -9
- data/lib/voruby/resources/vodataservice/vodataservice_v0_4.rb +0 -189
- data/lib/voruby/resources/vodataservice/vodataservice_v0_5.rb +0 -163
- data/lib/voruby/resources/vodataservice/vodataservice_v1_0.rb +0 -221
- data/lib/voruby/resources/voregistry/loader.rb +0 -4
- data/lib/voruby/resources/voregistry/voregistry.rb +0 -9
- data/lib/voruby/resources/voregistry/voregistry_v0_2.rb +0 -40
- data/lib/voruby/resources/voregistry/voregistry_v0_3.rb +0 -30
- data/lib/voruby/resources/voregistry/voregistry_v1_0.rb +0 -86
- data/lib/voruby/resources/voresource/loader.rb +0 -17
- data/lib/voruby/resources/voresource/voresource.rb +0 -9
- data/lib/voruby/resources/voresource/voresource_v0_10.rb +0 -327
- data/lib/voruby/resources/voresource/voresource_v0_9.rb +0 -405
- data/lib/voruby/resources/voresource/voresource_v1_0.rb +0 -230
- data/lib/voruby/services/ext.rb +0 -11
- data/lib/voruby/services/gestalt/footprint.rb +0 -95
- data/lib/voruby/services/gestalt/wcs_fixer.rb +0 -105
- data/lib/voruby/services/gestalt/wesix.rb +0 -155
- data/lib/voruby/services/loader.rb +0 -7
- data/lib/voruby/services/registry/registry.rb +0 -53
- data/lib/voruby/services/resolver/resolver.rb +0 -35
- data/lib/voruby/services/schema/schema.rb +0 -644
- data/lib/voruby/sesame/loader.rb +0 -6
- data/lib/voruby/sesame/sesame_v1_0.rb +0 -64
- data/lib/voruby/simple/loader.rb +0 -6
- data/lib/voruby/simple/parameters.rb +0 -196
- data/lib/voruby/simple/sap.rb +0 -446
- data/lib/voruby/spacetime/loader.rb +0 -3
- data/lib/voruby/spacetime/spacetime.rb +0 -607
- data/lib/voruby/stc/coords_v1_20.rb +0 -900
- data/lib/voruby/stc/loader.rb +0 -55
- data/lib/voruby/stc/region_v1_20.rb +0 -274
- data/lib/voruby/stc/stc_v1_20.rb +0 -1196
- data/lib/voruby/util.rb +0 -27
- data/lib/voruby/voevent/loader.rb +0 -7
- data/lib/voruby/voevent/voevent_v1_0.rb +0 -213
- data/lib/voruby/voevent/voevent_v1_1.rb +0 -196
- data/lib/voruby/votables/chandra.rb +0 -373
- data/lib/voruby/votables/data.rb +0 -179
- data/lib/voruby/votables/galex.rb +0 -377
- data/lib/voruby/votables/int.rb +0 -354
- data/lib/voruby/votables/libxml_parser.rb +0 -411
- data/lib/voruby/votables/libxml_votable.rb +0 -67
- data/lib/voruby/votables/loader.rb +0 -10
- data/lib/voruby/votables/meta.rb +0 -763
- data/lib/voruby/votables/misc.rb +0 -51
- data/lib/voruby/votables/nsa.rb +0 -410
- data/lib/voruby/votables/rexml_parser.rb +0 -408
- data/lib/voruby/votables/rexml_votable.rb +0 -67
- data/lib/voruby/votables/sdss.rb +0 -356
- data/lib/voruby/votables/transforms.rb +0 -388
- data/lib/voruby/votables/tree.rb +0 -45
- data/lib/voruby/votables/types.rb +0 -391
- data/lib/voruby/votables/votable.rb +0 -687
- data/test/active_votable/database.yml +0 -6
- data/test/active_votable/test.vot +0 -168492
- data/test/active_votable/unittest.rb +0 -41
- data/test/adql/test1.adql +0 -49
- data/test/adql/test2.adql +0 -51
- data/test/adql/test3.adql +0 -81
- data/test/adql/test4.adql +0 -53
- data/test/adql/test5.adql +0 -55
- data/test/adql/test6.adql +0 -18
- data/test/adql/test7.adql +0 -48
- data/test/adql/unittest.rb +0 -1672
- data/test/plastic/test.rb +0 -44
- data/test/plastic/test.vot +0 -5385
- data/test/plastic/unittest.rb +0 -66
- data/test/resources/conesearch/conesearch_v0_3.xml +0 -31
- data/test/resources/conesearch/conesearch_v1_0.xml +0 -86
- data/test/resources/conesearch/unittest_v0_3.rb +0 -22
- data/test/resources/conesearch/unittest_v1_0.rb +0 -24
- data/test/resources/openskynode/open_sky_node_v0_1.xml +0 -32
- data/test/resources/openskynode/unittest_v0_1.rb +0 -31
- data/test/resources/sia/simple_image_access_v0_7.xml +0 -36
- data/test/resources/sia/simple_image_access_v1_0.xml +0 -122
- data/test/resources/sia/unittest_v0_7.rb +0 -24
- data/test/resources/sia/unittest_v1_0.rb +0 -29
- data/test/resources/stsci.xml +0 -336
- data/test/resources/unittest_stsci.rb +0 -25
- data/test/resources/vodataservice/catalog_service_resource_v1_0.xml +0 -128
- data/test/resources/vodataservice/data_collection_resource_v0_5.xml +0 -54
- data/test/resources/vodataservice/data_collection_resource_v1_0.xml +0 -117
- data/test/resources/vodataservice/data_service_resource_v1_0.xml +0 -115
- data/test/resources/vodataservice/sky_service_resource_v0_10.xml +0 -45
- data/test/resources/vodataservice/table_service_resource_v1_0.xml +0 -122
- data/test/resources/vodataservice/tabular_sky_service_resource_v0_10.xml +0 -60
- data/test/resources/vodataservice/unittest_v0_5.rb +0 -126
- data/test/resources/vodataservice/unittest_v1_0.rb +0 -151
- data/test/resources/voregistry/authority_resource_v0_3.xml +0 -20
- data/test/resources/voregistry/authority_resource_v1_0.xml +0 -82
- data/test/resources/voregistry/registry_service_v0_3.xml +0 -20
- data/test/resources/voregistry/registry_service_v1_0.xml +0 -107
- data/test/resources/voregistry/unittest_v0_3.rb +0 -31
- data/test/resources/voregistry/unittest_v1_0.rb +0 -34
- data/test/resources/voresource/organisation_resource_v1_0.xml +0 -90
- data/test/resources/voresource/resource_organisation_v0_10.xml +0 -22
- data/test/resources/voresource/resource_service_v0_10.xml +0 -19
- data/test/resources/voresource/resource_v0_10.xml +0 -19
- data/test/resources/voresource/resource_v1_0.xml +0 -79
- data/test/resources/voresource/service_resource_v1_0.xml +0 -91
- data/test/resources/voresource/unittest_v0_10.rb +0 -61
- data/test/resources/voresource/unittest_v0_9.rb +0 -4
- data/test/resources/voresource/unittest_v1_0.rb +0 -190
- data/test/services/gestalt/unittest.rb +0 -74
- data/test/services/registry/unittest.rb +0 -34
- data/test/services/resolver/unittest.rb +0 -38
- data/test/simple/unittest.rb +0 -46
- data/test/spacetime/unittest.rb +0 -39
- data/test/stc/catalog_entry_location_v1_20.xml +0 -112
- data/test/stc/obs_data_location_v1_20.xml +0 -108
- data/test/stc/search_location_v1_20.xml +0 -54
- data/test/stc/stc_resource_profile_v1_20.xml +0 -60
- data/test/stc/unittest_v1_20.rb +0 -620
- data/test/voevent/unittest_v1_0.rb +0 -79
- data/test/voevent/unittest_v1_1.rb +0 -70
- data/test/voevent/voevent_v1_0.xml +0 -96
- data/test/votables/test.vot +0 -366
- data/test/votables/unittest.rb +0 -54
data/lib/voruby/votables/sdss.rb
DELETED
@@ -1,356 +0,0 @@
|
|
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 SDSS VOTable.
|
4
|
-
|
5
|
-
require 'voruby/votables/votable'
|
6
|
-
|
7
|
-
module VORuby
|
8
|
-
module VOTables
|
9
|
-
|
10
|
-
module VOTable
|
11
|
-
class SDSSVOTable < 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 SDSS 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 SDSS always uses the UCDs on its
|
27
|
-
# fields
|
28
|
-
def find_field_in_conf_file(key)
|
29
|
-
sdss_field = {'id'=> nil, 'name'=> nil, 'ucd'=> nil}
|
30
|
-
|
31
|
-
if key != nil
|
32
|
-
SDSS_ARCHIVE_CONFIG.each do |archive|
|
33
|
-
archive['votable_fields'].each do |field|
|
34
|
-
if field['key'] == key
|
35
|
-
sdss_field['id'] = field['id'] if field['id'] != 'nil'
|
36
|
-
sdss_field['name'] = field['name'] if field['name'] != 'nil'
|
37
|
-
sdss_field['ucd'] = field['ucd'] if field['ucd'] != 'nil'
|
38
|
-
break
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
return sdss_field
|
44
|
-
end
|
45
|
-
|
46
|
-
# Find the column number(s) associated with the
|
47
|
-
# VOX:imageAccessReference UCD.
|
48
|
-
# Returns a list of column positions.
|
49
|
-
def image_access_reference_columns()
|
50
|
-
sdss_ucd_access = find_field_in_conf_file('VOX:Image_AccessReference')['ucd']
|
51
|
-
|
52
|
-
if find_columns(sdss_ucd_access).first != nil
|
53
|
-
find_columns(sdss_ucd_access).first
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def image_ra_columns
|
58
|
-
ucd_ra = find_field_in_conf_file('POS_EQ_RA_MAIN')['ucd']
|
59
|
-
|
60
|
-
if find_columns(ucd_ra).first != nil
|
61
|
-
find_columns(ucd_ra).first
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def image_dec_columns
|
66
|
-
ucd_dec = find_field_in_conf_file('POS_EQ_DEC_MAIN')['ucd']
|
67
|
-
|
68
|
-
if find_columns(ucd_dec).first != nil
|
69
|
-
find_columns(ucd_dec).first
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def image_filter_columns
|
74
|
-
#ucd_filter = find_field_in_conf_file('')['ucd']
|
75
|
-
|
76
|
-
#if find_columns(ucd_filter).first != nil
|
77
|
-
# find_columns(ucd_filter).first
|
78
|
-
#end
|
79
|
-
end
|
80
|
-
|
81
|
-
def image_date_obs_columns
|
82
|
-
#ucd_date_obs = find_field_in_conf_file('')['ucd']
|
83
|
-
|
84
|
-
#if find_columns(ucd_date_obs).first != nil
|
85
|
-
# find_columns(ucd_date_obs).first
|
86
|
-
#end
|
87
|
-
end
|
88
|
-
|
89
|
-
def image_telescope_columns
|
90
|
-
#ucd_telescope = find_field_in_conf_file('')['ucd']
|
91
|
-
|
92
|
-
#if find_columns(ucd_telescope).first != nil
|
93
|
-
# find_columns(ucd_telescope).first
|
94
|
-
#end
|
95
|
-
end
|
96
|
-
|
97
|
-
def image_survey_columns
|
98
|
-
ucd_survey = find_field_in_conf_file('VOX:Image_Title')['ucd']
|
99
|
-
|
100
|
-
if find_columns(ucd_survey).first != nil
|
101
|
-
find_columns(ucd_survey).first
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def image_instrument_columns
|
106
|
-
#ucd_instrument = find_field_in_conf_file('')['ucd']
|
107
|
-
|
108
|
-
#if find_columns(ucd_instrument).first != nil
|
109
|
-
# find_columns(ucd_instrument).first
|
110
|
-
#end
|
111
|
-
end
|
112
|
-
|
113
|
-
def image_sky_columns
|
114
|
-
#ucd_sky = find_field_in_conf_file('')['ucd']
|
115
|
-
|
116
|
-
#if find_columns(ucd_sky).first != nil
|
117
|
-
# find_columns(ucd_sky).first
|
118
|
-
#end
|
119
|
-
end
|
120
|
-
|
121
|
-
def image_zeropoint_columns
|
122
|
-
#ucd_zeropoint = find_field_in_conf_file('')['ucd']
|
123
|
-
|
124
|
-
#if find_columns(ucd_zeropoint).first != nil
|
125
|
-
# find_columns(ucd_zeropoint).first
|
126
|
-
#end
|
127
|
-
end
|
128
|
-
|
129
|
-
def image_seeing_columns
|
130
|
-
#ucd_seeing = find_field_in_conf_file('')['ucd']
|
131
|
-
|
132
|
-
#if find_columns(ucd_seeing).first != nil
|
133
|
-
# find_columns(ucd_seeing).first
|
134
|
-
#end
|
135
|
-
end
|
136
|
-
|
137
|
-
def image_depth_columns
|
138
|
-
#ucd_depth = find_field_in_conf_file('')['ucd']
|
139
|
-
|
140
|
-
#if find_columns(ucd_depth).first != nil
|
141
|
-
# find_columns(ucd_depth).first
|
142
|
-
#end
|
143
|
-
end
|
144
|
-
|
145
|
-
def image_exptime_columns
|
146
|
-
#ucd_exptime = find_field_in_conf_file('')['ucd']
|
147
|
-
|
148
|
-
#if find_columns(ucd_exptime).first != nil
|
149
|
-
# find_columns(ucd_exptime).first
|
150
|
-
#end
|
151
|
-
end
|
152
|
-
|
153
|
-
# Create the headers for HTML table
|
154
|
-
# [_access_ref_index_:]
|
155
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
156
|
-
# [_options_:]
|
157
|
-
#
|
158
|
-
def create_headers(access_ref_index, options)
|
159
|
-
thead, thead_2row = create_header_cart_links(options)
|
160
|
-
|
161
|
-
if options[:infer_access_ref] and access_ref_index
|
162
|
-
thead << "<th>#{options[:access_ref_header_label]}</th>\n"
|
163
|
-
thead_2row.push(' ')
|
164
|
-
end
|
165
|
-
|
166
|
-
col_count = 0
|
167
|
-
fields(options[:res], options[:tbl]).each do |field|
|
168
|
-
field_archive = find_field_in_conf_file(field.ucd.value())
|
169
|
-
field_ucd = field_archive['ucd']
|
170
|
-
if options[:infer_access_ref] and col_count == access_ref_index
|
171
|
-
thead_2row[1] = field_ucd if field_ucd != 'nil'
|
172
|
-
else
|
173
|
-
thead << "<th>#{field_archive['id']}</th>\n"
|
174
|
-
if field_ucd != 'nil'
|
175
|
-
thead_2row.push(field_ucd)
|
176
|
-
else
|
177
|
-
thead_2row.push(' ')
|
178
|
-
end
|
179
|
-
end
|
180
|
-
col_count += 1
|
181
|
-
end
|
182
|
-
|
183
|
-
thead << " </tr>\n"
|
184
|
-
|
185
|
-
thead << "<tr>\n"
|
186
|
-
thead_2row.each do |h|
|
187
|
-
thead << "<th>#{h}</th>\n"
|
188
|
-
end
|
189
|
-
thead << "</tr>\n"
|
190
|
-
|
191
|
-
thead << "</thead>"
|
192
|
-
|
193
|
-
return thead
|
194
|
-
end
|
195
|
-
|
196
|
-
# Creates the cart parameters
|
197
|
-
# [_cart_params:_]
|
198
|
-
#
|
199
|
-
# [_columns:_]
|
200
|
-
#
|
201
|
-
def create_item_cart_params(cart_params, columns)
|
202
|
-
link_ref_array = []
|
203
|
-
|
204
|
-
cart_params.each do |key, value|
|
205
|
-
link_ref_array.push("#{key}=#{value}")
|
206
|
-
end
|
207
|
-
|
208
|
-
access_ref_index = image_access_reference_columns()
|
209
|
-
link_ref_array.push("resource=#{CGI.escape(columns[access_ref_index].value).to_s}") if access_ref_index
|
210
|
-
ra_index = image_ra_columns()
|
211
|
-
link_ref_array.push("rac=#{columns[ra_index].value.to_s}") if ra_index
|
212
|
-
dec_index = image_dec_columns()
|
213
|
-
link_ref_array.push("decc=#{columns[dec_index].value.to_s}") if dec_index
|
214
|
-
filter_index = image_filter_columns()
|
215
|
-
link_ref_array.push("filter=#{columns[filter_index].value.to_s}") if filter_index
|
216
|
-
date_obs_index = image_date_obs_columns()
|
217
|
-
link_ref_array.push("date_obs=#{columns[date_obs_index].value.to_s}") if date_obs_index
|
218
|
-
teles_index = image_telescope_columns()
|
219
|
-
link_ref_array.push("telescop=#{columns[teles_index].value.to_s}") if teles_index
|
220
|
-
survey_index = image_survey_columns()
|
221
|
-
link_ref_array.push("survey=#{columns[survey_index].value.to_s}") if survey_index
|
222
|
-
instrum_index = image_instrument_columns()
|
223
|
-
link_ref_array.push("instrument=#{columns[instrum_index].value.to_s}") if instrum_index
|
224
|
-
sky_index = image_sky_columns()
|
225
|
-
link_ref_array.push("sky=#{columns[sky_index].value.to_s}") if sky_index
|
226
|
-
zerop_index = image_zeropoint_columns()
|
227
|
-
link_ref_array.push("zeropoint=#{columns[zerop_index].value.to_s}") if zerop_index
|
228
|
-
seeing_index = image_seeing_columns()
|
229
|
-
link_ref_array.push("seeing=#{columns[seeing_index].value.to_s}") if seeing_index
|
230
|
-
depth_index = image_depth_columns()
|
231
|
-
link_ref_array.push("depth=#{columns[depth_index].value.to_s}") if depth_index
|
232
|
-
exptime_index = image_exptime_columns()
|
233
|
-
link_ref_array.push("exptime=#{columns[exptime_index].value.to_s}") if exptime_index
|
234
|
-
|
235
|
-
return link_ref_array.join('&')
|
236
|
-
end
|
237
|
-
|
238
|
-
# Create body for HTML table
|
239
|
-
# [_access_ref_index_:]
|
240
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
241
|
-
# [_options_:]
|
242
|
-
#
|
243
|
-
def create_body(access_ref_index, options)
|
244
|
-
tbody = "<tbody class=\"#{options[:body_class]}\" align=\"center\">\n"
|
245
|
-
row_count = 0
|
246
|
-
rows_data = rows(options[:res], options[:tbl])
|
247
|
-
if rows_data
|
248
|
-
rows_data.each do |tr|
|
249
|
-
tbody << "<tr class=\"#{options[:row_classes][row_count % 2]}\">\n"
|
250
|
-
|
251
|
-
# Specially mark up the first column to link to the image.
|
252
|
-
columns = tr.tds()
|
253
|
-
|
254
|
-
if options[:infer_add_to_cart_ref] and access_ref_index
|
255
|
-
tbody << "<td><input type=\"checkbox\" " +
|
256
|
-
"id=\"checkbox_add_#{options[:cart_params][:archive]}_#{row_count.to_s}\" " +
|
257
|
-
"value=\"#{create_item_cart_params(options[:cart_params], columns)}\"/></td>\n"
|
258
|
-
end
|
259
|
-
|
260
|
-
if options[:infer_access_ref] and access_ref_index
|
261
|
-
tbody << "<td><a href=\"#{columns[access_ref_index].value}\">#{options[:access_ref_link_label]}</a></td>\n"
|
262
|
-
end
|
263
|
-
|
264
|
-
col_count = 0
|
265
|
-
#ra_index = image_ra_columns()
|
266
|
-
#dec_index = image_dec_columns()
|
267
|
-
columns.each do |td|
|
268
|
-
if col_count != access_ref_index
|
269
|
-
#if ra_index and col_count == ra_index
|
270
|
-
# tbody << "<td>#{convert_ra_to_degrees(td.value)}</td>\n"
|
271
|
-
#elsif dec_index and col_count == dec_index
|
272
|
-
# tbody << "<td>#{convert_dec_to_degrees(td.value)}</td>\n"
|
273
|
-
#else
|
274
|
-
tbody << "<td>#{td.value}</td>\n"
|
275
|
-
#end
|
276
|
-
end
|
277
|
-
col_count += 1
|
278
|
-
end
|
279
|
-
|
280
|
-
tbody << "</tr>\n"
|
281
|
-
row_count += 1
|
282
|
-
end
|
283
|
-
end
|
284
|
-
tbody << "</tbody>"
|
285
|
-
|
286
|
-
return tbody
|
287
|
-
end
|
288
|
-
|
289
|
-
# Convert the specified table in the specified resource into an HTML
|
290
|
-
# table.
|
291
|
-
# [_options_:]
|
292
|
-
# The options for this VOTable.
|
293
|
-
def to_html(options={})
|
294
|
-
# The ID to assign to the HTML table as a whole.
|
295
|
-
options[:id] = options[:id] || "#{votable}_#{Time.now.to_i}_#{rand(10000)}"
|
296
|
-
|
297
|
-
options[:infer_add_to_cart_ref] = true if options[:infer_add_to_cart_ref] == nil
|
298
|
-
options[:add_to_cart_header_label] = options[:add_to_cart_header_label] || 'Add to Cart'
|
299
|
-
options[:cart_params] = {} if options[:cart_params] == nil
|
300
|
-
#options[:add_to_cart_url] = options[:add_to_cart_url] || nil
|
301
|
-
|
302
|
-
options[:throbber_src] = options[:throbber_src] || '/images/general/indicator.gif'
|
303
|
-
options[:throbber_size] = options[:throbber_size] || '16x16'
|
304
|
-
options[:throbber_class] = options[:throbber_class] || 'throbber'
|
305
|
-
options[:throbber_id] = options[:throbber_id] || "#{options[:id]}_throbber_id"
|
306
|
-
|
307
|
-
options[:flash_notice_class] = options[:flash_notice_class] || 'flash_notice'
|
308
|
-
options[:flash_notice_id] = options[:flash_notice_id] || "#{options[:id]}_flash_notice_id"
|
309
|
-
|
310
|
-
# Link the access reference URL associated with a row.
|
311
|
-
options[:infer_access_ref] = true if options[:infer_access_ref] == nil
|
312
|
-
#options[:retrieve_link_ref] = options[:retrieve_link_ref] || nil
|
313
|
-
# For the access reference column, place this value in the header.
|
314
|
-
options[:access_ref_header_label] = options[:access_ref_header_label] || 'URL'
|
315
|
-
# For the access reference column, link this word.
|
316
|
-
options[:access_ref_link_label] = options[:access_ref_link_label] || 'Retrieve'
|
317
|
-
options[:ssl] = false if options[:ssl] == nil
|
318
|
-
#options[:resource_link] = options[:resource_link]
|
319
|
-
|
320
|
-
# The resource from which to extract the table in question.
|
321
|
-
options[:res] = options[:res] || 0
|
322
|
-
# The table inside the resource from which to extract the rows in question.
|
323
|
-
options[:tbl] = options[:tbl] || 0
|
324
|
-
|
325
|
-
# The boolean value to show HTML table border
|
326
|
-
options[:show_border] = false if options[:show_border] == nil
|
327
|
-
# The class to assign the HTML table as a whole.
|
328
|
-
options[:table_class] = options[:table_class] || 'votable'
|
329
|
-
# The class to assign the header of the HTML table.
|
330
|
-
options[:header_class] = options[:header_class] || 'header'
|
331
|
-
# The class to assign the body of the HTML table.
|
332
|
-
options[:body_class] = options[:body_class] || 'body'
|
333
|
-
# The class to assign the HTML table body rows.
|
334
|
-
options[:row_classes] = options[:row_classes] || ['row1', 'row2']
|
335
|
-
|
336
|
-
begin
|
337
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
338
|
-
access_ref_index = image_access_reference_columns()
|
339
|
-
|
340
|
-
return create_votable(create_headers(access_ref_index, options),
|
341
|
-
create_body(access_ref_index, options),
|
342
|
-
options)
|
343
|
-
|
344
|
-
rescue Exception => e
|
345
|
-
title = 'Error...'
|
346
|
-
message = "VORuby error: #{e.message}<br>#{e.backtrace}"
|
347
|
-
message << "<br>#{@resources[0].info[0].text().to_s()}" if @resources[0].info[0]
|
348
|
-
create_message(title, message, options)
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
352
|
-
end
|
353
|
-
end
|
354
|
-
|
355
|
-
end
|
356
|
-
end
|
@@ -1,388 +0,0 @@
|
|
1
|
-
module VORuby
|
2
|
-
module VOTables
|
3
|
-
module VOTable
|
4
|
-
class VOTable
|
5
|
-
def self.from_soap_obj(mvot)
|
6
|
-
VOTable.new(
|
7
|
-
VOTable::_find_attr_value(mvot.__xmlattr, 'ID'),
|
8
|
-
VOTable::_find_attr_value(mvot.__xmlattr, 'version'),
|
9
|
-
(mvot.respond_to?(:dESCRIPTION))? Meta::Description.from_soap_obj(mvot.dESCRIPTION): nil,
|
10
|
-
(mvot.respond_to?(:dEFINITIONS))? Meta::Definitions.from_soap_obj(mvot.dEFINITIONS): nil,
|
11
|
-
(mvot.respond_to?(:cOOSYS))? Meta::CooSys.from_soap_obj(mvot.cOOSYS): [],
|
12
|
-
(mvot.respond_to?(:pARAM))? Meta::Param.from_soap_obj(mvot.pARAM): [],
|
13
|
-
(mvot.respond_to?(:iNFO))? Meta::Info.from_soap_obj(mvot.iNFO): [],
|
14
|
-
(mvot.respond_to?(:rESOURCE))? Meta::Resource.from_soap_obj(mvot.rESOURCE): []
|
15
|
-
)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
module Meta
|
20
|
-
|
21
|
-
class Definitions
|
22
|
-
def self.from_soap_obj(mdef)
|
23
|
-
Definitions.new(
|
24
|
-
(mdef.respond_to?(:cOOSYS))? VOTable._coosys_from_soap_obj(mdef.cOOSYS): nil,
|
25
|
-
(mdef.respond_to?(:pARAM))? VOTable._params_from_soap_obj(mdef.pARAM): nil
|
26
|
-
)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class Description
|
31
|
-
def self.from_soap_obj(mdesc)
|
32
|
-
Description.new(mdesc)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
class CooSys
|
37
|
-
def self.from_soap_obj(mcoosystems)
|
38
|
-
mcoosystems = [mcoosystems] if !mcoosystems.respond_to(:each)
|
39
|
-
|
40
|
-
coosys = []
|
41
|
-
mcoosystems.each do |mcoosys|
|
42
|
-
equinox_txt = VOTable::_find_attr_value(mcoosys.__xmlattr, 'equinox')
|
43
|
-
epoch_txt = VOTable::_find_attr_value(mcoosys.__xmlattr, 'epoch')
|
44
|
-
system_txt = VOTable::_find_attr_value(mcoosys.__xmlattr, 'system') || 'eq_FK5'
|
45
|
-
|
46
|
-
coosys.push(CooSys.new(
|
47
|
-
VOTable::_find_attr_value(mcoosys.__xmlattr, 'ID'),
|
48
|
-
(equinox_txt == nil)? nil: Type::AstroYear.new(equinox_txt),
|
49
|
-
(epoch_txt == nil)? nil: Type::AstroYear.new(epoch_txt),
|
50
|
-
Type::CoordSystemType.new(system_txt)
|
51
|
-
))
|
52
|
-
end
|
53
|
-
|
54
|
-
coosys
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
class Param
|
59
|
-
def self.from_soap_obj(mparams)
|
60
|
-
mparams = [mparams] if !mparams.respond_to?(:each)
|
61
|
-
|
62
|
-
params = []
|
63
|
-
mparams.each do |mparam|
|
64
|
-
datatype_txt = VOTable::_find_attr_value(mparam.__xmlattr, 'datatype')
|
65
|
-
ucd_txt = VOTable::_find_attr_value(mparam.__xmlattr, 'ucd')
|
66
|
-
precision_txt = VOTable::_find_attr_value(mparam.__xmlattr, 'precision')
|
67
|
-
width_txt = VOTable::_find_attr_value(mparam.__xmlattr, 'width')
|
68
|
-
arraysize_txt = VOTable::_find_attr_value(mparam.__xmlattr, 'arraysize')
|
69
|
-
|
70
|
-
params.push(Param.new(
|
71
|
-
VOTable::_find_attr_value(mparam.__xmlattr, 'name'),
|
72
|
-
(datatype_txt == nil)? nil: Type::DataType.new(datatype_txt),
|
73
|
-
VOTable::_find_attr_value(mparam.__xmlattr, 'value'),
|
74
|
-
(ucd_txt == nil)? nil: Type::UCDType.new(ucd_txt),
|
75
|
-
VOTable::_find_attr_value(mparam.__xmlattr, 'unit'),
|
76
|
-
(mparam.respond_to?(:dESCRIPTION))? _description_from_soap_obj(mparam.dESCRIPTION): nil,
|
77
|
-
(mparam.respond_to?(:vALUES))? _values_from_soap_obj(mparam.vALUES): nil,
|
78
|
-
(mparam.respond_to?(:lINK))? _links_from_soap_obj(mapram.lINK): nil,
|
79
|
-
VOTable::_find_attr_value(mparam.__xmlattr, 'ID'),
|
80
|
-
(precision_txt == nil)? nil: Type::PrecisionType.new(precision_txt.to_i),
|
81
|
-
VOTable::_find_attr_value(mparam.__xmlattr, 'utype'),
|
82
|
-
(width_txt == nil)? nil: Type::PositiveInteger.new(width_txt.to_i),
|
83
|
-
VOTable::_find_attr_value(mparam.__xmlattr, 'ref'),
|
84
|
-
(arraysize_txt == nil)? nil: Type::ArrayDef.new(arraysize_txt)
|
85
|
-
))
|
86
|
-
end
|
87
|
-
|
88
|
-
params
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
class Info
|
93
|
-
def self.from_soap_obj(minfo)
|
94
|
-
info = []
|
95
|
-
info.push(Info.new(
|
96
|
-
VOTable::_find_attr_value(minfo.__xmlattr, 'name'),
|
97
|
-
VOTable::_find_attr_value(minfo.__xmlattr, 'value'),
|
98
|
-
VOTable::_find_attr_value(minfo.__xmlattr, 'ID'),
|
99
|
-
minfo.__xmlele # text
|
100
|
-
))
|
101
|
-
|
102
|
-
info
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
class Resource
|
107
|
-
def self.from_soap_obj(mresources)
|
108
|
-
mresources = [mresources] if !mresources.respond_to?(:each)
|
109
|
-
|
110
|
-
resources = []
|
111
|
-
mresources.each do |mres|
|
112
|
-
type_txt = VOTable::_find_attr_value(mres.__xmlattr, 'type') || 'results'
|
113
|
-
|
114
|
-
resources.push(Resource.new(
|
115
|
-
VOTable::_find_attr_value(mres.__xmlattr, 'name'),
|
116
|
-
VOTable::_find_attr_value(mres.__xmlattr, 'ID'),
|
117
|
-
VOTable::_find_attr_value(mres.__xmlattr, 'utype'),
|
118
|
-
Type::ResourceType.new(type_txt),
|
119
|
-
(mres.respond_to?(:dESCRIPTION))? Description.from_soap_obj(mres.dESCRIPTION): nil,
|
120
|
-
(mres.respond_to?(:iNFO))? Info.from_soap_obj(mres.iNFO): [],
|
121
|
-
(mres.respond_to?(:cOOSYS))? CooSys.from_soap_obj(mres.cOOSYS): [],
|
122
|
-
(mres.respond_to?(:pARAM))? Param.from_soap_obj(mres.pARAM): [],
|
123
|
-
(mres.respond_to?(:lINK))? Link.from_soap_obj(mres.lINK): [],
|
124
|
-
Table.from_soap_obj(mres.tABLE),
|
125
|
-
(mres.respond_to?(:rESOURCE))? Resource.from_soap_obj(mres.rESOURCE): []
|
126
|
-
))
|
127
|
-
end
|
128
|
-
|
129
|
-
resources
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
class Table
|
134
|
-
def self.from_soap_obj(mtables)
|
135
|
-
mtables = [mtables] if !mtables.respond_to?(:each)
|
136
|
-
|
137
|
-
tables = []
|
138
|
-
mtables.each do |mtable|
|
139
|
-
ucd_txt = VOTable::_find_attr_value(mtable.__xmlattr, 'ucd')
|
140
|
-
nrows_txt = VOTable::_find_attr_value(mtable.__xmlattr, 'nrows')
|
141
|
-
|
142
|
-
tables.push(Table.new(
|
143
|
-
VOTable::_find_attr_value(mtable.__xmlattr, 'name'),
|
144
|
-
VOTable::_find_attr_value(mtable.__xmlattr, 'ID'),
|
145
|
-
(ucd_txt == nil)? nil: Type::UCDType.new(ucd_txt),
|
146
|
-
VOTable::_find_attr_value(mtable.__xmlattr, 'utype'),
|
147
|
-
VOTable::_find_attr_value(mtable.__xmlattr, 'ref'),
|
148
|
-
(nrows_txt == nil)? nil: Type::NonNegativeInteger.new(nrows_txt.to_i),
|
149
|
-
(mtable.respond_to?(:dESCRIPTION))? Description.from_soap_obj(mtable.dESCRIPTION): nil,
|
150
|
-
(mtable.respond_to?(:fIELD))? Field.from_soap_obj(mtable.fIELD): [],
|
151
|
-
(mtable.respond_to?(:pARAM))? Param.from_soap_obj(mtable.pARAM): [],
|
152
|
-
(mtable.respond_to?(:gROUP))? Group.from_soap_obj(mtable.gROUP): [],
|
153
|
-
(mtable.respond_to?(:lINK))? Link.from_soap_obj(mtable.lINK): [],
|
154
|
-
(mtable.respond_to?(:dATA))? Data::Data.from_soap_obj(mtable.dATA): nil
|
155
|
-
))
|
156
|
-
end
|
157
|
-
|
158
|
-
tables
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
class Group
|
163
|
-
def self.from_soap_obj(mgroups)
|
164
|
-
mgroups = [mgroups] if !mgroups.respond_to?(:each)
|
165
|
-
|
166
|
-
groups = []
|
167
|
-
mgroups.each do |mgroup|
|
168
|
-
ucd_txt = OTable::VOTable::_find_attr_value(mgroup.__xmlattr, 'ucd')
|
169
|
-
|
170
|
-
groups.push(Group.new(
|
171
|
-
VOTable::_find_attr_value(mgroup.__xmlattr, 'name'),
|
172
|
-
(ucd_txt == nil)? nil: Type::UCDType.new(ucd_txt),
|
173
|
-
(mgroup.respond_to?(:dESCRIPTION))? Description.from_soap_obj(mgroup.dESCRIPTION): nil,
|
174
|
-
(mgroup.respond_to?(:fIELDref))? FieldRef.from_soap_obj(mgroup.fIELDref): [],
|
175
|
-
(mgroup.respond_to?(:pARAMref))? ParamRef.from_soap_obj(mgroup.pARAMref): [],
|
176
|
-
(mgroup.respond_to?(:pARAM))? Param.from_soap_obj(mgroup.pARAM): [],
|
177
|
-
(mgroup.respond_to?(:gROUP))? Group.from_soap_obj(mgroup.gROUP): [],
|
178
|
-
VOTable::_find_attr_value(mgroup.__xmlattr, 'ID'),
|
179
|
-
VOTable::_find_attr_value(mgroup.__xmlattr, 'ref'),
|
180
|
-
VOTable::_find_attr_value(mgroup.__xmlattr, 'utype')
|
181
|
-
))
|
182
|
-
end
|
183
|
-
|
184
|
-
groups
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
class FieldRef
|
189
|
-
def self.from_soap_obj(mfieldrefs)
|
190
|
-
mfieldrefs = [mfieldrefs] if !mfieldrefs.respond_to?(:each)
|
191
|
-
|
192
|
-
fieldrefs = []
|
193
|
-
mfieldrefs.each do |mfieldref|
|
194
|
-
fieldrefs.push(FieldRef.new(
|
195
|
-
VOTable::_find_attr_value(mfieldref.__xmlattr, 'ref')
|
196
|
-
))
|
197
|
-
end
|
198
|
-
|
199
|
-
fieldrefs
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
class ParamRef
|
204
|
-
def self.from_soap_obj(mparamrefs)
|
205
|
-
mparamrefs = [mparamrefs] if !mparamrefs.respond_to?(:each)
|
206
|
-
|
207
|
-
paramrefs = []
|
208
|
-
mparamrefs.each do |mparamref|
|
209
|
-
paramrefs.push(ParamRef.new(
|
210
|
-
VOTable::_find_attr_value(mparamref.__xmlattr, 'ref')
|
211
|
-
))
|
212
|
-
end
|
213
|
-
|
214
|
-
paramrefs
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
class Field
|
219
|
-
def self.from_soap_obj(mfields)
|
220
|
-
mfields = [mfields] if !mfields.respond_to?(:each)
|
221
|
-
|
222
|
-
fields = []
|
223
|
-
mfields.each do |mfield|
|
224
|
-
datatype_txt = VOTable::_find_attr_value(mfield.__xmlattr, 'datatype')
|
225
|
-
ucd_txt = VOTable::_find_attr_value(mfield.__xmlattr, 'ucd')
|
226
|
-
precision_txt = VOTable::_find_attr_value(mfield.__xmlattr, 'precision')
|
227
|
-
width_txt = VOTable::_find_attr_value(mfield.__xmlattr, 'width')
|
228
|
-
arraysize_txt = VOTable::_find_attr_value(mfield.__xmlattr, 'arraysize')
|
229
|
-
type_txt = VOTable::_find_attr_value(mfield.__xmlattr, 'type')
|
230
|
-
|
231
|
-
fields.push(Field.new(
|
232
|
-
VOTable::_find_attr_value(mfield.__xmlattr, 'name'),
|
233
|
-
(datatype_txt == nil)? nil: Type::DataType.new(datatype_txt),
|
234
|
-
(ucd_txt == nil)? nil: Type::UCDType.new(ucd_txt),
|
235
|
-
VOTable::_find_attr_value(mfield.__xmlattr, 'unit'),
|
236
|
-
(mfield.respond_to?(:dESCRIPTION))? Description.from_soap_obj(mfield.dESCRIPTION): nil,
|
237
|
-
(mfield.respond_to?(:vALUES))? Values.from_soap_obj(mfield.vALUES): nil,
|
238
|
-
(mfield.respond_to?(:lINK))? Link.from_soap_obj(mfield.lINK): [],
|
239
|
-
VOTable::_find_attr_value(mfield.__xmlattr, 'ID'),
|
240
|
-
(precision_txt == nil)? nil: Type::PrecisionType.new(precision_txt),
|
241
|
-
VOTable::_find_attr_value(mfield.__xmlattr, 'utype'),
|
242
|
-
(width_txt == nil)? nil: Type::PositiveInteger.new(width_txt.to_i),
|
243
|
-
VOTable::_find_attr_value(mfield.__xmlattr, 'ref'),
|
244
|
-
(arraysize_txt == nil)? nil: Type::ArrayDef.new(arraysize_txt),
|
245
|
-
(type_txt == nil)? nil: Type::FieldType.new(type_txt)
|
246
|
-
))
|
247
|
-
end
|
248
|
-
|
249
|
-
fields
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
class Link
|
254
|
-
def self.from_soap_obj(mlinks)
|
255
|
-
mlinks = [mlinks] if !mlinks.respond_to?(:each)
|
256
|
-
|
257
|
-
links = []
|
258
|
-
mlinks.each do |mlink|
|
259
|
-
href_txt = VOTable::_find_attr_value(mlink.__xmlattr, 'href')
|
260
|
-
action_txt = VOTable::_find_attr_value(mlink.__xmlattr, 'action')
|
261
|
-
content_role_txt = VOTable::_find_attr_value(mlink.__xmlattr, 'content-role')
|
262
|
-
|
263
|
-
links.push(Link.new(
|
264
|
-
(href_txt == nil)? nil: Type::AnyURI.new(href_txt),
|
265
|
-
VOTable::_find_attr_value(mlink.__xmlattr, 'value'),
|
266
|
-
VOTable::_find_attr_value(mlink.__xmlattr, 'title'),
|
267
|
-
(action_txt == nil)? nil: Type::AnyURI.new(action_txt),
|
268
|
-
VOTable::_find_attr_value(mlink.__xmlattr, 'ID'),
|
269
|
-
VOTable::_find_attr_value(mlink.__xmlattr, 'content-type'),
|
270
|
-
(content_role_txt == nil)? nil: Type::ContentRole.new(content_role_txt),
|
271
|
-
VOTable::_find_attr_value(mlink.__xmlattr, 'ghref')
|
272
|
-
))
|
273
|
-
end
|
274
|
-
|
275
|
-
links
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
class Values
|
280
|
-
def self.from_soap_obj(mvalues)
|
281
|
-
type_txt = VOTable::_find_attr_value(mvalues.__xmlattr, 'type') || 'legal'
|
282
|
-
|
283
|
-
Values.new(
|
284
|
-
(mvalues.respond_to?(:mIN))? Min.from_soap_obj(mvalues.mIN): nil,
|
285
|
-
(mvalues.respond_to?(:mAX))? Max.from_soap_obj(mvalues.mAX): nil,
|
286
|
-
(mvalues.respond_to?(:oPTIONS))? Option.from_soap_obj(mvalues.oPTIONS): [],
|
287
|
-
VOTable::_find_attr_value(mvalues.__xmlattr, 'ID'),
|
288
|
-
(type_txt == nil)? nil: Type::ValuesType.new(type_txt),
|
289
|
-
VOTable::_find_attr_value(mvalues.__xmlattr, 'null'),
|
290
|
-
VOTable::_find_attr_value(mvalues.__xmlattr, 'ref')
|
291
|
-
)
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
class Option
|
296
|
-
def self.from_soap_obj(moptions)
|
297
|
-
options = []
|
298
|
-
moptions.each do |moption|
|
299
|
-
options.push(Option.new(
|
300
|
-
VOTable::_find_attr_value(mvalues.__xmlattr, 'value'),
|
301
|
-
VOTable::_find_attr_value(mvalues.__xmlattr, 'name'),
|
302
|
-
(moption.respond_to?(:oPTION))? Option.from_soap_obj(moption.oPTION): []
|
303
|
-
))
|
304
|
-
end
|
305
|
-
|
306
|
-
options
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
class Min
|
311
|
-
def self.from_soap_obj(mmin)
|
312
|
-
inclusive_txt = VOTable::_find_attr_value(mmin.__xmlattr, 'inclusive') || 'yes'
|
313
|
-
|
314
|
-
Min.new(
|
315
|
-
VOTable::_find_attr_value(mmin.__xmlattr, 'value'),
|
316
|
-
Type::YesNo.new(inclusive_txt)
|
317
|
-
)
|
318
|
-
end
|
319
|
-
end
|
320
|
-
|
321
|
-
class Max
|
322
|
-
def self.from_soap_obj(mmax)
|
323
|
-
inclusive_txt = VOTable::_find_attr_value(mmax.__xmlattr, 'inclusive') || 'yes'
|
324
|
-
|
325
|
-
Max.new(
|
326
|
-
VOTable::_find_attr_value(mmax.__xmlattr, 'value'),
|
327
|
-
Type::YesNo.new(inclusive_txt)
|
328
|
-
)
|
329
|
-
end
|
330
|
-
end
|
331
|
-
|
332
|
-
end
|
333
|
-
|
334
|
-
module Data
|
335
|
-
|
336
|
-
class Data
|
337
|
-
def self.from_soap_obj(mdata)
|
338
|
-
# Note that strictly one can also have a FITS or BINARY stream here
|
339
|
-
Data.new(
|
340
|
-
(mdata.respond_to?(:tABLEDATA))? TableData.from_soap_obj(mdata.tABLEDATA): nil
|
341
|
-
)
|
342
|
-
end
|
343
|
-
end
|
344
|
-
|
345
|
-
class TableData
|
346
|
-
def self.from_soap_obj(mtbldata)
|
347
|
-
TableData.new(
|
348
|
-
(mtbldata.respond_to?(:tR))? TR.from_soap_obj(mtbldata.tR): []
|
349
|
-
)
|
350
|
-
end
|
351
|
-
end
|
352
|
-
|
353
|
-
class TR
|
354
|
-
def self.from_soap_obj(mtrs)
|
355
|
-
mtrs = [mtrs] if !mtrs.respond_to?(:each)
|
356
|
-
|
357
|
-
trs = []
|
358
|
-
mtrs.each do |tr|
|
359
|
-
trs.push(
|
360
|
-
(tr.respond_to?(:tD))? TR.new(TD.from_soap_obj(tr.tD)): []
|
361
|
-
)
|
362
|
-
end
|
363
|
-
|
364
|
-
trs
|
365
|
-
end
|
366
|
-
end
|
367
|
-
|
368
|
-
class TD
|
369
|
-
def self.from_soap_obj(mtds)
|
370
|
-
mtds = [mtds] if !mtds.respond_to?(:each)
|
371
|
-
|
372
|
-
tds = []
|
373
|
-
mtds.each do |td|
|
374
|
-
tds.push(TD.new(
|
375
|
-
td,
|
376
|
-
(td.respond_to?(:__xmlattr))? VOTable::_find_attr_value(td.__xmlattr, 'encoding'): Type::EncodingType.new('none')
|
377
|
-
))
|
378
|
-
end
|
379
|
-
|
380
|
-
tds
|
381
|
-
end
|
382
|
-
end
|
383
|
-
|
384
|
-
end
|
385
|
-
end
|
386
|
-
|
387
|
-
end
|
388
|
-
end
|