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.
Files changed (257) hide show
  1. data/Rakefile.rb +107 -224
  2. data/lib/misc.rb +1 -0
  3. data/lib/misc/misc.rb +60 -0
  4. data/lib/misc/propertyfile.rb +31 -0
  5. data/lib/symphony.rb +1 -0
  6. data/lib/symphony/symphony.rb +247 -0
  7. data/lib/voruby.rb +186 -0
  8. data/lib/voruby/active_votable/active_votable.rb +468 -347
  9. data/lib/voruby/adql/1.0/adql.rb +2418 -0
  10. data/lib/voruby/adql/support.rb +2 -0
  11. data/lib/voruby/misc.rb +351 -0
  12. data/lib/voruby/misc/connection_monitor.rb +97 -0
  13. data/lib/voruby/misc/libxml_ext.rb +121 -0
  14. data/lib/voruby/misc/rexml_ext.rb +223 -0
  15. data/lib/voruby/resolver/resolver.rb +12 -0
  16. data/lib/voruby/resolver/sesame.rb +299 -0
  17. data/lib/voruby/sky_query/sky_query.rb +192 -0
  18. data/lib/voruby/stc/1.10/coords.rb +2272 -0
  19. data/lib/voruby/stc/1.10/region.rb +892 -0
  20. data/lib/voruby/stc/1.10/stc.rb +3271 -0
  21. data/lib/voruby/stc/1.30/stc.rb +8666 -0
  22. data/lib/voruby/stc/support.rb +2 -0
  23. data/lib/voruby/ucd/ucd.rb +173 -0
  24. data/lib/voruby/voevent/1.1/voevent.rb +1124 -0
  25. data/lib/voruby/voevent/support.rb +5 -0
  26. data/lib/voruby/votable/1.0/votable.rb +1807 -0
  27. data/lib/voruby/votable/1.1/votable.rb +2100 -0
  28. data/lib/voruby/votable/votable.rb +305 -0
  29. data/lib/voruby/wesix/wesix.rb +491 -0
  30. data/lib/voruby/xlink/1.2/xlink.rb +21 -0
  31. data/test/voruby/active_votable/complex.vot +60 -0
  32. data/test/voruby/active_votable/error.vot +6 -0
  33. data/test/voruby/active_votable/large.vot +130040 -0
  34. data/test/voruby/active_votable/simple1.vot +38 -0
  35. data/test/voruby/active_votable/simple2.vot +38 -0
  36. data/test/voruby/active_votable/test.rb +193 -0
  37. data/test/voruby/adql/1.0/adql-alias.sql +1 -0
  38. data/test/voruby/adql/1.0/adql-alias.xml +26 -0
  39. data/test/voruby/adql/1.0/adql-avg.sql +1 -0
  40. data/test/voruby/adql/1.0/adql-avg.xml +31 -0
  41. data/test/voruby/adql/1.0/adql-circle.sql +1 -0
  42. data/test/voruby/adql/1.0/adql-circle.xml +46 -0
  43. data/test/voruby/adql/1.0/adql-expr.sql +1 -0
  44. data/test/voruby/adql/1.0/adql-expr.xml +34 -0
  45. data/test/voruby/adql/1.0/adql-function.sql +1 -0
  46. data/test/voruby/adql/1.0/adql-function.xml +41 -0
  47. data/test/voruby/adql/1.0/adql-group.sql +1 -0
  48. data/test/voruby/adql/1.0/adql-group.xml +51 -0
  49. data/test/voruby/adql/1.0/adql-having.sql +1 -0
  50. data/test/voruby/adql/1.0/adql-having.xml +25 -0
  51. data/test/voruby/adql/1.0/adql-like.sql +1 -0
  52. data/test/voruby/adql/1.0/adql-like.xml +17 -0
  53. data/test/voruby/adql/1.0/adql-order.sql +1 -0
  54. data/test/voruby/adql/1.0/adql-order.xml +37 -0
  55. data/test/voruby/adql/1.0/adql-simple.sql +1 -0
  56. data/test/voruby/adql/1.0/adql-simple.xml +12 -0
  57. data/test/voruby/adql/1.0/adql-top.sql +1 -0
  58. data/test/voruby/adql/1.0/adql-top.xml +33 -0
  59. data/test/voruby/adql/1.0/test.rb +2220 -0
  60. data/test/voruby/misc/test.rb +32 -0
  61. data/test/voruby/resolver/sesame/test.rb +56 -0
  62. data/test/voruby/sky_query/test.rb +107 -0
  63. data/test/voruby/stc/1.10/coords_test.rb +3704 -0
  64. data/test/voruby/stc/1.10/region_test.rb +993 -0
  65. data/test/voruby/stc/1.10/stc-catalog-entry-location.xml +112 -0
  66. data/test/voruby/stc/1.10/stc-obs-data-location.xml +126 -0
  67. data/test/voruby/stc/1.10/stc-region-circle.xml +5 -0
  68. data/test/voruby/stc/1.10/stc-region-convex.xml +11 -0
  69. data/test/voruby/stc/1.10/stc-region-convexhull.xml +5 -0
  70. data/test/voruby/stc/1.10/stc-region-ellipse.xml +7 -0
  71. data/test/voruby/stc/1.10/stc-region-intersection.xml +25 -0
  72. data/test/voruby/stc/1.10/stc-region-negation.xml +7 -0
  73. data/test/voruby/stc/1.10/stc-region-polygon.xml +13 -0
  74. data/test/voruby/stc/1.10/stc-region-sector.xml +6 -0
  75. data/test/voruby/stc/1.10/stc-region-union.xml +25 -0
  76. data/test/voruby/stc/1.10/stc-resource-profile.xml +60 -0
  77. data/test/voruby/stc/1.10/stc-search-location.xml +54 -0
  78. data/test/voruby/stc/1.10/stc_test.rb +4626 -0
  79. data/test/voruby/stc/1.30/stc-catalog-entry-location.xml +210 -0
  80. data/test/voruby/stc/1.30/stc-obs-data-location-arecibo.xml +353 -0
  81. data/test/voruby/stc/1.30/stc-obs-data-location-fits.xml +250 -0
  82. data/test/voruby/stc/1.30/stc-obs-data-location-xlink.xml +63 -0
  83. data/test/voruby/stc/1.30/stc-obs-data-location.xml +216 -0
  84. data/test/voruby/stc/1.30/stc-resource-profile-unusual-ref-pos.xml +39 -0
  85. data/test/voruby/stc/1.30/stc-resource-profile.xml +129 -0
  86. data/test/voruby/stc/1.30/stc-search-location-arecibo.xml +86 -0
  87. data/test/voruby/stc/1.30/stc-search-location.xml +101 -0
  88. data/test/voruby/stc/1.30/test.rb +6274 -0
  89. data/test/voruby/ucd/test.rb +48 -0
  90. data/test/voruby/voevent/1.1/test.rb +812 -0
  91. data/test/{voevent/voevent_v1_1.xml → voruby/voevent/1.1/voevent.xml} +2 -2
  92. data/test/voruby/voregistry/0.3/test.rb +137 -0
  93. data/test/voruby/votable/1.0/test.rb +714 -0
  94. data/test/voruby/votable/1.0/votable.basic.xml +660 -0
  95. data/test/voruby/votable/1.0/votable.html +86 -0
  96. data/test/voruby/votable/1.0/votable.ns.xml +56 -0
  97. data/test/voruby/votable/1.1/test.rb +785 -0
  98. data/test/voruby/votable/1.1/votable.basic.xml +38 -0
  99. data/test/voruby/votable/1.1/votable.html +86 -0
  100. data/test/voruby/votable/1.1/votable.ns.xml +56 -0
  101. data/test/voruby/votable/test.rb +15 -0
  102. data/test/voruby/wesix/test.rb +268 -0
  103. data/test/voruby/wesix/testr.fits +28 -0
  104. metadata +234 -247
  105. data/REQUIREMENTS +0 -6
  106. data/lib/voruby/active_votable/loader.rb +0 -5
  107. data/lib/voruby/adql/adql.rb +0 -2787
  108. data/lib/voruby/adql/ext.rb +0 -14
  109. data/lib/voruby/adql/loader.rb +0 -6
  110. data/lib/voruby/adql/operations.rb +0 -54
  111. data/lib/voruby/adql/parser.rb +0 -160
  112. data/lib/voruby/adql/transforms.rb +0 -573
  113. data/lib/voruby/ext.rb +0 -17
  114. data/lib/voruby/loader.rb +0 -4
  115. data/lib/voruby/misc/propertyfile.rb +0 -36
  116. data/lib/voruby/plastic/applications.rb +0 -174
  117. data/lib/voruby/plastic/constants.rb +0 -30
  118. data/lib/voruby/plastic/loader.rb +0 -10
  119. data/lib/voruby/plastic/plastic.rb +0 -1
  120. data/lib/voruby/resources/conesearch/conesearch.rb +0 -9
  121. data/lib/voruby/resources/conesearch/conesearch_v0_2.rb +0 -55
  122. data/lib/voruby/resources/conesearch/conesearch_v0_3.rb +0 -50
  123. data/lib/voruby/resources/conesearch/conesearch_v1_0.rb +0 -72
  124. data/lib/voruby/resources/conesearch/loader.rb +0 -4
  125. data/lib/voruby/resources/loader.rb +0 -50
  126. data/lib/voruby/resources/nodes.rb +0 -190
  127. data/lib/voruby/resources/openskynode/loader.rb +0 -4
  128. data/lib/voruby/resources/openskynode/openskynode.rb +0 -9
  129. data/lib/voruby/resources/openskynode/openskynode_v0_1.rb +0 -54
  130. data/lib/voruby/resources/sia/loader.rb +0 -5
  131. data/lib/voruby/resources/sia/sia.rb +0 -9
  132. data/lib/voruby/resources/sia/sia_v0_6.rb +0 -90
  133. data/lib/voruby/resources/sia/sia_v0_7.rb +0 -89
  134. data/lib/voruby/resources/sia/sia_v1_0.rb +0 -122
  135. data/lib/voruby/resources/stsci.rb +0 -59
  136. data/lib/voruby/resources/vodataservice/coverage_v0_2.rb +0 -195
  137. data/lib/voruby/resources/vodataservice/coverage_v0_3.rb +0 -158
  138. data/lib/voruby/resources/vodataservice/loader.rb +0 -5
  139. data/lib/voruby/resources/vodataservice/vodataservice.rb +0 -9
  140. data/lib/voruby/resources/vodataservice/vodataservice_v0_4.rb +0 -189
  141. data/lib/voruby/resources/vodataservice/vodataservice_v0_5.rb +0 -163
  142. data/lib/voruby/resources/vodataservice/vodataservice_v1_0.rb +0 -221
  143. data/lib/voruby/resources/voregistry/loader.rb +0 -4
  144. data/lib/voruby/resources/voregistry/voregistry.rb +0 -9
  145. data/lib/voruby/resources/voregistry/voregistry_v0_2.rb +0 -40
  146. data/lib/voruby/resources/voregistry/voregistry_v0_3.rb +0 -30
  147. data/lib/voruby/resources/voregistry/voregistry_v1_0.rb +0 -86
  148. data/lib/voruby/resources/voresource/loader.rb +0 -17
  149. data/lib/voruby/resources/voresource/voresource.rb +0 -9
  150. data/lib/voruby/resources/voresource/voresource_v0_10.rb +0 -327
  151. data/lib/voruby/resources/voresource/voresource_v0_9.rb +0 -405
  152. data/lib/voruby/resources/voresource/voresource_v1_0.rb +0 -230
  153. data/lib/voruby/services/ext.rb +0 -11
  154. data/lib/voruby/services/gestalt/footprint.rb +0 -95
  155. data/lib/voruby/services/gestalt/wcs_fixer.rb +0 -105
  156. data/lib/voruby/services/gestalt/wesix.rb +0 -155
  157. data/lib/voruby/services/loader.rb +0 -7
  158. data/lib/voruby/services/registry/registry.rb +0 -53
  159. data/lib/voruby/services/resolver/resolver.rb +0 -35
  160. data/lib/voruby/services/schema/schema.rb +0 -644
  161. data/lib/voruby/sesame/loader.rb +0 -6
  162. data/lib/voruby/sesame/sesame_v1_0.rb +0 -64
  163. data/lib/voruby/simple/loader.rb +0 -6
  164. data/lib/voruby/simple/parameters.rb +0 -196
  165. data/lib/voruby/simple/sap.rb +0 -446
  166. data/lib/voruby/spacetime/loader.rb +0 -3
  167. data/lib/voruby/spacetime/spacetime.rb +0 -607
  168. data/lib/voruby/stc/coords_v1_20.rb +0 -900
  169. data/lib/voruby/stc/loader.rb +0 -55
  170. data/lib/voruby/stc/region_v1_20.rb +0 -274
  171. data/lib/voruby/stc/stc_v1_20.rb +0 -1196
  172. data/lib/voruby/util.rb +0 -27
  173. data/lib/voruby/voevent/loader.rb +0 -7
  174. data/lib/voruby/voevent/voevent_v1_0.rb +0 -213
  175. data/lib/voruby/voevent/voevent_v1_1.rb +0 -196
  176. data/lib/voruby/votables/chandra.rb +0 -373
  177. data/lib/voruby/votables/data.rb +0 -179
  178. data/lib/voruby/votables/galex.rb +0 -377
  179. data/lib/voruby/votables/int.rb +0 -354
  180. data/lib/voruby/votables/libxml_parser.rb +0 -411
  181. data/lib/voruby/votables/libxml_votable.rb +0 -67
  182. data/lib/voruby/votables/loader.rb +0 -10
  183. data/lib/voruby/votables/meta.rb +0 -763
  184. data/lib/voruby/votables/misc.rb +0 -51
  185. data/lib/voruby/votables/nsa.rb +0 -410
  186. data/lib/voruby/votables/rexml_parser.rb +0 -408
  187. data/lib/voruby/votables/rexml_votable.rb +0 -67
  188. data/lib/voruby/votables/sdss.rb +0 -356
  189. data/lib/voruby/votables/transforms.rb +0 -388
  190. data/lib/voruby/votables/tree.rb +0 -45
  191. data/lib/voruby/votables/types.rb +0 -391
  192. data/lib/voruby/votables/votable.rb +0 -687
  193. data/test/active_votable/database.yml +0 -6
  194. data/test/active_votable/test.vot +0 -168492
  195. data/test/active_votable/unittest.rb +0 -41
  196. data/test/adql/test1.adql +0 -49
  197. data/test/adql/test2.adql +0 -51
  198. data/test/adql/test3.adql +0 -81
  199. data/test/adql/test4.adql +0 -53
  200. data/test/adql/test5.adql +0 -55
  201. data/test/adql/test6.adql +0 -18
  202. data/test/adql/test7.adql +0 -48
  203. data/test/adql/unittest.rb +0 -1672
  204. data/test/plastic/test.rb +0 -44
  205. data/test/plastic/test.vot +0 -5385
  206. data/test/plastic/unittest.rb +0 -66
  207. data/test/resources/conesearch/conesearch_v0_3.xml +0 -31
  208. data/test/resources/conesearch/conesearch_v1_0.xml +0 -86
  209. data/test/resources/conesearch/unittest_v0_3.rb +0 -22
  210. data/test/resources/conesearch/unittest_v1_0.rb +0 -24
  211. data/test/resources/openskynode/open_sky_node_v0_1.xml +0 -32
  212. data/test/resources/openskynode/unittest_v0_1.rb +0 -31
  213. data/test/resources/sia/simple_image_access_v0_7.xml +0 -36
  214. data/test/resources/sia/simple_image_access_v1_0.xml +0 -122
  215. data/test/resources/sia/unittest_v0_7.rb +0 -24
  216. data/test/resources/sia/unittest_v1_0.rb +0 -29
  217. data/test/resources/stsci.xml +0 -336
  218. data/test/resources/unittest_stsci.rb +0 -25
  219. data/test/resources/vodataservice/catalog_service_resource_v1_0.xml +0 -128
  220. data/test/resources/vodataservice/data_collection_resource_v0_5.xml +0 -54
  221. data/test/resources/vodataservice/data_collection_resource_v1_0.xml +0 -117
  222. data/test/resources/vodataservice/data_service_resource_v1_0.xml +0 -115
  223. data/test/resources/vodataservice/sky_service_resource_v0_10.xml +0 -45
  224. data/test/resources/vodataservice/table_service_resource_v1_0.xml +0 -122
  225. data/test/resources/vodataservice/tabular_sky_service_resource_v0_10.xml +0 -60
  226. data/test/resources/vodataservice/unittest_v0_5.rb +0 -126
  227. data/test/resources/vodataservice/unittest_v1_0.rb +0 -151
  228. data/test/resources/voregistry/authority_resource_v0_3.xml +0 -20
  229. data/test/resources/voregistry/authority_resource_v1_0.xml +0 -82
  230. data/test/resources/voregistry/registry_service_v0_3.xml +0 -20
  231. data/test/resources/voregistry/registry_service_v1_0.xml +0 -107
  232. data/test/resources/voregistry/unittest_v0_3.rb +0 -31
  233. data/test/resources/voregistry/unittest_v1_0.rb +0 -34
  234. data/test/resources/voresource/organisation_resource_v1_0.xml +0 -90
  235. data/test/resources/voresource/resource_organisation_v0_10.xml +0 -22
  236. data/test/resources/voresource/resource_service_v0_10.xml +0 -19
  237. data/test/resources/voresource/resource_v0_10.xml +0 -19
  238. data/test/resources/voresource/resource_v1_0.xml +0 -79
  239. data/test/resources/voresource/service_resource_v1_0.xml +0 -91
  240. data/test/resources/voresource/unittest_v0_10.rb +0 -61
  241. data/test/resources/voresource/unittest_v0_9.rb +0 -4
  242. data/test/resources/voresource/unittest_v1_0.rb +0 -190
  243. data/test/services/gestalt/unittest.rb +0 -74
  244. data/test/services/registry/unittest.rb +0 -34
  245. data/test/services/resolver/unittest.rb +0 -38
  246. data/test/simple/unittest.rb +0 -46
  247. data/test/spacetime/unittest.rb +0 -39
  248. data/test/stc/catalog_entry_location_v1_20.xml +0 -112
  249. data/test/stc/obs_data_location_v1_20.xml +0 -108
  250. data/test/stc/search_location_v1_20.xml +0 -54
  251. data/test/stc/stc_resource_profile_v1_20.xml +0 -60
  252. data/test/stc/unittest_v1_20.rb +0 -620
  253. data/test/voevent/unittest_v1_0.rb +0 -79
  254. data/test/voevent/unittest_v1_1.rb +0 -70
  255. data/test/voevent/voevent_v1_0.xml +0 -96
  256. data/test/votables/test.vot +0 -366
  257. data/test/votables/unittest.rb +0 -54
@@ -1,67 +0,0 @@
1
- module VORuby
2
- module VOTables
3
-
4
- module VOTable
5
- require 'voruby/votables/votable'
6
- require 'voruby/votables/libxml_parser'
7
-
8
- # A wrapper around VOTable::VOTable that uses the libxml2 library and
9
- # its corresponding bindings[http://rubyforge.org/projects/xml-tools/]
10
- # to parse XML. Typically one would use VOTable::TreeParsedVOTable
11
- # rather than using this class directly.
12
- # libxml_votable = VOTable::LibxmlParsedVOTable('my_votable.xml')
13
- # votable = libxml_votable.votable
14
- class LibxmlParsedVOTable
15
- attr_reader :path, :votable
16
-
17
- # [_path_:]
18
- # The path to the VOTable XML file to parse.
19
- def initialize(path)
20
- @path = path ;
21
- doc = XML::Document.file(path)
22
-
23
- root = doc.root # Root document
24
-
25
- # Attributes
26
- id = root['ID'] if root['ID']
27
- version = root['version'] if root['version']
28
-
29
- # Elements
30
- description =
31
- Meta::Description.from_xml(root.find('DESCRIPTION').to_a.first) if root.find('DESCRIPTION').length > 0
32
- definition =
33
- Meta::Definitions.from_xml(root.find('DEFINITIONS').to_a.first) if root.find('DEFINITIONS').length > 0
34
-
35
- coosys = []
36
- root.find('COOSYS').each { |sys|
37
- coosys.push(Meta::CooSys.from_xml(sys))
38
- }
39
-
40
- params = []
41
- root.find('PARAM').each { |param|
42
- params.push(Meta::Param.from_xml(param))
43
- }
44
-
45
- info = []
46
- root.find('INFO').each { |inf|
47
- info.push(Meta::Info.from_xml(inf))
48
- }
49
-
50
- resources = []
51
- root.find('RESOURCE').each { |res|
52
- resources.push(Meta::Resource.from_xml(res))
53
- }
54
-
55
- @votable = VOTable.new(id, version, description, definition, coosys, params, info, resources)
56
- end
57
-
58
- # Convert a LibxmlParsedVOTable into a string representation.
59
- def to_s
60
- "{file=#{@path};votable=#{@votable}}"
61
- end
62
- end
63
-
64
- end
65
-
66
- end
67
- end
@@ -1,10 +0,0 @@
1
- require 'date'
2
- require 'uri'
3
- require 'xsd/qname'
4
-
5
- require 'voruby/loader'
6
- require 'voruby/votables/types'
7
- require 'voruby/votables/data'
8
- require 'voruby/votables/meta'
9
- require 'voruby/votables/misc'
10
- require 'voruby/votables/transforms'
@@ -1,763 +0,0 @@
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