voruby 1.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile.rb +107 -224
- data/lib/misc.rb +1 -0
- data/lib/misc/misc.rb +60 -0
- data/lib/misc/propertyfile.rb +31 -0
- data/lib/symphony.rb +1 -0
- data/lib/symphony/symphony.rb +247 -0
- data/lib/voruby.rb +186 -0
- data/lib/voruby/active_votable/active_votable.rb +468 -347
- data/lib/voruby/adql/1.0/adql.rb +2418 -0
- data/lib/voruby/adql/support.rb +2 -0
- data/lib/voruby/misc.rb +351 -0
- data/lib/voruby/misc/connection_monitor.rb +97 -0
- data/lib/voruby/misc/libxml_ext.rb +121 -0
- data/lib/voruby/misc/rexml_ext.rb +223 -0
- data/lib/voruby/resolver/resolver.rb +12 -0
- data/lib/voruby/resolver/sesame.rb +299 -0
- data/lib/voruby/sky_query/sky_query.rb +192 -0
- data/lib/voruby/stc/1.10/coords.rb +2272 -0
- data/lib/voruby/stc/1.10/region.rb +892 -0
- data/lib/voruby/stc/1.10/stc.rb +3271 -0
- data/lib/voruby/stc/1.30/stc.rb +8666 -0
- data/lib/voruby/stc/support.rb +2 -0
- data/lib/voruby/ucd/ucd.rb +173 -0
- data/lib/voruby/voevent/1.1/voevent.rb +1124 -0
- data/lib/voruby/voevent/support.rb +5 -0
- data/lib/voruby/votable/1.0/votable.rb +1807 -0
- data/lib/voruby/votable/1.1/votable.rb +2100 -0
- data/lib/voruby/votable/votable.rb +305 -0
- data/lib/voruby/wesix/wesix.rb +491 -0
- data/lib/voruby/xlink/1.2/xlink.rb +21 -0
- data/test/voruby/active_votable/complex.vot +60 -0
- data/test/voruby/active_votable/error.vot +6 -0
- data/test/voruby/active_votable/large.vot +130040 -0
- data/test/voruby/active_votable/simple1.vot +38 -0
- data/test/voruby/active_votable/simple2.vot +38 -0
- data/test/voruby/active_votable/test.rb +193 -0
- data/test/voruby/adql/1.0/adql-alias.sql +1 -0
- data/test/voruby/adql/1.0/adql-alias.xml +26 -0
- data/test/voruby/adql/1.0/adql-avg.sql +1 -0
- data/test/voruby/adql/1.0/adql-avg.xml +31 -0
- data/test/voruby/adql/1.0/adql-circle.sql +1 -0
- data/test/voruby/adql/1.0/adql-circle.xml +46 -0
- data/test/voruby/adql/1.0/adql-expr.sql +1 -0
- data/test/voruby/adql/1.0/adql-expr.xml +34 -0
- data/test/voruby/adql/1.0/adql-function.sql +1 -0
- data/test/voruby/adql/1.0/adql-function.xml +41 -0
- data/test/voruby/adql/1.0/adql-group.sql +1 -0
- data/test/voruby/adql/1.0/adql-group.xml +51 -0
- data/test/voruby/adql/1.0/adql-having.sql +1 -0
- data/test/voruby/adql/1.0/adql-having.xml +25 -0
- data/test/voruby/adql/1.0/adql-like.sql +1 -0
- data/test/voruby/adql/1.0/adql-like.xml +17 -0
- data/test/voruby/adql/1.0/adql-order.sql +1 -0
- data/test/voruby/adql/1.0/adql-order.xml +37 -0
- data/test/voruby/adql/1.0/adql-simple.sql +1 -0
- data/test/voruby/adql/1.0/adql-simple.xml +12 -0
- data/test/voruby/adql/1.0/adql-top.sql +1 -0
- data/test/voruby/adql/1.0/adql-top.xml +33 -0
- data/test/voruby/adql/1.0/test.rb +2220 -0
- data/test/voruby/misc/test.rb +32 -0
- data/test/voruby/resolver/sesame/test.rb +56 -0
- data/test/voruby/sky_query/test.rb +107 -0
- data/test/voruby/stc/1.10/coords_test.rb +3704 -0
- data/test/voruby/stc/1.10/region_test.rb +993 -0
- data/test/voruby/stc/1.10/stc-catalog-entry-location.xml +112 -0
- data/test/voruby/stc/1.10/stc-obs-data-location.xml +126 -0
- data/test/voruby/stc/1.10/stc-region-circle.xml +5 -0
- data/test/voruby/stc/1.10/stc-region-convex.xml +11 -0
- data/test/voruby/stc/1.10/stc-region-convexhull.xml +5 -0
- data/test/voruby/stc/1.10/stc-region-ellipse.xml +7 -0
- data/test/voruby/stc/1.10/stc-region-intersection.xml +25 -0
- data/test/voruby/stc/1.10/stc-region-negation.xml +7 -0
- data/test/voruby/stc/1.10/stc-region-polygon.xml +13 -0
- data/test/voruby/stc/1.10/stc-region-sector.xml +6 -0
- data/test/voruby/stc/1.10/stc-region-union.xml +25 -0
- data/test/voruby/stc/1.10/stc-resource-profile.xml +60 -0
- data/test/voruby/stc/1.10/stc-search-location.xml +54 -0
- data/test/voruby/stc/1.10/stc_test.rb +4626 -0
- data/test/voruby/stc/1.30/stc-catalog-entry-location.xml +210 -0
- data/test/voruby/stc/1.30/stc-obs-data-location-arecibo.xml +353 -0
- data/test/voruby/stc/1.30/stc-obs-data-location-fits.xml +250 -0
- data/test/voruby/stc/1.30/stc-obs-data-location-xlink.xml +63 -0
- data/test/voruby/stc/1.30/stc-obs-data-location.xml +216 -0
- data/test/voruby/stc/1.30/stc-resource-profile-unusual-ref-pos.xml +39 -0
- data/test/voruby/stc/1.30/stc-resource-profile.xml +129 -0
- data/test/voruby/stc/1.30/stc-search-location-arecibo.xml +86 -0
- data/test/voruby/stc/1.30/stc-search-location.xml +101 -0
- data/test/voruby/stc/1.30/test.rb +6274 -0
- data/test/voruby/ucd/test.rb +48 -0
- data/test/voruby/voevent/1.1/test.rb +812 -0
- data/test/{voevent/voevent_v1_1.xml → voruby/voevent/1.1/voevent.xml} +2 -2
- data/test/voruby/voregistry/0.3/test.rb +137 -0
- data/test/voruby/votable/1.0/test.rb +714 -0
- data/test/voruby/votable/1.0/votable.basic.xml +660 -0
- data/test/voruby/votable/1.0/votable.html +86 -0
- data/test/voruby/votable/1.0/votable.ns.xml +56 -0
- data/test/voruby/votable/1.1/test.rb +785 -0
- data/test/voruby/votable/1.1/votable.basic.xml +38 -0
- data/test/voruby/votable/1.1/votable.html +86 -0
- data/test/voruby/votable/1.1/votable.ns.xml +56 -0
- data/test/voruby/votable/test.rb +15 -0
- data/test/voruby/wesix/test.rb +268 -0
- data/test/voruby/wesix/testr.fits +28 -0
- metadata +234 -247
- data/REQUIREMENTS +0 -6
- data/lib/voruby/active_votable/loader.rb +0 -5
- data/lib/voruby/adql/adql.rb +0 -2787
- data/lib/voruby/adql/ext.rb +0 -14
- data/lib/voruby/adql/loader.rb +0 -6
- data/lib/voruby/adql/operations.rb +0 -54
- data/lib/voruby/adql/parser.rb +0 -160
- data/lib/voruby/adql/transforms.rb +0 -573
- data/lib/voruby/ext.rb +0 -17
- data/lib/voruby/loader.rb +0 -4
- data/lib/voruby/misc/propertyfile.rb +0 -36
- data/lib/voruby/plastic/applications.rb +0 -174
- data/lib/voruby/plastic/constants.rb +0 -30
- data/lib/voruby/plastic/loader.rb +0 -10
- data/lib/voruby/plastic/plastic.rb +0 -1
- data/lib/voruby/resources/conesearch/conesearch.rb +0 -9
- data/lib/voruby/resources/conesearch/conesearch_v0_2.rb +0 -55
- data/lib/voruby/resources/conesearch/conesearch_v0_3.rb +0 -50
- data/lib/voruby/resources/conesearch/conesearch_v1_0.rb +0 -72
- data/lib/voruby/resources/conesearch/loader.rb +0 -4
- data/lib/voruby/resources/loader.rb +0 -50
- data/lib/voruby/resources/nodes.rb +0 -190
- data/lib/voruby/resources/openskynode/loader.rb +0 -4
- data/lib/voruby/resources/openskynode/openskynode.rb +0 -9
- data/lib/voruby/resources/openskynode/openskynode_v0_1.rb +0 -54
- data/lib/voruby/resources/sia/loader.rb +0 -5
- data/lib/voruby/resources/sia/sia.rb +0 -9
- data/lib/voruby/resources/sia/sia_v0_6.rb +0 -90
- data/lib/voruby/resources/sia/sia_v0_7.rb +0 -89
- data/lib/voruby/resources/sia/sia_v1_0.rb +0 -122
- data/lib/voruby/resources/stsci.rb +0 -59
- data/lib/voruby/resources/vodataservice/coverage_v0_2.rb +0 -195
- data/lib/voruby/resources/vodataservice/coverage_v0_3.rb +0 -158
- data/lib/voruby/resources/vodataservice/loader.rb +0 -5
- data/lib/voruby/resources/vodataservice/vodataservice.rb +0 -9
- data/lib/voruby/resources/vodataservice/vodataservice_v0_4.rb +0 -189
- data/lib/voruby/resources/vodataservice/vodataservice_v0_5.rb +0 -163
- data/lib/voruby/resources/vodataservice/vodataservice_v1_0.rb +0 -221
- data/lib/voruby/resources/voregistry/loader.rb +0 -4
- data/lib/voruby/resources/voregistry/voregistry.rb +0 -9
- data/lib/voruby/resources/voregistry/voregistry_v0_2.rb +0 -40
- data/lib/voruby/resources/voregistry/voregistry_v0_3.rb +0 -30
- data/lib/voruby/resources/voregistry/voregistry_v1_0.rb +0 -86
- data/lib/voruby/resources/voresource/loader.rb +0 -17
- data/lib/voruby/resources/voresource/voresource.rb +0 -9
- data/lib/voruby/resources/voresource/voresource_v0_10.rb +0 -327
- data/lib/voruby/resources/voresource/voresource_v0_9.rb +0 -405
- data/lib/voruby/resources/voresource/voresource_v1_0.rb +0 -230
- data/lib/voruby/services/ext.rb +0 -11
- data/lib/voruby/services/gestalt/footprint.rb +0 -95
- data/lib/voruby/services/gestalt/wcs_fixer.rb +0 -105
- data/lib/voruby/services/gestalt/wesix.rb +0 -155
- data/lib/voruby/services/loader.rb +0 -7
- data/lib/voruby/services/registry/registry.rb +0 -53
- data/lib/voruby/services/resolver/resolver.rb +0 -35
- data/lib/voruby/services/schema/schema.rb +0 -644
- data/lib/voruby/sesame/loader.rb +0 -6
- data/lib/voruby/sesame/sesame_v1_0.rb +0 -64
- data/lib/voruby/simple/loader.rb +0 -6
- data/lib/voruby/simple/parameters.rb +0 -196
- data/lib/voruby/simple/sap.rb +0 -446
- data/lib/voruby/spacetime/loader.rb +0 -3
- data/lib/voruby/spacetime/spacetime.rb +0 -607
- data/lib/voruby/stc/coords_v1_20.rb +0 -900
- data/lib/voruby/stc/loader.rb +0 -55
- data/lib/voruby/stc/region_v1_20.rb +0 -274
- data/lib/voruby/stc/stc_v1_20.rb +0 -1196
- data/lib/voruby/util.rb +0 -27
- data/lib/voruby/voevent/loader.rb +0 -7
- data/lib/voruby/voevent/voevent_v1_0.rb +0 -213
- data/lib/voruby/voevent/voevent_v1_1.rb +0 -196
- data/lib/voruby/votables/chandra.rb +0 -373
- data/lib/voruby/votables/data.rb +0 -179
- data/lib/voruby/votables/galex.rb +0 -377
- data/lib/voruby/votables/int.rb +0 -354
- data/lib/voruby/votables/libxml_parser.rb +0 -411
- data/lib/voruby/votables/libxml_votable.rb +0 -67
- data/lib/voruby/votables/loader.rb +0 -10
- data/lib/voruby/votables/meta.rb +0 -763
- data/lib/voruby/votables/misc.rb +0 -51
- data/lib/voruby/votables/nsa.rb +0 -410
- data/lib/voruby/votables/rexml_parser.rb +0 -408
- data/lib/voruby/votables/rexml_votable.rb +0 -67
- data/lib/voruby/votables/sdss.rb +0 -356
- data/lib/voruby/votables/transforms.rb +0 -388
- data/lib/voruby/votables/tree.rb +0 -45
- data/lib/voruby/votables/types.rb +0 -391
- data/lib/voruby/votables/votable.rb +0 -687
- data/test/active_votable/database.yml +0 -6
- data/test/active_votable/test.vot +0 -168492
- data/test/active_votable/unittest.rb +0 -41
- data/test/adql/test1.adql +0 -49
- data/test/adql/test2.adql +0 -51
- data/test/adql/test3.adql +0 -81
- data/test/adql/test4.adql +0 -53
- data/test/adql/test5.adql +0 -55
- data/test/adql/test6.adql +0 -18
- data/test/adql/test7.adql +0 -48
- data/test/adql/unittest.rb +0 -1672
- data/test/plastic/test.rb +0 -44
- data/test/plastic/test.vot +0 -5385
- data/test/plastic/unittest.rb +0 -66
- data/test/resources/conesearch/conesearch_v0_3.xml +0 -31
- data/test/resources/conesearch/conesearch_v1_0.xml +0 -86
- data/test/resources/conesearch/unittest_v0_3.rb +0 -22
- data/test/resources/conesearch/unittest_v1_0.rb +0 -24
- data/test/resources/openskynode/open_sky_node_v0_1.xml +0 -32
- data/test/resources/openskynode/unittest_v0_1.rb +0 -31
- data/test/resources/sia/simple_image_access_v0_7.xml +0 -36
- data/test/resources/sia/simple_image_access_v1_0.xml +0 -122
- data/test/resources/sia/unittest_v0_7.rb +0 -24
- data/test/resources/sia/unittest_v1_0.rb +0 -29
- data/test/resources/stsci.xml +0 -336
- data/test/resources/unittest_stsci.rb +0 -25
- data/test/resources/vodataservice/catalog_service_resource_v1_0.xml +0 -128
- data/test/resources/vodataservice/data_collection_resource_v0_5.xml +0 -54
- data/test/resources/vodataservice/data_collection_resource_v1_0.xml +0 -117
- data/test/resources/vodataservice/data_service_resource_v1_0.xml +0 -115
- data/test/resources/vodataservice/sky_service_resource_v0_10.xml +0 -45
- data/test/resources/vodataservice/table_service_resource_v1_0.xml +0 -122
- data/test/resources/vodataservice/tabular_sky_service_resource_v0_10.xml +0 -60
- data/test/resources/vodataservice/unittest_v0_5.rb +0 -126
- data/test/resources/vodataservice/unittest_v1_0.rb +0 -151
- data/test/resources/voregistry/authority_resource_v0_3.xml +0 -20
- data/test/resources/voregistry/authority_resource_v1_0.xml +0 -82
- data/test/resources/voregistry/registry_service_v0_3.xml +0 -20
- data/test/resources/voregistry/registry_service_v1_0.xml +0 -107
- data/test/resources/voregistry/unittest_v0_3.rb +0 -31
- data/test/resources/voregistry/unittest_v1_0.rb +0 -34
- data/test/resources/voresource/organisation_resource_v1_0.xml +0 -90
- data/test/resources/voresource/resource_organisation_v0_10.xml +0 -22
- data/test/resources/voresource/resource_service_v0_10.xml +0 -19
- data/test/resources/voresource/resource_v0_10.xml +0 -19
- data/test/resources/voresource/resource_v1_0.xml +0 -79
- data/test/resources/voresource/service_resource_v1_0.xml +0 -91
- data/test/resources/voresource/unittest_v0_10.rb +0 -61
- data/test/resources/voresource/unittest_v0_9.rb +0 -4
- data/test/resources/voresource/unittest_v1_0.rb +0 -190
- data/test/services/gestalt/unittest.rb +0 -74
- data/test/services/registry/unittest.rb +0 -34
- data/test/services/resolver/unittest.rb +0 -38
- data/test/simple/unittest.rb +0 -46
- data/test/spacetime/unittest.rb +0 -39
- data/test/stc/catalog_entry_location_v1_20.xml +0 -112
- data/test/stc/obs_data_location_v1_20.xml +0 -108
- data/test/stc/search_location_v1_20.xml +0 -54
- data/test/stc/stc_resource_profile_v1_20.xml +0 -60
- data/test/stc/unittest_v1_20.rb +0 -620
- data/test/voevent/unittest_v1_0.rb +0 -79
- data/test/voevent/unittest_v1_1.rb +0 -70
- data/test/voevent/voevent_v1_0.xml +0 -96
- data/test/votables/test.vot +0 -366
- data/test/votables/unittest.rb +0 -54
data/lib/voruby/votables/data.rb
DELETED
@@ -1,179 +0,0 @@
|
|
1
|
-
module VORuby
|
2
|
-
module VOTables
|
3
|
-
module VOTable
|
4
|
-
|
5
|
-
module Data
|
6
|
-
|
7
|
-
# A class representing a generic stream of data.
|
8
|
-
class Stream
|
9
|
-
attr_reader :type, :href, :actuate, :encoding, :expires, :rights
|
10
|
-
|
11
|
-
# [_href_:]
|
12
|
-
# The URL of the stream (type: Type::AnyURI).
|
13
|
-
# [_expires_:]
|
14
|
-
# The datetime on which the stream expires. Must be parsable by
|
15
|
-
# Ruby's DateTime.parse() method.
|
16
|
-
# [_rights_:]
|
17
|
-
# The data rights associated with the stream.
|
18
|
-
# [_type_:]
|
19
|
-
# The type of stream (type: Type::StreamType).
|
20
|
-
# [_actuate_:]
|
21
|
-
# The actuate property of the stream (type: Type::Actuate).
|
22
|
-
# [_encoding_:]
|
23
|
-
# The encoding of the stream (type: Type::EncodingType).
|
24
|
-
def initialize(href=nil, expires=nil, rights=nil, type=Type::StreamType.new('locator'),
|
25
|
-
actuate=Type::Actuate.new('onRequest'),
|
26
|
-
encoding=Type::EncodingType.new('none'))
|
27
|
-
|
28
|
-
Misc::TypeCheck.new(type, Type::StreamType).check()
|
29
|
-
@type = type
|
30
|
-
|
31
|
-
Misc::TypeCheck.new(href, Type::AnyURI).check()
|
32
|
-
@href = href
|
33
|
-
|
34
|
-
Misc::TypeCheck.new(actuate, Type::Actuate).check()
|
35
|
-
@actuate = actuate
|
36
|
-
|
37
|
-
Misc::TypeCheck.new(encoding, Type::EncodingType).check()
|
38
|
-
@encoding = encoding
|
39
|
-
|
40
|
-
if expires
|
41
|
-
@expires = DateTime.parse(expires)
|
42
|
-
else
|
43
|
-
@expires = nil
|
44
|
-
end
|
45
|
-
|
46
|
-
@rights = rights
|
47
|
-
end
|
48
|
-
|
49
|
-
def to_s
|
50
|
-
"{type=#{@type};href=#{@href};actuate=#{@actuate};encoding=#{encoding};" +
|
51
|
-
"expires=#{@expires};rights=#{@rights}}"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
# A class representing a binary stream.
|
56
|
-
class BinaryStream
|
57
|
-
attr_reader :stream
|
58
|
-
|
59
|
-
# [_stream_]
|
60
|
-
# The basic information associated with a binary stream
|
61
|
-
# (type: Stream).
|
62
|
-
def initialize(stream=nil)
|
63
|
-
Misc::TypeCheck.new(stream, Stream).check()
|
64
|
-
@stream = stream
|
65
|
-
end
|
66
|
-
|
67
|
-
def to_s
|
68
|
-
"{stream=#{stream}}"
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# A class representing a FITS stream.
|
73
|
-
class FITSStream
|
74
|
-
attr_reader :stream, :extnum
|
75
|
-
|
76
|
-
# [_stream_:]
|
77
|
-
# The basic stream informatin (type: Stream).
|
78
|
-
# [_extnum_:]
|
79
|
-
# The number of extensions in the FITS file (type Type::PositiveInteger).
|
80
|
-
def initialize(stream=nil, extnum=nil)
|
81
|
-
raise Misc::TypeException(stream, Stream) if stream and !stream.is_a?(Stream)
|
82
|
-
Misc::TypeCheck.new(stream, Stream).check()
|
83
|
-
@stream = stream
|
84
|
-
|
85
|
-
Misc::TypeCheck.new(extnum, Type::PositiveInteger).check()
|
86
|
-
@extnum = extnum
|
87
|
-
end
|
88
|
-
|
89
|
-
def to_s
|
90
|
-
"{stream=#{@stream};extnum=#{extnum}}"
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
# A class representing the VOTable standard TD element.
|
95
|
-
class TD
|
96
|
-
attr_reader :value, :encoding
|
97
|
-
|
98
|
-
# [_value_:]
|
99
|
-
# The value of the cell data.
|
100
|
-
# [_encoding_:]
|
101
|
-
# The encoding of the cell data (type: Type::EncodingType).
|
102
|
-
def initialize(value=nil, encoding=Type::EncodingType.new('none'))
|
103
|
-
@value = value
|
104
|
-
|
105
|
-
Misc::TypeCheck.new(encoding, Type::EncodingType).check()
|
106
|
-
@encoding = encoding
|
107
|
-
end
|
108
|
-
|
109
|
-
def to_s
|
110
|
-
"{value=#{@value};encoding=#{@encoding}}"
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
# A class representing the VOTable standard TR element.
|
115
|
-
class TR
|
116
|
-
attr_reader :tds
|
117
|
-
|
118
|
-
# [_tds_:]
|
119
|
-
# A list of table data belonging in the row in question.
|
120
|
-
def initialize(tds=[])
|
121
|
-
tds.each{ |td|
|
122
|
-
Misc::TypeCheck.new(td, TD).check()
|
123
|
-
}
|
124
|
-
@tds = tds
|
125
|
-
end
|
126
|
-
|
127
|
-
def to_s
|
128
|
-
tds = @tds.collect{|x| x.to_s}.join('|')
|
129
|
-
"{tds=#{tds}}"
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
# A class representing the VOTable standard TABLEDATA element.
|
134
|
-
class TableData
|
135
|
-
attr_reader :trs
|
136
|
-
|
137
|
-
# [_trs_:]
|
138
|
-
# A list of rows associated with the table in question.
|
139
|
-
def initialize(trs=[])
|
140
|
-
trs.each{ |tr|
|
141
|
-
Misc::TypeCheck.new(tr, TR).check()
|
142
|
-
}
|
143
|
-
@trs = trs
|
144
|
-
end
|
145
|
-
|
146
|
-
def to_s
|
147
|
-
trs = @trs.collect{|x| x.to_s}.join('|')
|
148
|
-
"{trs=#{trs}}"
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
# A class representing the VOTable standard DATA element.
|
153
|
-
class Data
|
154
|
-
attr_reader :format
|
155
|
-
|
156
|
-
# [_format_:]
|
157
|
-
# Where the actual data is coming from (types: FITSStream,
|
158
|
-
# BinaryStream, TableData.
|
159
|
-
# Currently, this class doesn't know what to do with streams.
|
160
|
-
def initialize(format=nil)
|
161
|
-
if format.is_a?(FITSStream) or format.is_a?(BinaryStream) or
|
162
|
-
format.is_a?(TableData)
|
163
|
-
@format = format
|
164
|
-
else
|
165
|
-
raise "Format #{format.class} is not valid. Use one of: " +
|
166
|
-
"FITSStream, BinaryStream, TableData"
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def to_s
|
171
|
-
"{format=#{@format}}"
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
end
|
179
|
-
end
|
@@ -1,377 +0,0 @@
|
|
1
|
-
# A set of classes designed to read and manipulate
|
2
|
-
# especific VOTables[http://www.ivoa.net/Documents/latest/VOT.html].
|
3
|
-
# This class represents a GALEX VOTable.
|
4
|
-
|
5
|
-
require 'voruby/votables/votable'
|
6
|
-
|
7
|
-
module VORuby
|
8
|
-
module VOTables
|
9
|
-
module VOTable
|
10
|
-
class GALEXVOTable < VOTable
|
11
|
-
|
12
|
-
# Our object's contructor
|
13
|
-
# [_votable:_]
|
14
|
-
# The VOTable object
|
15
|
-
def initialize(votable)
|
16
|
-
super(votable.id, votable.version, votable.description,
|
17
|
-
votable.definitions, votable.coosys, votable.params,
|
18
|
-
votable.info, votable.resources)
|
19
|
-
end
|
20
|
-
|
21
|
-
# Find the column number(s) associated with a Name.
|
22
|
-
# Returns a list of column positions.
|
23
|
-
# [_res_:]
|
24
|
-
# The resource from which to extract the table in question.
|
25
|
-
# [_tbl_:]
|
26
|
-
# The resource from which to extract the table in question.
|
27
|
-
def find_columns(name, res=0, tbl=0)
|
28
|
-
columns = []
|
29
|
-
|
30
|
-
col_count = 0
|
31
|
-
fields = fields(res, tbl)
|
32
|
-
|
33
|
-
if fields
|
34
|
-
fields.each do |field|
|
35
|
-
if field.name() != nil
|
36
|
-
columns.push(col_count) if field.name() == name
|
37
|
-
end
|
38
|
-
col_count += 1
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
return columns
|
43
|
-
end
|
44
|
-
|
45
|
-
# Find a field in GALEX configuration file given a key.
|
46
|
-
# Returns a hash with the field's attributes
|
47
|
-
# [_key_:]
|
48
|
-
# The key indexing on field's attribute
|
49
|
-
def find_field_in_conf_file(key)
|
50
|
-
galex_field = {'id'=> nil, 'name'=> nil, 'ucd'=> nil}
|
51
|
-
|
52
|
-
if key != nil
|
53
|
-
GALEX_ARCHIVE_CONFIG.each do |archive|
|
54
|
-
archive['votable_fields'].each do |field|
|
55
|
-
if field['key'] == key
|
56
|
-
galex_field['id'] = field['id'] if field['id'] != 'nil'
|
57
|
-
galex_field['name'] = field['name'] if field['name'] != 'nil'
|
58
|
-
galex_field['ucd'] = field['ucd'] if field['ucd'] != 'nil'
|
59
|
-
break
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
return galex_field
|
65
|
-
end
|
66
|
-
|
67
|
-
# Find the column number(s) associated with the
|
68
|
-
# VOX:imageAccessReference UCD.
|
69
|
-
# Returns a list of column positions.
|
70
|
-
def image_access_reference_columns()
|
71
|
-
ucd_access = find_field_in_conf_file('VOX:Image_AccessReference')['name']
|
72
|
-
|
73
|
-
if find_columns(ucd_access).first != nil
|
74
|
-
find_columns(ucd_access).first
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def image_ra_columns
|
79
|
-
ucd_ra = find_field_in_conf_file('POS_EQ_RA_MAIN')['name']
|
80
|
-
|
81
|
-
if find_columns(ucd_ra).first != nil
|
82
|
-
find_columns(ucd_ra).first
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def image_dec_columns
|
87
|
-
ucd_dec = find_field_in_conf_file('POS_EQ_DEC_MAIN')['name']
|
88
|
-
|
89
|
-
if find_columns(ucd_dec).first != nil
|
90
|
-
find_columns(ucd_dec).first
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def image_filter_columns
|
95
|
-
ucd_filter = find_field_in_conf_file('VOX:BandPass_ID')['name']
|
96
|
-
|
97
|
-
if find_columns(ucd_filter).first != nil
|
98
|
-
find_columns(ucd_filter).first
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def image_date_obs_columns
|
103
|
-
#ucd_date_obs = find_field_in_conf_file('')['name']
|
104
|
-
|
105
|
-
#if find_columns(ucd_date_obs).first != nil
|
106
|
-
# find_columns(ucd_date_obs).first
|
107
|
-
#end
|
108
|
-
end
|
109
|
-
|
110
|
-
def image_telescope_columns
|
111
|
-
#ucd_telescope = find_field_in_conf_file('')['name']
|
112
|
-
|
113
|
-
#if find_columns(ucd_telescope).first != nil
|
114
|
-
# find_columns(ucd_telescope).first
|
115
|
-
#end
|
116
|
-
end
|
117
|
-
|
118
|
-
def image_survey_columns
|
119
|
-
ucd_survey = find_field_in_conf_file('VOX:Image_Title')['name']
|
120
|
-
|
121
|
-
if find_columns(ucd_survey).first != nil
|
122
|
-
find_columns(ucd_survey).first
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def image_instrument_columns
|
127
|
-
ucd_instrument = find_field_in_conf_file('VOX:INST_ID')['name']
|
128
|
-
|
129
|
-
if find_columns(ucd_instrument).first != nil
|
130
|
-
find_columns(ucd_instrument).first
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
def image_sky_columns
|
135
|
-
#ucd_sky = find_field_in_conf_file('')['name']
|
136
|
-
|
137
|
-
#if find_columns(ucd_sky).first != nil
|
138
|
-
# find_columns(ucd_sky).first
|
139
|
-
#end
|
140
|
-
end
|
141
|
-
|
142
|
-
def image_zeropoint_columns
|
143
|
-
#ucd_zeropoint = find_field_in_conf_file('')['name']
|
144
|
-
|
145
|
-
#if find_columns(ucd_zeropoint).first != nil
|
146
|
-
# find_columns(ucd_zeropoint).first
|
147
|
-
#end
|
148
|
-
end
|
149
|
-
|
150
|
-
def image_seeing_columns
|
151
|
-
#ucd_seeing = find_field_in_conf_file('')['name']
|
152
|
-
|
153
|
-
#if find_columns(ucd_seeing).first != nil
|
154
|
-
# find_columns(ucd_seeing).first
|
155
|
-
#end
|
156
|
-
end
|
157
|
-
|
158
|
-
def image_depth_columns
|
159
|
-
#ucd_depth = find_field_in_conf_file('')['name']
|
160
|
-
|
161
|
-
#if find_columns(ucd_depth).first != nil
|
162
|
-
# find_columns(ucd_depth).first
|
163
|
-
#end
|
164
|
-
end
|
165
|
-
|
166
|
-
def image_exptime_columns
|
167
|
-
#ucd_exptime = find_field_in_conf_file('')['name']
|
168
|
-
|
169
|
-
#if find_columns(ucd_exptime).first != nil
|
170
|
-
# find_columns(ucd_exptime).first
|
171
|
-
#end
|
172
|
-
end
|
173
|
-
|
174
|
-
# Create the headers for HTML table
|
175
|
-
# [_access_ref_index_:]
|
176
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
177
|
-
# [_options_:]
|
178
|
-
#
|
179
|
-
def create_headers(access_ref_index, options)
|
180
|
-
thead, thead_2row = create_header_cart_links(options)
|
181
|
-
|
182
|
-
if options[:infer_access_ref] and access_ref_index
|
183
|
-
thead << "<th>#{options[:access_ref_header_label]}</th>\n"
|
184
|
-
thead_2row.push(' ')
|
185
|
-
end
|
186
|
-
|
187
|
-
col_count = 0
|
188
|
-
fields(options[:res], options[:tbl]).each do |field|
|
189
|
-
field_archive = find_field_in_conf_file(field.ucd.value())
|
190
|
-
field_ucd = field_archive['ucd']
|
191
|
-
if options[:infer_access_ref] and col_count == access_ref_index
|
192
|
-
thead_2row[1] = field_ucd if field_ucd != 'nil'
|
193
|
-
else
|
194
|
-
thead << "<th>#{field_archive['name']}</th>\n"
|
195
|
-
if field_ucd != 'nil'
|
196
|
-
thead_2row.push(field_ucd)
|
197
|
-
else
|
198
|
-
thead_2row.push(' ')
|
199
|
-
end
|
200
|
-
end
|
201
|
-
col_count += 1
|
202
|
-
end
|
203
|
-
|
204
|
-
thead << " </tr>\n"
|
205
|
-
|
206
|
-
thead << "<tr>\n"
|
207
|
-
thead_2row.each do |h|
|
208
|
-
thead << "<th>#{h}</th>\n"
|
209
|
-
end
|
210
|
-
thead << "</tr>\n"
|
211
|
-
|
212
|
-
thead << "</thead>"
|
213
|
-
|
214
|
-
return thead
|
215
|
-
end
|
216
|
-
|
217
|
-
# Creates the cart parameters
|
218
|
-
# [_cart_params:_]
|
219
|
-
#
|
220
|
-
# [_columns:_]
|
221
|
-
#
|
222
|
-
def create_item_cart_params(cart_params, columns)
|
223
|
-
link_ref_array = []
|
224
|
-
|
225
|
-
cart_params.each do |key, value|
|
226
|
-
link_ref_array.push("#{key}=#{value}")
|
227
|
-
end
|
228
|
-
|
229
|
-
access_ref_index = image_access_reference_columns()
|
230
|
-
link_ref_array.push("resource=#{CGI.escape(columns[access_ref_index].value).to_s}") if access_ref_index
|
231
|
-
ra_index = image_ra_columns()
|
232
|
-
link_ref_array.push("rac=#{columns[ra_index].value.to_s}") if ra_index
|
233
|
-
dec_index = image_dec_columns()
|
234
|
-
link_ref_array.push("decc=#{columns[dec_index].value.to_s}") if dec_index
|
235
|
-
filter_index = image_filter_columns()
|
236
|
-
link_ref_array.push("filter=#{columns[filter_index].value.to_s}") if filter_index
|
237
|
-
date_obs_index = image_date_obs_columns()
|
238
|
-
link_ref_array.push("date_obs=#{columns[date_obs_index].value.to_s}") if date_obs_index
|
239
|
-
teles_index = image_telescope_columns()
|
240
|
-
link_ref_array.push("telescop=#{columns[teles_index].value.to_s}") if teles_index
|
241
|
-
survey_index = image_survey_columns()
|
242
|
-
link_ref_array.push("survey=#{columns[survey_index].value.to_s}") if survey_index
|
243
|
-
instrum_index = image_instrument_columns()
|
244
|
-
link_ref_array.push("instrument=#{columns[instrum_index].value.to_s}") if instrum_index
|
245
|
-
sky_index = image_sky_columns()
|
246
|
-
link_ref_array.push("sky=#{columns[sky_index].value.to_s}") if sky_index
|
247
|
-
zerop_index = image_zeropoint_columns()
|
248
|
-
link_ref_array.push("zeropoint=#{columns[zerop_index].value.to_s}") if zerop_index
|
249
|
-
seeing_index = image_seeing_columns()
|
250
|
-
link_ref_array.push("seeing=#{columns[seeing_index].value.to_s}") if seeing_index
|
251
|
-
depth_index = image_depth_columns()
|
252
|
-
link_ref_array.push("depth=#{columns[depth_index].value.to_s}") if depth_index
|
253
|
-
exptime_index = image_exptime_columns()
|
254
|
-
link_ref_array.push("exptime=#{columns[exptime_index].value.to_s}") if exptime_index
|
255
|
-
|
256
|
-
return link_ref_array.join('&')
|
257
|
-
end
|
258
|
-
|
259
|
-
# Create body for HTML table
|
260
|
-
# [_access_ref_index_:]
|
261
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
262
|
-
# [_options_:]
|
263
|
-
#
|
264
|
-
def create_body(access_ref_index, options)
|
265
|
-
tbody = "<tbody class=\"#{options[:body_class]}\" align=\"center\">\n"
|
266
|
-
row_count = 0
|
267
|
-
rows_data = rows(options[:res], options[:tbl])
|
268
|
-
if rows_data
|
269
|
-
rows_data.each do |tr|
|
270
|
-
tbody << "<tr class=\"#{options[:row_classes][row_count % 2]}\">\n"
|
271
|
-
|
272
|
-
# Specially mark up the first column to link to the image.
|
273
|
-
columns = tr.tds()
|
274
|
-
|
275
|
-
if options[:infer_add_to_cart_ref] and access_ref_index
|
276
|
-
tbody << "<td><input type=\"checkbox\" " +
|
277
|
-
"id=\"checkbox_add_#{options[:cart_params][:archive]}_#{row_count.to_s}\" " +
|
278
|
-
"value=\"#{create_item_cart_params(options[:cart_params], columns)}\"/></td>\n"
|
279
|
-
end
|
280
|
-
|
281
|
-
if options[:infer_access_ref] and access_ref_index
|
282
|
-
tbody << "<td><a href=\"#{columns[access_ref_index].value}\">#{options[:access_ref_link_label]}</a></td>\n"
|
283
|
-
end
|
284
|
-
|
285
|
-
col_count = 0
|
286
|
-
#ra_index = image_ra_columns()
|
287
|
-
#dec_index = image_dec_columns()
|
288
|
-
columns.each do |td|
|
289
|
-
if col_count != access_ref_index
|
290
|
-
#if ra_index and col_count == ra_index
|
291
|
-
# tbody << "<td>#{convert_ra_to_degrees(td.value)}</td>\n"
|
292
|
-
#elsif dec_index and col_count == dec_index
|
293
|
-
# tbody << "<td>#{convert_dec_to_degrees(td.value)}</td>\n"
|
294
|
-
#else
|
295
|
-
tbody << "<td>#{td.value}</td>\n"
|
296
|
-
#end
|
297
|
-
end
|
298
|
-
col_count += 1
|
299
|
-
end
|
300
|
-
|
301
|
-
tbody << "</tr>\n"
|
302
|
-
row_count += 1
|
303
|
-
end
|
304
|
-
end
|
305
|
-
tbody << "</tbody>"
|
306
|
-
|
307
|
-
return tbody
|
308
|
-
end
|
309
|
-
|
310
|
-
# Convert the specified table in the specified resource into an HTML
|
311
|
-
# table.
|
312
|
-
# [_options_:]
|
313
|
-
# The options for this VOTable.
|
314
|
-
def to_html(options={})
|
315
|
-
# The ID to assign to the HTML table as a whole.
|
316
|
-
options[:id] = options[:id] || "#{votable}_#{Time.now.to_i}_#{rand(10000)}"
|
317
|
-
|
318
|
-
options[:infer_add_to_cart_ref] = true if options[:infer_add_to_cart_ref] == nil
|
319
|
-
options[:add_to_cart_header_label] = options[:add_to_cart_header_label] || 'Add to Cart'
|
320
|
-
options[:cart_params] = {} if options[:cart_params] == nil
|
321
|
-
#options[:add_to_cart_url] = options[:add_to_cart_url] || nil
|
322
|
-
|
323
|
-
options[:throbber_src] = options[:throbber_src] || '/images/general/indicator.gif'
|
324
|
-
options[:throbber_size] = options[:throbber_size] || '16x16'
|
325
|
-
options[:throbber_class] = options[:throbber_class] || 'throbber'
|
326
|
-
options[:throbber_id] = options[:throbber_id] || "#{options[:id]}_throbber_id"
|
327
|
-
|
328
|
-
options[:flash_notice_class] = options[:flash_notice_class] || 'flash_notice'
|
329
|
-
options[:flash_notice_id] = options[:flash_notice_id] || "#{options[:id]}_flash_notice_id"
|
330
|
-
|
331
|
-
# Link the access reference URL associated with a row.
|
332
|
-
options[:infer_access_ref] = true if options[:infer_access_ref] == nil
|
333
|
-
#options[:retrieve_link_ref] = options[:retrieve_link_ref] || nil
|
334
|
-
# For the access reference column, place this value in the header.
|
335
|
-
options[:access_ref_header_label] = options[:access_ref_header_label] || 'URL'
|
336
|
-
# For the access reference column, link this word.
|
337
|
-
options[:access_ref_link_label] = options[:access_ref_link_label] || 'Retrieve'
|
338
|
-
options[:ssl] = false if options[:ssl] == nil
|
339
|
-
#options[:resource_link] = options[:resource_link]
|
340
|
-
|
341
|
-
# The resource from which to extract the table in question.
|
342
|
-
options[:res] = options[:res] || 0
|
343
|
-
# The table inside the resource from which to extract the rows in question.
|
344
|
-
options[:tbl] = options[:tbl] || 0
|
345
|
-
|
346
|
-
# The boolean value to show HTML table border
|
347
|
-
options[:show_border] = false if options[:show_border] == nil
|
348
|
-
# The class to assign the HTML table as a whole.
|
349
|
-
options[:table_class] = options[:table_class] || 'votable'
|
350
|
-
# The class to assign the header of the HTML table.
|
351
|
-
options[:header_class] = options[:header_class] || 'header'
|
352
|
-
# The class to assign the body of the HTML table.
|
353
|
-
options[:body_class] = options[:body_class] || 'body'
|
354
|
-
# The class to assign the HTML table body rows.
|
355
|
-
options[:row_classes] = options[:row_classes] || ['row1', 'row2']
|
356
|
-
|
357
|
-
begin
|
358
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
359
|
-
access_ref_index = image_access_reference_columns()
|
360
|
-
|
361
|
-
return create_votable(create_headers(access_ref_index, options),
|
362
|
-
create_body(access_ref_index, options),
|
363
|
-
options)
|
364
|
-
|
365
|
-
rescue Exception => e
|
366
|
-
title = 'Error...'
|
367
|
-
message = "VORuby error: #{e.message}<br>#{e.backtrace}"
|
368
|
-
message << "<br>#{@resources[0].info[0].text().to_s()}" if @resources[0].info[0]
|
369
|
-
create_message(title, message, options)
|
370
|
-
end
|
371
|
-
end
|
372
|
-
|
373
|
-
end
|
374
|
-
end
|
375
|
-
|
376
|
-
end
|
377
|
-
end
|