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,55 @@
1
+ require 'rubygems'
2
+ require 'xml/mapping'
3
+
4
+ require 'voruby/loader'
5
+
6
+ require 'voruby/resources/nodes'
7
+ require 'voruby/resources/voresource/voresource_v0_10'
8
+
9
+ module VORuby
10
+ module STC
11
+ def self.dispatch_from_element_name(ns, override=nil)
12
+ Proc.new{ |xml|
13
+ name = (override)? override.call(xml.name): xml.name
14
+ eval("#{ns}::#{name}.load_from_xml(xml)")
15
+ }
16
+ end
17
+
18
+ def self.expand_group(sub_groups, group, expanded=[])
19
+ group_name = (group.is_a?(String))? group: group.to_s.split('::')[-1]
20
+ return if !sub_groups.has_key?(group_name)
21
+
22
+ sub_groups[group_name].each do |klass|
23
+ expanded.push(klass)
24
+
25
+ klass_name = klass.name.split('::')[-1]
26
+ if sub_groups.has_key?(klass_name)
27
+ sub_groups[klass_name].each do |sub_klass|
28
+ expanded.push(sub_klass)
29
+
30
+ sub_klass_name = sub_klass.name.split('::')[-1]
31
+ expand_group(sub_groups, sub_klass, expanded)
32
+ end
33
+ end
34
+ end
35
+
36
+ return expanded
37
+ end
38
+
39
+ def self.group_members(sub_groups, group)
40
+ group_name = (group.is_a?(String))? group: group.to_s.split('::')[-1]
41
+ raise "Substition group #{group_name} does not exist" if !sub_groups.has_key?(group_name)
42
+
43
+ return STC::expand_group(sub_groups, group)
44
+ end
45
+
46
+ def self.group_member_names(group, sub_groups, nsprefix=nil)
47
+ return STC::group_members(sub_groups, group).collect{ |klass|
48
+ element_name = klass.name.split('::')[-1]
49
+ element_name = "#{nsprefix}:#{element_name}" if nsprefix
50
+ element_name
51
+ }
52
+ end
53
+
54
+ end
55
+ end
@@ -0,0 +1,274 @@
1
+ require 'voruby/stc/loader'
2
+
3
+ require 'voruby/stc/coords_v1_20'
4
+ include VORuby::STCcoords::V1_20
5
+
6
+ module VORuby
7
+ module STCregion
8
+ module V1_20
9
+
10
+ # Forward declarations
11
+ class RegionType; end
12
+ class Region; end
13
+ class ShapeType < RegionType; end
14
+ class CircleType < ShapeType; end
15
+ class EllipseType < CircleType; end
16
+ class SmallCircleType; end
17
+ class VertexType; end
18
+ class PolygonType < ShapeType; end
19
+ class BoxType < ShapeType; end
20
+ class SectorType < ShapeType; end
21
+ class ConstraintType; end
22
+ class ConvexType < ShapeType; end
23
+ class ConvexHullType < ShapeType; end
24
+ class SkyIndexType < ShapeType; end
25
+ class UnionType < RegionType; end
26
+ class Union; end
27
+ class IntersectionType < RegionType; end
28
+ class Intersection; end
29
+ class NegationType < RegionType; end
30
+ class Negation; end
31
+ class AllSky; end
32
+ class Circle; end
33
+ class Ellipse; end
34
+ class Polygon; end
35
+ class Box; end
36
+ class Sector; end
37
+ class Convex; end
38
+ class ConvexHull; end
39
+ class SkyIndex; end
40
+
41
+ SubstitutionGroups = {
42
+ 'Region' => [Intersection, Union, Negation, AllSky, Circle, Ellipse, Polygon, Box, Sector, Convex, ConvexHull, SkyIndex]
43
+ }
44
+
45
+ # Region is the base type for everything.
46
+ class RegionType
47
+ include XML::Mapping
48
+
49
+ # the fill_factor (value between 0 and 1) indicates the fraction of the region that is actually included;
50
+ # possible application: large scale resource coverage areas
51
+ numeric_node :fill_factor, '@fill_factor', :optional => true, :default_value => 1.0
52
+ text_node :note, '@note', :optional => true
53
+ end
54
+
55
+ # Head element of the Region substitution group.
56
+ class Region
57
+ include XML::Mapping
58
+
59
+ object_node :value, '', :class => RegionType, :optional => false
60
+ end
61
+
62
+ # Shape is the abstract type that is the building block of regions; in real life it needs to be replaced by a concrete shape.
63
+ class ShapeType
64
+ object_node :unit, '@unit', :class => PosUnitType, :optional => true, :default_value => 'deg'
65
+ end
66
+
67
+ # Circle shape: center and radius.
68
+ class CircleType
69
+ # the radius of the circle
70
+ numeric_node :radius, 'Radius', :optional => false
71
+
72
+ # the coordinates of the circle's center
73
+ object_node :center, 'Center', :class => Double2Type, :optional => false
74
+ end
75
+
76
+ # Ellipse shape: adds semi-minor axis and position angle to circleType.
77
+ class EllipseType
78
+ # half the minor axis of the ellipse, in radius_unit
79
+ numeric_node :minor_radius, 'MinorRadius', :optional => false
80
+
81
+ # position angle of major axis (Radius)
82
+ object_node :pos_angle, 'PosAngle', :class => PosAngleType, :optional => false
83
+ end
84
+
85
+ # SmallCircleType indicates in polygons that side is along small circle; with optional pole.
86
+ class SmallCircleType
87
+ include XML::Mapping
88
+
89
+ object_node :pole, 'Pole', :class => Double2Type, :optional => true
90
+ end
91
+
92
+ # Vertex is a position with optional SmallCircle element;
93
+ # the SmallCircle element indicates that the polygon side
94
+ # formed by that vertex and its predecessor vertex is a small
95
+ # circle, rather than a great circle; SmallCircle has no meaning
96
+ # in Cartesian coordinates.
97
+ class VertexType
98
+ include XML::Mapping
99
+
100
+ object_node :position, 'Position', :class => Double2Type, :optional => false
101
+ object_node :small_circle, 'SmallCircle', :class => SmallCircleType, :optional => true
102
+ end
103
+
104
+ # Polygon: one or more vertices;
105
+ # counter-clockwise encircled area is enclosed;
106
+ # sides should span less than 180 deg in each coordinate if spherical
107
+ class PolygonType
108
+ array_node :vertices, 'Vertex', :class => VertexType, :optional => false
109
+ end
110
+
111
+ # Box shape: a rectangle defined by its center and size on both dimensions;
112
+ # since it is a polygon, it is redundant, but simple rectangles with great
113
+ # circle sides are awkward to define in spherical coordinates.
114
+ class BoxType
115
+ # the coordinates of the box's center
116
+ object_node :center, 'Center', :class => Double2Type, :optional => false
117
+ # the lengths of the box's sides
118
+ object_node :size, 'Size', :class => Double2Type, :optional => false
119
+ end
120
+
121
+ # A sector is the counter-clockwise area between two half-lines.
122
+ class SectorType
123
+ # the vertex position of the sector
124
+ object_node :position, 'Position', :class => Double2Type, :optional => false
125
+ # the area ccw from this position angle is included
126
+ object_node :pos_angle1, 'PosAngle1', :class => PosAngleType, :optional => false
127
+ # the area cw from this position angle is included
128
+ object_node :pos_angle2, 'PosAngle2', :class => PosAngleType, :optional => false
129
+ end
130
+
131
+ # An area on the unit sphere defined by the intersection with a plane.
132
+ class ConstraintType
133
+ include XML::Mapping
134
+
135
+ # the distance along the normal vector where the constraint plane
136
+ # intersects that vector; if positive, the spherical sector on the
137
+ # far side (seen from the center) is selected; if negative, the point
138
+ # of intersection is in the opposite direction of the vector, resulting
139
+ # in more than a hemisphere; the valid range is -1.0 to +1.0
140
+ numeric_node :offset, 'Offset', :optional => false
141
+
142
+ # this needs to be a spherical coordinate vector; it is the unit vector
143
+ # that is normal to the plane that forms a constraint for a convex
144
+ object_node :vector, 'Vector', :class => Double3Type, :optional => false
145
+ end
146
+
147
+ # A convex polygon defined by one or more Constraints.
148
+ class ConvexType
149
+ array_node :constraints, 'Constraint', :class => ConstraintType, :optional => false
150
+ end
151
+
152
+ # A convex hull.
153
+ class ConvexHullType
154
+ array_node :points, 'Point', :class => Double3Type, :optional => false
155
+ end
156
+
157
+ # This is a hook for regions defined in sky indexing schemes.
158
+ class SkyIndexType; end
159
+
160
+ # The union of two or more regions is a region.
161
+ class UnionType
162
+ full_array_node :regions, 'Region/(' + STC::group_member_names(Region, SubstitutionGroups).join('|') + ')',
163
+ :unmarshaller => STC::dispatch_from_element_name('VORuby::STCregion::V1_20', Proc.new{|name| "#{name}Type"}),
164
+ :optional => false
165
+ end
166
+ class Union
167
+ include XML::Mapping
168
+
169
+ object_node :value, '', :class => UnionType, :optional => false
170
+ end
171
+
172
+ # The intersection of two or more regions is a region.
173
+ class IntersectionType
174
+ full_array_node :regions, 'Region/(' + STC::group_member_names(Region, SubstitutionGroups).join('|') + ')',
175
+ :unmarshaller => STC::dispatch_from_element_name('VORuby::STCregion::V1_20', Proc.new{|name| "#{name}Type"}),
176
+ :optional => false
177
+ end
178
+ class Intersection
179
+ include XML::Mapping
180
+
181
+ object_node :value, '', :class => IntersectionType, :optional => false
182
+ end
183
+
184
+ # The negation of a region is a region.
185
+ class NegationType
186
+ full_object_node :region, 'Region/(' + STC::group_member_names(Region, SubstitutionGroups).join('|') + ')',
187
+ :unmarshaller => STC::dispatch_from_element_name('VORuby::STCregion::V1_20', Proc.new{|name| "#{name}Type"}),
188
+ :optional => false
189
+ end
190
+ class Negation
191
+ include XML::Mapping
192
+
193
+ object_node :value, '', :class => NegationType, :optional => false
194
+ end
195
+
196
+ # AllSky is just a convenience, meaning no bounds.
197
+ class AllSky
198
+ include XML::Mapping
199
+
200
+ object_node :value, '', :class => RegionType, :optional => false
201
+ end
202
+
203
+ # The circle is defined by a center and a radius.
204
+ class Circle
205
+ include XML::Mapping
206
+
207
+ object_node :value, '', :class => CircleType, :optional => false
208
+ end
209
+
210
+ # Ellipse is an extension of the circle shape, with a minor axis radius and position angle.
211
+ class Ellipse
212
+ include XML::Mapping
213
+
214
+ object_node :value, '', :class => EllipseType, :optional => false
215
+ end
216
+
217
+ # A polygon is a shape delineated by a list of vertices connected with lines,
218
+ # great circles, or small circles; the inside of the polygon is circumscribed
219
+ # counter-clockwise by the list of vertices; the polygon may be concave but not
220
+ # self-intersecting; the last vertex in the list is the predecessor of the first.
221
+ # For celestial coordinates it is assumed that we are looking at the sphere
222
+ # from the inside, with Right Ascension increasing to the left. Sides should span
223
+ # less than 180 deg in each coordinate.
224
+ class Polygon
225
+ include XML::Mapping
226
+
227
+ object_node :value, '', :class => PolygonType, :optional => false
228
+ end
229
+
230
+ # A box is a rectangle; the midpoints of its sides are the endpoints of a cross
231
+ # centered on the center position with arms that extend half the size for each
232
+ # coordinate in both directions, and the sides are lines or great circles that
233
+ # intersect the cross at its end points at right angles; the arms of the cross
234
+ # are parallel to the coordinate axes at the center point.
235
+ class Box
236
+ include XML::Mapping
237
+
238
+ object_node :value, '', :class => BoxType, :optional => false
239
+ end
240
+
241
+ # A sector selects the area between two half great circles or half lines meeting in a specified point.
242
+ class Sector
243
+ include XML::Mapping
244
+
245
+ object_node :value, '', :class => SectorType, :optional => false
246
+ end
247
+
248
+ # A convex is defined as the intersection of one or more half-plane constraints
249
+ # with the unit sphere; this may also be described as the union of one or more
250
+ # convex polygons bounded by one or more constraint planes.
251
+ class Convex
252
+ include XML::Mapping
253
+
254
+ object_node :value, '', :class => ConvexType, :optional => false
255
+ end
256
+
257
+ # A convex hull is the convex polygon that contains all of the specified
258
+ # positions; the points have to be constrained to lie in one hemisphere.
259
+ class ConvexHull
260
+ include XML::Mapping
261
+
262
+ object_node :value, '', :class => ConvexHullType, :optional => false
263
+ end
264
+
265
+ # A shape defined through a sky indexing scheme; this is really a substitutino group for concrete implementations.
266
+ class SkyIndex
267
+ include XML::Mapping
268
+
269
+ object_node :value, '', :class => SkyIndexType, :optional => false
270
+ end
271
+
272
+ end
273
+ end
274
+ end