voruby 1.0.1
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/LICENSE +339 -0
- data/REQUIREMENTS +4 -0
- data/Rakefile.rb +296 -0
- data/lib/voruby/adql/adql.rb +2735 -0
- data/lib/voruby/adql/ext.rb +15 -0
- data/lib/voruby/adql/loader.rb +5 -0
- data/lib/voruby/adql/operations.rb +54 -0
- data/lib/voruby/adql/parser.rb +160 -0
- data/lib/voruby/adql/transforms.rb +573 -0
- data/lib/voruby/ext.rb +17 -0
- data/lib/voruby/loader.rb +4 -0
- data/lib/voruby/misc/propertyfile.rb +36 -0
- data/lib/voruby/plastic/applications.rb +174 -0
- data/lib/voruby/plastic/constants.rb +30 -0
- data/lib/voruby/plastic/loader.rb +10 -0
- data/lib/voruby/plastic/plastic.rb +1 -0
- data/lib/voruby/resources/conesearch/conesearch.rb +9 -0
- data/lib/voruby/resources/conesearch/conesearch_v0_2.rb +55 -0
- data/lib/voruby/resources/conesearch/conesearch_v0_3.rb +50 -0
- data/lib/voruby/resources/conesearch/conesearch_v1_0.rb +72 -0
- data/lib/voruby/resources/conesearch/loader.rb +4 -0
- data/lib/voruby/resources/loader.rb +50 -0
- data/lib/voruby/resources/nodes.rb +190 -0
- data/lib/voruby/resources/openskynode/loader.rb +4 -0
- data/lib/voruby/resources/openskynode/openskynode.rb +9 -0
- data/lib/voruby/resources/openskynode/openskynode_v0_1.rb +54 -0
- data/lib/voruby/resources/sia/loader.rb +5 -0
- data/lib/voruby/resources/sia/sia.rb +9 -0
- data/lib/voruby/resources/sia/sia_v0_6.rb +90 -0
- data/lib/voruby/resources/sia/sia_v0_7.rb +89 -0
- data/lib/voruby/resources/sia/sia_v1_0.rb +122 -0
- data/lib/voruby/resources/stsci.rb +59 -0
- data/lib/voruby/resources/vodataservice/coverage_v0_2.rb +195 -0
- data/lib/voruby/resources/vodataservice/coverage_v0_3.rb +158 -0
- data/lib/voruby/resources/vodataservice/loader.rb +5 -0
- data/lib/voruby/resources/vodataservice/vodataservice.rb +9 -0
- data/lib/voruby/resources/vodataservice/vodataservice_v0_4.rb +189 -0
- data/lib/voruby/resources/vodataservice/vodataservice_v0_5.rb +163 -0
- data/lib/voruby/resources/vodataservice/vodataservice_v1_0.rb +221 -0
- data/lib/voruby/resources/voregistry/loader.rb +4 -0
- data/lib/voruby/resources/voregistry/voregistry.rb +9 -0
- data/lib/voruby/resources/voregistry/voregistry_v0_2.rb +40 -0
- data/lib/voruby/resources/voregistry/voregistry_v0_3.rb +30 -0
- data/lib/voruby/resources/voregistry/voregistry_v1_0.rb +86 -0
- data/lib/voruby/resources/voresource/loader.rb +17 -0
- data/lib/voruby/resources/voresource/voresource.rb +9 -0
- data/lib/voruby/resources/voresource/voresource_v0_10.rb +322 -0
- data/lib/voruby/resources/voresource/voresource_v0_9.rb +405 -0
- data/lib/voruby/resources/voresource/voresource_v1_0.rb +230 -0
- data/lib/voruby/services/ext.rb +11 -0
- data/lib/voruby/services/gestalt/footprint.rb +95 -0
- data/lib/voruby/services/gestalt/wcs_fixer.rb +105 -0
- data/lib/voruby/services/gestalt/wesix.rb +155 -0
- data/lib/voruby/services/loader.rb +7 -0
- data/lib/voruby/services/registry/registry.rb +53 -0
- data/lib/voruby/services/resolver/resolver.rb +35 -0
- data/lib/voruby/sesame/loader.rb +6 -0
- data/lib/voruby/sesame/sesame_v1_0.rb +64 -0
- data/lib/voruby/simple/loader.rb +6 -0
- data/lib/voruby/simple/parameters.rb +196 -0
- data/lib/voruby/simple/sap.rb +446 -0
- data/lib/voruby/spacetime/loader.rb +3 -0
- data/lib/voruby/spacetime/spacetime.rb +607 -0
- data/lib/voruby/stc/coords_v1_20.rb +900 -0
- data/lib/voruby/stc/loader.rb +55 -0
- data/lib/voruby/stc/region_v1_20.rb +274 -0
- data/lib/voruby/stc/stc_v1_20.rb +1196 -0
- data/lib/voruby/util.rb +27 -0
- data/lib/voruby/voevent/loader.rb +7 -0
- data/lib/voruby/voevent/voevent_v1_0.rb +213 -0
- data/lib/voruby/voevent/voevent_v1_1.rb +196 -0
- data/lib/voruby/votables/chandra.rb +410 -0
- data/lib/voruby/votables/cnoc.rb +393 -0
- data/lib/voruby/votables/data.rb +179 -0
- data/lib/voruby/votables/galex.rb +390 -0
- data/lib/voruby/votables/hst.rb +391 -0
- data/lib/voruby/votables/int.rb +391 -0
- data/lib/voruby/votables/libxml_parser.rb +411 -0
- data/lib/voruby/votables/libxml_votable.rb +67 -0
- data/lib/voruby/votables/loader.rb +10 -0
- data/lib/voruby/votables/meta.rb +763 -0
- data/lib/voruby/votables/misc.rb +51 -0
- data/lib/voruby/votables/nsa.rb +393 -0
- data/lib/voruby/votables/nsar3.rb +410 -0
- data/lib/voruby/votables/rexml_parser.rb +408 -0
- data/lib/voruby/votables/rexml_votable.rb +67 -0
- data/lib/voruby/votables/sdss.rb +393 -0
- data/lib/voruby/votables/transforms.rb +388 -0
- data/lib/voruby/votables/tree.rb +45 -0
- data/lib/voruby/votables/types.rb +391 -0
- data/lib/voruby/votables/votable.rb +630 -0
- data/lib/voruby/votables/xmm.rb +394 -0
- data/test/adql/test1.adql +49 -0
- data/test/adql/test2.adql +51 -0
- data/test/adql/test3.adql +81 -0
- data/test/adql/test4.adql +53 -0
- data/test/adql/test5.adql +55 -0
- data/test/adql/test6.adql +18 -0
- data/test/adql/test7.adql +48 -0
- data/test/adql/unittest.rb +1672 -0
- data/test/plastic/test.rb +44 -0
- data/test/plastic/test.vot +5385 -0
- data/test/plastic/unittest.rb +66 -0
- data/test/resources/conesearch/conesearch_v0_3.xml +31 -0
- data/test/resources/conesearch/conesearch_v1_0.xml +86 -0
- data/test/resources/conesearch/unittest_v0_3.rb +22 -0
- data/test/resources/conesearch/unittest_v1_0.rb +24 -0
- data/test/resources/openskynode/open_sky_node_v0_1.xml +32 -0
- data/test/resources/openskynode/unittest_v0_1.rb +31 -0
- data/test/resources/sia/simple_image_access_v0_7.xml +36 -0
- data/test/resources/sia/simple_image_access_v1_0.xml +122 -0
- data/test/resources/sia/unittest_v0_7.rb +24 -0
- data/test/resources/sia/unittest_v1_0.rb +29 -0
- data/test/resources/stsci.xml +336 -0
- data/test/resources/unittest_stsci.rb +25 -0
- data/test/resources/vodataservice/catalog_service_resource_v1_0.xml +128 -0
- data/test/resources/vodataservice/data_collection_resource_v0_5.xml +54 -0
- data/test/resources/vodataservice/data_collection_resource_v1_0.xml +117 -0
- data/test/resources/vodataservice/data_service_resource_v1_0.xml +115 -0
- data/test/resources/vodataservice/sky_service_resource_v0_10.xml +45 -0
- data/test/resources/vodataservice/table_service_resource_v1_0.xml +122 -0
- data/test/resources/vodataservice/tabular_sky_service_resource_v0_10.xml +60 -0
- data/test/resources/vodataservice/unittest_v0_5.rb +126 -0
- data/test/resources/vodataservice/unittest_v1_0.rb +151 -0
- data/test/resources/voregistry/authority_resource_v0_3.xml +20 -0
- data/test/resources/voregistry/authority_resource_v1_0.xml +82 -0
- data/test/resources/voregistry/registry_service_v0_3.xml +20 -0
- data/test/resources/voregistry/registry_service_v1_0.xml +107 -0
- data/test/resources/voregistry/unittest_v0_3.rb +31 -0
- data/test/resources/voregistry/unittest_v1_0.rb +34 -0
- data/test/resources/voresource/organisation_resource_v1_0.xml +90 -0
- data/test/resources/voresource/resource_organisation_v0_10.xml +22 -0
- data/test/resources/voresource/resource_service_v0_10.xml +19 -0
- data/test/resources/voresource/resource_v0_10.xml +19 -0
- data/test/resources/voresource/resource_v1_0.xml +79 -0
- data/test/resources/voresource/service_resource_v1_0.xml +91 -0
- data/test/resources/voresource/unittest_v0_10.rb +61 -0
- data/test/resources/voresource/unittest_v0_9.rb +4 -0
- data/test/resources/voresource/unittest_v1_0.rb +190 -0
- data/test/services/gestalt/unittest.rb +74 -0
- data/test/services/registry/unittest.rb +34 -0
- data/test/services/resolver/unittest.rb +38 -0
- data/test/simple/unittest.rb +46 -0
- data/test/spacetime/unittest.rb +39 -0
- data/test/stc/catalog_entry_location_v1_20.xml +112 -0
- data/test/stc/obs_data_location_v1_20.xml +108 -0
- data/test/stc/search_location_v1_20.xml +54 -0
- data/test/stc/stc_resource_profile_v1_20.xml +60 -0
- data/test/stc/unittest_v1_20.rb +620 -0
- data/test/voevent/unittest_v1_0.rb +79 -0
- data/test/voevent/unittest_v1_1.rb +70 -0
- data/test/voevent/voevent_v1_0.xml +96 -0
- data/test/voevent/voevent_v1_1.xml +76 -0
- data/test/votables/test.vot +366 -0
- data/test/votables/unittest.rb +54 -0
- metadata +256 -0
@@ -0,0 +1,763 @@
|
|
1
|
+
module VORuby
|
2
|
+
module VOTables
|
3
|
+
module VOTable
|
4
|
+
|
5
|
+
# These classes essentially comprise a ruby VOTable domain model and as such
|
6
|
+
# much of the documentation available about VOTable at the IVOA is
|
7
|
+
# relevant. If you'd like more information than what's outlined
|
8
|
+
# in the comments (and you probably will) the
|
9
|
+
# VOTable Format Definition[http://www.ivoa.net/Documents/latest/VOT.html]
|
10
|
+
# is a good place to start.
|
11
|
+
module Meta
|
12
|
+
|
13
|
+
# A class representing the standard VOTable DESCRIPTION element.
|
14
|
+
class Description
|
15
|
+
attr_reader :text
|
16
|
+
|
17
|
+
# [_txt_:] The text of the description.
|
18
|
+
def initialize(txt=nil)
|
19
|
+
@text = txt
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
"{#{@text}}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# A class representing the standard VOTable DEFINITIONS element.
|
28
|
+
class Definitions
|
29
|
+
attr_reader :coosys, :params
|
30
|
+
|
31
|
+
# [_coosys_:]
|
32
|
+
# A list of coordinate systems (Type: Meta::CooSys).
|
33
|
+
# [_params_:]
|
34
|
+
# A list of parameters (Type: Meta::Param).
|
35
|
+
def initialize(coosys=[], params=[])
|
36
|
+
coosys.each{ |sys|
|
37
|
+
Misc::TypeCheck.new(sys, Meta::CooSys).check()
|
38
|
+
}
|
39
|
+
@coosys = coosys
|
40
|
+
|
41
|
+
params.each{ |param|
|
42
|
+
Misc::TypeCheck.new(param, Meta::Param).check()
|
43
|
+
}
|
44
|
+
@params = params
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_s
|
48
|
+
coosys = @coosys.collect{|x| x.to_s}.join('|')
|
49
|
+
params = @params.collect{|x| x.to_s}.join('|')
|
50
|
+
|
51
|
+
"coosys=#{coosys};params=#{params}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# A class representing the standard VOTable COOSYS element.
|
56
|
+
class CooSys
|
57
|
+
attr_reader :id, :equinox, :epoch, :system
|
58
|
+
|
59
|
+
# [_id_:]
|
60
|
+
# The ID of the coordinate system.
|
61
|
+
# [_equinox_:]
|
62
|
+
# The equinox of the coordinate system (Type: Type::AstroYear).
|
63
|
+
# [_epoch_:]
|
64
|
+
# The epoch of the coordinate system (Type: Type::AstroYear).
|
65
|
+
# [_system_:]
|
66
|
+
# The system of the coordinate system (Type: Type::CoordSystemType).
|
67
|
+
def initialize(id=nil, equinox=nil, epoch=nil, system=Type::CoordSystemType.new('eq_FK5'))
|
68
|
+
raise "Coordinate system must define an ID" if !id
|
69
|
+
|
70
|
+
@id = id
|
71
|
+
|
72
|
+
Misc::TypeCheck.new(equinox, Type::AstroYear).check() if equinox
|
73
|
+
@equinox = equinox
|
74
|
+
|
75
|
+
Misc::TypeCheck.new(epoch, Type::AstroYear).check() if epoch
|
76
|
+
@epoch = epoch
|
77
|
+
|
78
|
+
Misc::TypeCheck.new(system, Type::CoordSystemType).check() if system
|
79
|
+
@system = system
|
80
|
+
end
|
81
|
+
|
82
|
+
def to_s
|
83
|
+
"{id=#{@id};equinox=#{@equinox};epoch=#{@epoch};system=#{@system}}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# A class representing the standard VOTable LINK element.
|
88
|
+
class Link
|
89
|
+
attr_reader :id, :content_role, :content_type, :title, :value,
|
90
|
+
:href, :action, :gref
|
91
|
+
|
92
|
+
# [_href_:]
|
93
|
+
# The URI of the link (Type: Type::AnyURI).
|
94
|
+
# [_value_:]
|
95
|
+
# The actual value of the link.
|
96
|
+
# [_title_:]
|
97
|
+
# The title of the link.
|
98
|
+
# [_action_:]
|
99
|
+
# The action associated with the link (Type: Type::AnyURI).
|
100
|
+
# [_id_:]
|
101
|
+
# An ID to assign to the link.
|
102
|
+
# [_content_type_:]
|
103
|
+
# The content Type of the linked to media.
|
104
|
+
# [_content_role_:]
|
105
|
+
# The content role of the linked to media (Type: Type::ContentRole)
|
106
|
+
# [_gref_:]
|
107
|
+
# The GLU reference.
|
108
|
+
def initialize(href=nil, value=nil, title=nil, action=nil,
|
109
|
+
id=nil, content_type=nil, content_role=nil, gref=nil)
|
110
|
+
|
111
|
+
Misc::TypeCheck.new(href, Type::AnyURI).check()
|
112
|
+
@href = href
|
113
|
+
|
114
|
+
@value = value
|
115
|
+
@title = title
|
116
|
+
|
117
|
+
Misc::TypeCheck.new(action, Type::AnyURI).check()
|
118
|
+
@action = action
|
119
|
+
|
120
|
+
@content_type = content_type
|
121
|
+
|
122
|
+
Misc::TypeCheck.new(content_role, Type::ContentRole).check()
|
123
|
+
@content_role = content_role
|
124
|
+
|
125
|
+
@id = id
|
126
|
+
|
127
|
+
@gref = gref
|
128
|
+
end
|
129
|
+
|
130
|
+
def to_s
|
131
|
+
"{href=#{@href};value=#{@value};title=#{@title};action=#{@action};" +
|
132
|
+
"content-type=#{@content_type};content-role=#{content_role};" +
|
133
|
+
"id=#{@id}}"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# A class representing the standard VOTable VALUES element.
|
138
|
+
class Values
|
139
|
+
attr_reader :min, :max, :options, :id, :type, :null, :ref
|
140
|
+
|
141
|
+
# [_min_:]
|
142
|
+
# The minimum value of the described quantity (Type: Meta::Min).
|
143
|
+
# [_max_:]
|
144
|
+
# The maximum value of the described quantity (Type: Meta::Max).
|
145
|
+
# [_options_:]
|
146
|
+
# A list of options (keywords) associated with the value (Type: Meta::Option).
|
147
|
+
# [_id_:]
|
148
|
+
# An ID to assign to the value.
|
149
|
+
# [_Type_:]
|
150
|
+
# The Type of the value (Type: Type::ValuesType).
|
151
|
+
# [_null_:]
|
152
|
+
# The value used to define non-existent data.
|
153
|
+
# [_ref_:]
|
154
|
+
# A reference to an already extant domain definition.
|
155
|
+
def initialize(min=nil, max=nil, options=[], id=nil, type=Type::ValuesType.new('legal'),
|
156
|
+
null=nil, ref=nil)
|
157
|
+
|
158
|
+
Misc::TypeCheck.new(min, Meta::Min).check()
|
159
|
+
@min = min
|
160
|
+
|
161
|
+
raise Misc::TypeException.new(max, Meta::Max) if max and !max.is_a?(Max)
|
162
|
+
Misc::TypeCheck.new(max, Meta::Max).check()
|
163
|
+
|
164
|
+
options.each{ |option|
|
165
|
+
Misc::TypeCheck.new(option, Meta::Option).check()
|
166
|
+
}
|
167
|
+
@options = options
|
168
|
+
|
169
|
+
@id = id
|
170
|
+
|
171
|
+
Misc::TypeCheck.new(Type, Type::ValuesType).check()
|
172
|
+
@type = type
|
173
|
+
|
174
|
+
@null = null
|
175
|
+
@ref = ref
|
176
|
+
end
|
177
|
+
|
178
|
+
def to_s
|
179
|
+
options = @options.collect{|x| x.to_s}.join('|')
|
180
|
+
|
181
|
+
"{min=#{@min};max=#{@max};" +
|
182
|
+
"options=#{options};" +
|
183
|
+
"id=#{@id};type=#{@type};null=#{@null};ref=#{@ref}}"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# A class representing the standard VOTable FIELDref element.
|
188
|
+
class FieldRef
|
189
|
+
attr_reader :ref
|
190
|
+
|
191
|
+
# [_ref_:]
|
192
|
+
# A reference to a FIELD element.
|
193
|
+
def initialize(ref=nil)
|
194
|
+
raise "Field reference must define a reference" if ref == nil
|
195
|
+
|
196
|
+
@ref = ref
|
197
|
+
end
|
198
|
+
|
199
|
+
def to_s
|
200
|
+
"{#{@ref}}"
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# A class representing the standard VOTable PARAMref element.
|
205
|
+
class ParamRef
|
206
|
+
attr_reader :ref
|
207
|
+
|
208
|
+
# [_ref_:]
|
209
|
+
# A reference to a PARAM element.
|
210
|
+
def initialize(ref=nil)
|
211
|
+
raise "Parameter reference must define a reference" if ref == nil
|
212
|
+
|
213
|
+
@ref = ref
|
214
|
+
end
|
215
|
+
|
216
|
+
def to_s
|
217
|
+
"{#{@ref}}"
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# A class representing the standard VOTable GROUP element.
|
222
|
+
class Group
|
223
|
+
attr_reader :description, :field_refs, :param_refs, :params,
|
224
|
+
:groups, :id, :name, :ref, :ucd, :uType
|
225
|
+
|
226
|
+
# [_name_:]
|
227
|
+
# A name to refer to the group as.
|
228
|
+
# [_ucd_:]
|
229
|
+
# The UCD used to describe the group (Type: Type::UCDType).
|
230
|
+
# [_description_:]
|
231
|
+
# A description of the group (Type: Meta::Description).
|
232
|
+
# [_field_refs_:]
|
233
|
+
# A list of references to fields (Type: Meta:FieldRef).
|
234
|
+
# [_param_refs_:]
|
235
|
+
# A list of references to parameters (Type: Meta::Param).
|
236
|
+
# [_params_:]
|
237
|
+
# A list of parameters (Type: Meta::Param).
|
238
|
+
# [_groups_:]
|
239
|
+
# A list of subgroups (Type: Meta::Group).
|
240
|
+
# [_id_:]
|
241
|
+
# An ID to uniquely identify the group.
|
242
|
+
# [_ref_:]
|
243
|
+
# A reference to the "real" group.
|
244
|
+
# [_uType_:]
|
245
|
+
# The unique Type of the group.
|
246
|
+
def initialize(name=nil, ucd=nil, description=nil, field_refs=[], param_refs=[],
|
247
|
+
params=[], groups=[], id=nil, ref=nil, utype=nil)
|
248
|
+
|
249
|
+
Misc::TypeCheck.new(description, Meta::Description).check()
|
250
|
+
@description = description
|
251
|
+
|
252
|
+
field_refs.each{ |fieldref|
|
253
|
+
Misc::TypeCheck.new(fieldref, Meta::FieldRef).check()
|
254
|
+
}
|
255
|
+
@field_refs = field_refs
|
256
|
+
|
257
|
+
param_refs.each{ |paramref|
|
258
|
+
Misc::TypeCheck.new(paramref, Meta::ParamRef).check()
|
259
|
+
}
|
260
|
+
@param_refs = param_refs
|
261
|
+
|
262
|
+
params.each{ |param|
|
263
|
+
Misc::TypeCheck.new(param, Meta::Param).check()
|
264
|
+
}
|
265
|
+
@params = params
|
266
|
+
|
267
|
+
groups.each{ |group|
|
268
|
+
Misc::TypeCheck.new(group, Meta::Group).check()
|
269
|
+
}
|
270
|
+
@groups = groups
|
271
|
+
|
272
|
+
@id = id
|
273
|
+
@name = name
|
274
|
+
@ref = ref
|
275
|
+
|
276
|
+
Misc::TypeCheck.new(ucd, Type::UCDType).check()
|
277
|
+
@ucd = ucd
|
278
|
+
|
279
|
+
@utype = utype
|
280
|
+
end
|
281
|
+
|
282
|
+
def to_s
|
283
|
+
field_refs = @field_refs.collect{|x| x.to_s}.join('|')
|
284
|
+
param_refs = @param_refs.collect{|x| x.to_s}.join('|')
|
285
|
+
params = @params.collect{|x| x.to_s}.join('|')
|
286
|
+
groups = @groups.collect{|x| x.to_s}.join('|')
|
287
|
+
|
288
|
+
"{name=#{@name};ucd=#{@ucd};description=#{@description};" +
|
289
|
+
"field_refs=#{field_refs};" +
|
290
|
+
"param_refs=#{param_refs};" +
|
291
|
+
"params=#{params};" +
|
292
|
+
"groups=#{groups};" +
|
293
|
+
"id=#{@id};ref=#{@ref};utype=#{@utype}}"
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
# A class representing the standard VOTable PARAM group.
|
298
|
+
class Param
|
299
|
+
attr_reader :description, :values, :links, :id, :unit, :datatype,
|
300
|
+
:precision, :width, :ref, :name, :ucd, :uType, :value,
|
301
|
+
:arraysize
|
302
|
+
|
303
|
+
# [_name_:]
|
304
|
+
# The name of the parameter.
|
305
|
+
# [_datatype_:]
|
306
|
+
# The datatype of the parameter (Type: Type::DataType).
|
307
|
+
# [_value_:]
|
308
|
+
# The value of the parameter.
|
309
|
+
# [_ucd_:]
|
310
|
+
# The UCD of the parameter (Type: Type::UCDType).
|
311
|
+
# [_unit_:]
|
312
|
+
# The units of the value.
|
313
|
+
# [_description_:]
|
314
|
+
# A description of the parameter (Type: VOTALE::Meta::Description).
|
315
|
+
# [_values_:]
|
316
|
+
# Domain values for the parameter (Type: Meta::Values).
|
317
|
+
# [_links_:]
|
318
|
+
# A collection of links associated with the parameter (Type: VOTable:Meta::Values).
|
319
|
+
# [_id_:]
|
320
|
+
# A unique identifier for the parameter.
|
321
|
+
# [_precision_:]
|
322
|
+
# The precision of the parameter (Type: Meta::PrecisionType).
|
323
|
+
# [_utype_:]
|
324
|
+
# The unique type of the parameter.
|
325
|
+
# [_width_:]
|
326
|
+
# The number of characters to use for input or output (Type: Type::PositiveInteger).
|
327
|
+
# [_ref_:]
|
328
|
+
# A reference to another parameter.
|
329
|
+
# [_arraysize_:]
|
330
|
+
# The arraysize definition for the parameter (Type: Type::ArrayDef).
|
331
|
+
def initialize(name=nil, datatype=nil, value=nil, ucd=nil, unit=nil,
|
332
|
+
description=nil, values=nil, links=[], id=nil,
|
333
|
+
precision=nil, utype=nil, width=nil, ref=nil,
|
334
|
+
arraysize=nil)
|
335
|
+
#raise "Param must define a data Type" if datatype == nil
|
336
|
+
raise "Param must define a name" if name == nil
|
337
|
+
#raise "Param must define a value" if value == nil
|
338
|
+
|
339
|
+
@name = name
|
340
|
+
|
341
|
+
Misc::TypeCheck.new(datatype, Type::DataType).check()
|
342
|
+
@datatype = datatype
|
343
|
+
|
344
|
+
@value = value
|
345
|
+
|
346
|
+
Misc::TypeCheck.new(ucd, Type::UCDType).check()
|
347
|
+
@ucd = ucd
|
348
|
+
|
349
|
+
@unit = unit
|
350
|
+
|
351
|
+
Misc::TypeCheck.new(description, Meta::Description).check()
|
352
|
+
@description = description
|
353
|
+
|
354
|
+
Misc::TypeCheck.new(values, Meta::Values).check()
|
355
|
+
@values = values
|
356
|
+
|
357
|
+
links.each{ |link|
|
358
|
+
Misc::TypeCheck.new(link, Meta::Link).check()
|
359
|
+
}
|
360
|
+
@links = links
|
361
|
+
|
362
|
+
@id = id
|
363
|
+
|
364
|
+
Misc::TypeCheck.new(precision, Type::PrecisionType).check()
|
365
|
+
@precision = precision
|
366
|
+
|
367
|
+
@utype = utype
|
368
|
+
|
369
|
+
Misc::TypeCheck.new(width, Type::PositiveInteger).check()
|
370
|
+
@width = width
|
371
|
+
|
372
|
+
@ref = ref
|
373
|
+
|
374
|
+
Misc::TypeCheck.new(arraysize, Type::ArrayDef).check()
|
375
|
+
@arraysize = arraysize
|
376
|
+
end
|
377
|
+
|
378
|
+
def to_s
|
379
|
+
links = @links.collect{|x| x.to_s}.join('|')
|
380
|
+
|
381
|
+
"{name=#{@name};datatype=#{@datatype};value=#{@value};" +
|
382
|
+
"ucd=#{@ucd};unit=#{@unit};description=#{@description};" +
|
383
|
+
"values=#{@values};links=#{links};" +
|
384
|
+
"id=#{@id};precision=#{@precision};utype=#{@utype};width=#{@width};" +
|
385
|
+
"ref=#{@ref};arraysize=#{@arraysize}}"
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
# A class representing the standard VOTable FIELD element.
|
390
|
+
class Field
|
391
|
+
attr_reader :description, :values, :links, :id, :unit, :datatype,
|
392
|
+
:precision, :width, :ref, :name, :ucd, :uType,
|
393
|
+
:arraysize, :Type
|
394
|
+
|
395
|
+
# [_name_:]
|
396
|
+
# The name of the field.
|
397
|
+
# [_datatype_:]
|
398
|
+
# The datatype of the field (Type: Type::DataType).
|
399
|
+
# [_ucd_:]
|
400
|
+
# The UCD of the field (Type: Type::UCDType).
|
401
|
+
# [_unit_:]
|
402
|
+
# The units of the value.
|
403
|
+
# [_description_:]
|
404
|
+
# A description of the field (Type: VOTALE::Meta::Description).
|
405
|
+
# [_values_:]
|
406
|
+
# Domain values for the field (Type: Meta::Values).
|
407
|
+
# [_links_:]
|
408
|
+
# A collection of links associated with the field (Type: VOTable:Meta::Values).
|
409
|
+
# [_id_:]
|
410
|
+
# A unique identifier for the field.
|
411
|
+
# [_precision_:]
|
412
|
+
# The precision of the field (Type: Meta::PrecisionType).
|
413
|
+
# [_utype_:]
|
414
|
+
# The unique type of the field.
|
415
|
+
# [_width_:]
|
416
|
+
# The number of characters to use for input or output (Type: Type::PositiveInteger).
|
417
|
+
# [_ref_:]
|
418
|
+
# A reference to another field.
|
419
|
+
# [_arraysize_:]
|
420
|
+
# The arraysize definition for the field (Type: Type::ArrayDef).
|
421
|
+
# [_type_:]
|
422
|
+
# The type of the field (Type: Type::FieldType).
|
423
|
+
def initialize(name=nil, datatype=nil, ucd=nil, unit=nil,
|
424
|
+
description=nil, values=nil, links=[], id=nil,
|
425
|
+
precision=nil, utype=nil, width=nil, ref=nil,
|
426
|
+
arraysize=nil, type=nil)
|
427
|
+
raise "Field must define a data type" if datatype == nil
|
428
|
+
#raise "Field must define a name" if name == nil
|
429
|
+
|
430
|
+
@name = name
|
431
|
+
|
432
|
+
Misc::TypeCheck.new(datatype, Type::DataType).check()
|
433
|
+
@datatype = datatype
|
434
|
+
|
435
|
+
Misc::TypeCheck.new(ucd, Type::UCDType).check()
|
436
|
+
@ucd = ucd
|
437
|
+
|
438
|
+
@unit = unit
|
439
|
+
|
440
|
+
Misc::TypeCheck.new(description, Meta::Description).check()
|
441
|
+
@description = description
|
442
|
+
|
443
|
+
Misc::TypeCheck.new(values, Meta::Values).check()
|
444
|
+
@values = values
|
445
|
+
|
446
|
+
links.each{ |link|
|
447
|
+
Misc::TypeCheck.new(link, Meta::Link).check()
|
448
|
+
}
|
449
|
+
@links = links
|
450
|
+
|
451
|
+
@id = id
|
452
|
+
|
453
|
+
Misc::TypeCheck.new(precision, Type::PrecisionType).check()
|
454
|
+
@precision = precision
|
455
|
+
|
456
|
+
@utype = utype
|
457
|
+
|
458
|
+
Misc::TypeCheck.new(width, Type::PositiveInteger).check()
|
459
|
+
@width = width
|
460
|
+
|
461
|
+
@ref = ref
|
462
|
+
|
463
|
+
Misc::TypeCheck.new(arraysize, Type::ArrayDef).check()
|
464
|
+
@arraysize = arraysize
|
465
|
+
|
466
|
+
Misc::TypeCheck.new(type, Type::FieldType).check()
|
467
|
+
@type = type
|
468
|
+
end
|
469
|
+
|
470
|
+
def to_s
|
471
|
+
links = @links.collect{|x| x.to_s}.join('|')
|
472
|
+
|
473
|
+
"{name=#{@name};datatype=#{@datatype};" +
|
474
|
+
"ucd=#{@ucd};unit=#{@unit};description=#{@description};" +
|
475
|
+
"values=#{@values};links=#{links};" +
|
476
|
+
"id=#{@id};precision=#{@precision};utype=#{@utype};width=#{@width};" +
|
477
|
+
"ref=#{@ref};arraysize=#{@arraysize};type=#{@type}}"
|
478
|
+
end
|
479
|
+
end
|
480
|
+
|
481
|
+
# A class representing the standard VOTable INFO element.
|
482
|
+
class Info
|
483
|
+
attr_reader :id, :name, :value, :text
|
484
|
+
|
485
|
+
# [_name_:]
|
486
|
+
# The name of the name/value pair.
|
487
|
+
# [_value_:]
|
488
|
+
# The value of the name/value pair.
|
489
|
+
# [_id_:]
|
490
|
+
# The unique identifier of the name/value pair.
|
491
|
+
def initialize(name=nil, value=nil, id=nil, text=nil)
|
492
|
+
# raise "Info must define a name" if name == nil
|
493
|
+
# raise "Info must define a value" if value == nil
|
494
|
+
|
495
|
+
@name = name
|
496
|
+
@value = value
|
497
|
+
@id = id
|
498
|
+
@text = text
|
499
|
+
end
|
500
|
+
|
501
|
+
def to_s
|
502
|
+
"{name=#{@name};value=#{@value};id=#{@id};text=#{@text}}"
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
506
|
+
# A class representing the standard VOTable TABLE element.
|
507
|
+
class Table
|
508
|
+
attr_reader :description, :fields, :params, :groups, :links,
|
509
|
+
:data, :id, :name, :ref, :ucd, :uType, :nrows
|
510
|
+
|
511
|
+
# [_name_:]
|
512
|
+
# The name of the table.
|
513
|
+
# [_id_:]
|
514
|
+
# The id of the table.
|
515
|
+
# [_ucd_:]
|
516
|
+
# A UCD describing the table (Type: Type::UCDType).
|
517
|
+
# [_utype_:]
|
518
|
+
# A unique type describing the table.
|
519
|
+
# [_ref_:]
|
520
|
+
# A reference to another table.
|
521
|
+
# [_nrows_:]
|
522
|
+
# The number of rows in the table (Type: Type::NonNegativeInteger)
|
523
|
+
# [_description_:]
|
524
|
+
# A description of the table (Type: Meta::Description)
|
525
|
+
# [_fields_:]
|
526
|
+
# A list of fields associated with the table (Type: Meta::Field).
|
527
|
+
# [_params_:]
|
528
|
+
# A list of parameters associated with the table (Type: Meta::Param).
|
529
|
+
# [_groups_:]
|
530
|
+
# A list of groups associated with the table (Type: Meta::Group).
|
531
|
+
# [_links_:]
|
532
|
+
# A list of links associated with the table (Type: Meta::Link).
|
533
|
+
# [_data_:]
|
534
|
+
# The actual data associated with the table (Type: DATA::Data).
|
535
|
+
def initialize(name=nil, id=nil, ucd=nil, utype=nil, ref=nil,
|
536
|
+
nrows=nil, description=nil, fields=[], params=[],
|
537
|
+
groups=[], links=[], data=nil)
|
538
|
+
|
539
|
+
@name = name
|
540
|
+
@id = id
|
541
|
+
|
542
|
+
Misc::TypeCheck.new(ucd, Type::UCDType).check()
|
543
|
+
@ucd = ucd
|
544
|
+
|
545
|
+
@utype = utype
|
546
|
+
@ref = ref
|
547
|
+
|
548
|
+
Misc::TypeCheck.new(nrows, Type::NonNegativeInteger).check()
|
549
|
+
@nrows = nrows
|
550
|
+
|
551
|
+
Misc::TypeCheck.new(description, Meta::Description).check()
|
552
|
+
@description = description
|
553
|
+
|
554
|
+
fields.each{ |field|
|
555
|
+
Misc::TypeCheck.new(field, Meta::Field).check()
|
556
|
+
}
|
557
|
+
@fields = fields
|
558
|
+
|
559
|
+
params.each{ |param|
|
560
|
+
Misc::TypeCheck.new(param, Meta::Param).check()
|
561
|
+
}
|
562
|
+
@params = params
|
563
|
+
|
564
|
+
groups.each{ |group|
|
565
|
+
Misc::TypeCheck.new(group, Meta::Group).check()
|
566
|
+
}
|
567
|
+
@groups = groups
|
568
|
+
|
569
|
+
links.each{ |link|
|
570
|
+
Misc::TypeCheck.new(link, Meta::Link).check()
|
571
|
+
}
|
572
|
+
@links = links
|
573
|
+
|
574
|
+
Misc::TypeCheck.new(data, Data::Data).check()
|
575
|
+
@data = data
|
576
|
+
end
|
577
|
+
|
578
|
+
def to_s
|
579
|
+
fields = @fields.each{|x| x.to_s}.join('|')
|
580
|
+
params = @params.each{|x| x.to_s}.join('|')
|
581
|
+
groups = @groups.each{|x| x.to_s}.join('|')
|
582
|
+
links = @links.each{|x| x.to_s}.join('|')
|
583
|
+
|
584
|
+
"{name=#{@name};id=#{@id};ucd=#{@ucd};utype=#{@utype};ref=#{@ref};" +
|
585
|
+
"nrows=#{@nrows};description=#{@description};" +
|
586
|
+
"fields=#{fields};" +
|
587
|
+
"params=#{params};" +
|
588
|
+
"groups=#{groups};" +
|
589
|
+
"links=#{links};" +
|
590
|
+
"data=#{@data}}"
|
591
|
+
end
|
592
|
+
end
|
593
|
+
|
594
|
+
# A class representing the standard VOTable RESOURCE element.
|
595
|
+
class Resource
|
596
|
+
attr_reader :description, :info, :coosys, :params, :links, :tables,
|
597
|
+
:resources, :name, :id, :uType, :Type
|
598
|
+
|
599
|
+
# [_name_:]
|
600
|
+
# The name of the resource.
|
601
|
+
# [_id_:]
|
602
|
+
# The ID of the resource.
|
603
|
+
# [_utype_:]
|
604
|
+
# The unique type of the resource.
|
605
|
+
# [_type_:]
|
606
|
+
# The type of resource (Type: Type::ResourceType).
|
607
|
+
# [_description_:]
|
608
|
+
# A description of the resource (Type: Meta::Description).
|
609
|
+
# [_info_:]
|
610
|
+
# A list of information about the resource (Type: Meta::Info).
|
611
|
+
# [_coosys_:]
|
612
|
+
# A list of coordinate systems (Type: Meta::CooSys).
|
613
|
+
# [_params_:]
|
614
|
+
# A list of parameters (Type: Meta::Param).
|
615
|
+
# [_links_:]
|
616
|
+
# A list of links associated with the resource (Type: Meta::Link).
|
617
|
+
# [_tables_:]
|
618
|
+
# A list of tables associated with the resource (Type: Meta::Table).
|
619
|
+
# [_resources_:]
|
620
|
+
# A list of subresources (Type: Meta::Resource).
|
621
|
+
def initialize(name=nil, id=nil, utype=nil, type=ResourceType.new('results'),
|
622
|
+
description=nil, info=[], coosys=[], params=[], links=[],
|
623
|
+
tables=[], resources=[])
|
624
|
+
|
625
|
+
@name = name
|
626
|
+
@id = id
|
627
|
+
@utype = utype
|
628
|
+
|
629
|
+
Misc::TypeCheck.new(type, Type::ResourceType).check()
|
630
|
+
@type = type
|
631
|
+
|
632
|
+
Misc::TypeCheck.new(description, Meta::Description).check()
|
633
|
+
@description = description
|
634
|
+
|
635
|
+
info.each{ |inf|
|
636
|
+
Misc::TypeCheck.new(inf, Meta::Info).check()
|
637
|
+
}
|
638
|
+
@info = info
|
639
|
+
|
640
|
+
coosys.each{ |sys|
|
641
|
+
Misc::TypeCheck.new(sys, Meta::CooSys).check()
|
642
|
+
}
|
643
|
+
@coosys = coosys
|
644
|
+
|
645
|
+
params.each{ |param|
|
646
|
+
Misc::TypeCheck.new(param, Meta::Param).check()
|
647
|
+
}
|
648
|
+
@params = params
|
649
|
+
|
650
|
+
links.each{ |link|
|
651
|
+
Misc::TypeCheck.new(link, Meta::Link).check()
|
652
|
+
}
|
653
|
+
@links = links
|
654
|
+
|
655
|
+
tables.each{ |table|
|
656
|
+
Misc::TypeCheck.new(table, Meta::Table).check()
|
657
|
+
}
|
658
|
+
@tables = tables
|
659
|
+
|
660
|
+
resources.each{ |res|
|
661
|
+
Misc::TypeCheck.new(res, Meta::Resource).check()
|
662
|
+
}
|
663
|
+
@resources = resources
|
664
|
+
end
|
665
|
+
|
666
|
+
def to_s
|
667
|
+
info = @info.each{|x| x.to_s}.join('|')
|
668
|
+
coosys = @coosys.each{|x| x.to_s}.join('|')
|
669
|
+
params = @params.each{|x| x.to_s}.join('|')
|
670
|
+
links = @links.each{|x| x.to_s}.join('|')
|
671
|
+
tables = @tables.each{|x| x.to_s}.join('|')
|
672
|
+
resources = @resources.each{|x| x.to_s}.join('|')
|
673
|
+
|
674
|
+
"{name=#{@name};id=#{@id};utype=#{@utype};type=#{@type};" +
|
675
|
+
"description=#{@description};" +
|
676
|
+
"info=#{info};" +
|
677
|
+
"coosys=#{coosys};" +
|
678
|
+
"params=#{params};" +
|
679
|
+
"links=#{links};" +
|
680
|
+
"tables=#{tables};" +
|
681
|
+
"resources=#{resources}}"
|
682
|
+
end
|
683
|
+
end
|
684
|
+
|
685
|
+
# A class representing the standard VOTable OPTION element.
|
686
|
+
class Option
|
687
|
+
attr_reader :value, :name, :options
|
688
|
+
|
689
|
+
# [_value_:]
|
690
|
+
# The value of the optional quantity.
|
691
|
+
# [_name_:]
|
692
|
+
# The name of the option.
|
693
|
+
# [_options_:]
|
694
|
+
# A list of suboptions (Type: Meta::Option).
|
695
|
+
def initialize(value=nil, name=nil, options=[])
|
696
|
+
#raise "Option must have a value" if value == nil
|
697
|
+
|
698
|
+
@value = value
|
699
|
+
@name = name
|
700
|
+
|
701
|
+
options.each{ |option|
|
702
|
+
Misc::TypeCheck.new(option, Meta::Option).check()
|
703
|
+
}
|
704
|
+
@options = options
|
705
|
+
end
|
706
|
+
|
707
|
+
def to_s
|
708
|
+
options = @options.collect{|x| x.to_s}.join('|')
|
709
|
+
|
710
|
+
"{value=#{@value};name=#{@name};" +
|
711
|
+
"options=#{options}}"
|
712
|
+
end
|
713
|
+
end
|
714
|
+
|
715
|
+
# A class representing the standard VOTable MAX element.
|
716
|
+
class Max
|
717
|
+
attr_reader :value, :inclusive
|
718
|
+
|
719
|
+
# [_value_:]
|
720
|
+
# The maximum value of a quantity.
|
721
|
+
# [_inclusive_:]
|
722
|
+
# Whether the value is inclusive (Type: Type::YesNo).
|
723
|
+
def initialize(value=nil, inclusive=Type::YesNo.new('yes'))
|
724
|
+
raise "Max must have a value" if value == nil
|
725
|
+
|
726
|
+
@value = value
|
727
|
+
|
728
|
+
Misc::TypeCheck.new(inclusive, Type::YesNo).check()
|
729
|
+
@inclusive = inclusive
|
730
|
+
end
|
731
|
+
|
732
|
+
def to_s
|
733
|
+
"{value=#{@value};inclusive=#{@inclusive}}"
|
734
|
+
end
|
735
|
+
end
|
736
|
+
|
737
|
+
# Class representing the standard VOTable MIN element.
|
738
|
+
class Min
|
739
|
+
attr_reader :value, :inclusive
|
740
|
+
|
741
|
+
# [_value_:]
|
742
|
+
# The minimum value of a quantity.
|
743
|
+
# [_inclusive_:]
|
744
|
+
# Whether the value is inclusive (Type: Type::YesNo).
|
745
|
+
def initialize(value=nil, inclusive=Type::YesNo.new('yes'))
|
746
|
+
raise "Min must have a value" if value == nil
|
747
|
+
|
748
|
+
@value = value
|
749
|
+
|
750
|
+
Misc::TypeCheck.new(inclusive, Type::YesNo).check()
|
751
|
+
@inclusive = inclusive
|
752
|
+
end
|
753
|
+
|
754
|
+
def to_s
|
755
|
+
"{value=#{@value};inclusive=#{@inclusive}}"
|
756
|
+
end
|
757
|
+
end
|
758
|
+
|
759
|
+
end
|
760
|
+
end
|
761
|
+
|
762
|
+
end
|
763
|
+
end
|