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.
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,322 @@
1
+ require 'voruby/resources/voresource/loader'
2
+
3
+ module VORuby
4
+ module Resources
5
+ module VOResource
6
+ module V0_10
7
+
8
+ # Forward declarations
9
+ class Resource; end
10
+ class ShortName; end
11
+ class AnyURI; end
12
+ class IdentifierURI < AnyURI; end
13
+ class Curation; end
14
+ class ResourceName; end
15
+ class Creator; end
16
+ class Date; end
17
+ class Contact; end
18
+ class Content; end
19
+ class String; end
20
+ class Source; end
21
+ class Type; end
22
+ class ContentLevel; end
23
+ class Relationship; end
24
+ class RelationshipType; end
25
+ class AuthorityID; end
26
+ class ResourceKey; end
27
+ class Organisation < Resource; end
28
+ class Service < Resource; end
29
+ class Interface; end
30
+ class AccessURL < AnyURI; end
31
+ class WebBrowser < Interface; end
32
+ class Capability; end
33
+
34
+ # Any entity that is describable and identifiable by a IVOA Identifier.
35
+ class Resource
36
+ include XML::Mapping
37
+
38
+ # the full name given to the resource
39
+ text_node :title, 'title', :optional => false
40
+
41
+ # the date this resource metadata description was created
42
+ date_time_node :created, '@created', :optional => true
43
+ # the date this resource metadata description was last updated
44
+ date_time_node :updated, '@updated', :optional => true
45
+
46
+ # a tag indicating whether this resource is believed to be still actively maintained.
47
+ text_enumeration_node :status, '@status', :optional => true, :default_value => 'active',
48
+ :choices => ['active', 'inactive', 'deleted']
49
+
50
+ # a short name or abbreviation given to the resource.
51
+ object_node :short_name, 'shortName', :class => ShortName, :optional => true
52
+ # unambiguous reference to the resource conforming to the IVOA standard for identifiers
53
+ object_node :identifier, 'identifier', :class => IdentifierURI, :optional => false
54
+ # information regarding the general curation of the resource
55
+ object_node :curation, 'curation', :class => Curation, :optional => false
56
+ # information regarding the general content of the resource
57
+ object_node :content, 'content', :class => Content, :optional => false
58
+ end
59
+
60
+ # A short name or abbreviation given to something.
61
+ class ShortName
62
+ include XML::Mapping
63
+
64
+ text_node :value, '', :optional => false
65
+
66
+ def value=(short_name)
67
+ raise RuntimeError, "ShortName '#{short_name}' must have <= 16 characters" if short_name.size > 16
68
+
69
+ @value = short_name
70
+ end
71
+ end
72
+
73
+ class AnyURI
74
+ include XML::Mapping
75
+
76
+ text_node :value, '', :optional => false
77
+
78
+ def value=(uri)
79
+ @value = URI.parse(uri.strip)
80
+ end
81
+ end
82
+
83
+ class IdentifierURI
84
+ def value=(uri)
85
+ # Strictly, this should be ivo only, but I notice that sometimes http is used.
86
+ #raise RuntimeError, "IdentifierURI '#{uri}' in wrong format" if !uri.strip.match('^(ivo|http):')
87
+
88
+ @value = URI.parse(uri.strip)
89
+ end
90
+ end
91
+
92
+ # Information regarding the general curation of a resource.
93
+ class Curation
94
+ include XML::Mapping
95
+
96
+ # label associated with creation or availablilty of a version of a resource
97
+ text_node :version, 'version', :optional => true
98
+
99
+ # entity (e.g. person or organisation) responsible for making the resource available
100
+ object_node :publisher, 'publisher', :class => ResourceName, :optional => true
101
+ # the entity (e.g. person or organisation) primarily responsible for creating the content or constitution of the resource
102
+ object_node :creator, 'creator', :class => Creator, :optional => true
103
+ # information that can be used for contacting someone with regard to this resource
104
+ object_node :contact, 'contact', :class => Contact, :optional => true
105
+
106
+ # entity responsible for contributions to the content of the resource
107
+ array_node :contributors, 'contributor', :class => ResourceName, :optional => true, :default_value => []
108
+ # date associated with an event in the life cycle of the resource
109
+ array_node :dates, 'date', :class => Date, :optional => true, :default_value => []
110
+ end
111
+
112
+ # The name of a potentially registered resource. That is, the entity referred to may have an associated identifier.
113
+ class ResourceName
114
+ include XML::Mapping
115
+
116
+ text_node :value, '', :optional => false
117
+
118
+ # the URI form of the IVOA identifier for the resource refered to
119
+ object_node :ivo_id, '@ivo-id', :class => IdentifierURI, :optional => true
120
+ end
121
+
122
+ # The entity (e.g. person or organisation) primarily responsible for creating something.
123
+ class Creator
124
+ include XML::Mapping
125
+
126
+ # the name or title of the creating person or organization
127
+ object_node :name, 'name', :class => ResourceName, :optional => false
128
+ # URL pointing to a graphical logo, which may be used to help identify the information source
129
+ object_node :logo, 'logo', :class => AnyURI, :optional => true
130
+ end
131
+
132
+ class Date
133
+ include XML::Mapping
134
+
135
+ text_node :value, '', :optional => false
136
+
137
+ # a string indicating what the date refers to
138
+ text_node :role, 'role', :optional => true, :default_value => 'representative'
139
+
140
+ def value=(v)
141
+ @value = DateTime.parse(v)
142
+ end
143
+ end
144
+
145
+ # Information that can be used for contacting someone.
146
+ class Contact
147
+ include XML::Mapping
148
+
149
+ # the contact mailing address
150
+ text_node :address, 'address', :optional => true
151
+ # the contact email address
152
+ text_node :email, 'email', :optional => true
153
+ # the contact telephone number
154
+ text_node :telephone, 'telephone', :optional => true
155
+
156
+ # the name or title of the contact person
157
+ object_node :name, 'name', :class => ResourceName, :optional => false
158
+ end
159
+
160
+ # Information regarding the general content of a resource.
161
+ class Content
162
+ include XML::Mapping
163
+
164
+ # an account of the nature of the resource
165
+ text_node :description, 'description', :optional => false
166
+
167
+ # a bibliographic reference from which the present resource is derived or extracted
168
+ object_node :source, 'source', :class => Source, :optional => true
169
+ # URL pointing to a human-readable document describing this resource.
170
+ object_node :reference_url, 'referenceURL', :class => AnyURI, :optional => true
171
+
172
+ # list of topics, object types, or other descriptive keywords about the resource
173
+ array_node :subjects, 'subject', :class => String, :optional => true, :default_value => []
174
+ # nature or genre of the content of the resource
175
+ array_node :types, 'type', :class => Type, :optional => true, :default_value => []
176
+ # description of the content level or intended audience
177
+ array_node :content_levels, 'contentLevel', :class => ContentLevel, :optional => true, :default_value => []
178
+ # a description of a relationship to another resource
179
+ array_node :relationships, 'relationship', :class => Relationship, :optional => true, :default_value => []
180
+ end
181
+
182
+ class String
183
+ include XML::Mapping
184
+
185
+ text_node :value, '', :optional => false
186
+ end
187
+
188
+ class Source
189
+ include XML::Mapping
190
+
191
+ text_node :value, '', :optional => false
192
+ # the reference format. Recognized values include "bibcode", refering to a standard astronomical bibcode bibcode
193
+ # (http://cdsweb.u-strasbg.fr/simbad/refcode.html).
194
+ text_node :format, '@format', :optional => true
195
+ end
196
+
197
+ class Type
198
+ include XML::Mapping
199
+
200
+ text_enumeration_node :value, '', :optional => false,
201
+ :choices => ['Other', 'Archive', 'Bibliography', 'Catalog', 'Journal', 'Library',
202
+ 'Simulation', 'Survey', 'Transformation', 'Education', 'Outreach', 'EPOResource',
203
+ 'Animation', 'Artwork', 'Background', 'BasicData', 'Historical', 'Photographic',
204
+ 'Press', 'Organisation', 'Project', 'Registry']
205
+ end
206
+
207
+ class ContentLevel
208
+ include XML::Mapping
209
+
210
+ text_enumeration_node :value, '', :optional => false,
211
+ :choices => ['General', 'Elementary Education', 'Middle School Education', 'Secondary Education',
212
+ 'Community College', 'University', 'Research', 'Amateur', 'Informal Education']
213
+ end
214
+
215
+ # A description of the relationship between one resource and one or more other resources.
216
+ class Relationship
217
+ include XML::Mapping
218
+
219
+ # the named type of relationship
220
+ object_node :relationship_type, 'relationshipType', :class => RelationshipType, :optional => false
221
+
222
+ # the name of resource that this resource is related to
223
+ array_node :related_resources, 'relatedResource', :class => ResourceName, :optional => false
224
+ end
225
+
226
+ class RelationshipType
227
+ include XML::Mapping
228
+
229
+ text_enumeration_node :value, '', :optional => false,
230
+ :choices => ['mirror-of', 'service-for', 'derived-from', 'related-to']
231
+ end
232
+
233
+ class AuthorityID
234
+ include XML::Mapping
235
+
236
+ text_node :value, '', :optional => false
237
+
238
+ def value=(authid)
239
+ raise RuntimeError, "AuthorityID '#{authid} in wrong format" if !authid.match(/^[\w\d][\w\d\-_\.!~\*'\(\)\+=]{2,}$/)
240
+
241
+ @value = authid
242
+ end
243
+ end
244
+
245
+ class ResourceKey
246
+ include XML::Mapping
247
+
248
+ text_node :value, '', :optional => false
249
+
250
+ def value=(reskey)
251
+ raise RuntimeError, "ResourceKey '#{reskey} in wrong format" if !reskey.match("^[\w\d\-_\.!~\*'\(\)\+=]+(/[\w\d\-_\.!~\*'\(\)\+=]+)*$")
252
+
253
+ @value = reskey
254
+ end
255
+ end
256
+
257
+ # A named group of one or more persons brought together to pursue participation in VO applications.
258
+ class Organisation
259
+ # the observatory or facility used to collect the data contained or managed by this resource
260
+ array_node :facilities, 'facility', :class => ResourceName, :optional => true, :default_value => []
261
+ # the instrument used to collect the data contain or managed by a resource.
262
+ array_node :instruments, 'instrument', :class => ResourceName, :optional => true, :default_value => []
263
+ end
264
+
265
+ # A resource that can be invoked by a client to perform some action on its behalf.
266
+ class Service
267
+ # a description of how a client invokes the service
268
+ unmarshaller = Proc.new{ |xml|
269
+ ns_prefix, type = xml.attributes['type'].split(':')
270
+ type = ns_prefix if !type
271
+
272
+ the_module = NAMESPACE_MODULE_MAP[xml.namespace(ns_prefix)]
273
+ the_module = 'VORuby::Resources::VOResource::V_10' if !the_module
274
+
275
+ # The name of the appropriate class corresponds to the type.
276
+ begin
277
+ eval("#{the_module}::#{type}.load_from_xml(xml)") # Would like to get rid of this eval somehow...
278
+ rescue NameError
279
+ Interface.load_from_xml(xml)
280
+ end
281
+ }
282
+ array_node :interfaces, 'interface', :unmarshaller => unmarshaller, :optional => true, :default_value => []
283
+ end
284
+
285
+ # A description of a service interface. Since this type is abstract, one must use an Interface subclass
286
+ # to describe an actual interface.
287
+ class Interface
288
+ include XML::Mapping
289
+
290
+ # the URL (or base URL) that a client uses to access the
291
+ # service. How this URL is to be interpreted and used
292
+ # depends on the specific Interface subclass
293
+ object_node :access_url, 'accessURL', :class => AccessURL, :optional => false
294
+ end
295
+
296
+ # A flag indicating whether this should be interpreted as a base
297
+ # URL, a full URL, or a URL to a directory that will produce a
298
+ # listing of files.
299
+ class AccessURL
300
+ text_enumeration_node :use, '@use', :optional => true,
301
+ :choices => ['full', 'base', 'dir']
302
+ end
303
+
304
+ # A (form-based) interface intended to be accesed interactively by a user via a web browser.
305
+ class WebServer; end
306
+
307
+ # To provide a metadata specific to a particular Service type,
308
+ # this type is usually extended and added as a child of the
309
+ # specific Service subclass.
310
+ class Capability
311
+ include XML::Mapping
312
+
313
+ # an IVOA identifier for a standard service
314
+ object_node :standard_id, '@standardID', :class => IdentifierURI, :optional => true
315
+ # a URL that points to a human-readable document that describes the standard upon which a service is based.
316
+ object_node :standard_url, '@standardURL', :class => AnyURI, :optional => true
317
+ end
318
+
319
+ end
320
+ end
321
+ end
322
+ end