voruby 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/util.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
module VORuby
|
2
|
-
module Utilities
|
3
|
-
|
4
|
-
def self.save_to(file, in_string)
|
5
|
-
out_file = File.new(file, 'w+')
|
6
|
-
out_file.puts(in_string)
|
7
|
-
|
8
|
-
return out_file
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.subclass_names(klass, preserve_ns=true)
|
12
|
-
subclasses = []
|
13
|
-
ObjectSpace.each_object(Module){ |c|
|
14
|
-
if c.ancestors.include?(klass)
|
15
|
-
if !preserve_ns
|
16
|
-
subclasses << c.name.split('::')[-1]
|
17
|
-
else
|
18
|
-
subclasses << c.name
|
19
|
-
end
|
20
|
-
end
|
21
|
-
}
|
22
|
-
|
23
|
-
return subclasses
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
@@ -1,213 +0,0 @@
|
|
1
|
-
require 'voruby/voevent/loader'
|
2
|
-
|
3
|
-
require 'voruby/stc/stc_v1_20'
|
4
|
-
include VORuby::STC::V1_20
|
5
|
-
|
6
|
-
module VORuby
|
7
|
-
module VOEvent
|
8
|
-
module V1_0
|
9
|
-
|
10
|
-
# Forward declarations
|
11
|
-
class VOEvent; end
|
12
|
-
class Who; end
|
13
|
-
class Contact; end
|
14
|
-
class Communication; end
|
15
|
-
class What; end
|
16
|
-
class Param; end
|
17
|
-
class Group; end
|
18
|
-
class WhereWhen; end
|
19
|
-
class How; end
|
20
|
-
class Why; end
|
21
|
-
class Name; end
|
22
|
-
class Concept; end
|
23
|
-
class Inference; end
|
24
|
-
class Citations; end
|
25
|
-
class EventID < VORuby::Resources::VOResource::V0_10::AnyURI; end
|
26
|
-
class Description; end
|
27
|
-
class Reference; end
|
28
|
-
|
29
|
-
# VOEvent is the root element for describing observations
|
30
|
-
# of immediate astronomical events. For more information, see
|
31
|
-
# http://www.ivoa.net/twiki/bin/view/IVOA/IvoaVOEvent.
|
32
|
-
class VOEvent
|
33
|
-
include XML::Mapping
|
34
|
-
|
35
|
-
text_node :version, '@version', :optional => false, :default_value => '1.0'
|
36
|
-
|
37
|
-
text_enumeration_node :role, '@role', :optional => true, :default_value => 'observation',
|
38
|
-
:choices => ['observation', 'prediction', 'test']
|
39
|
-
|
40
|
-
object_node :who, 'Who', :class => Who, :optional => true
|
41
|
-
object_node :what, 'What', :class => What, :optional => true
|
42
|
-
object_node :where_when, 'WhereWhen', :class => WhereWhen, :optional => true
|
43
|
-
object_node :how, 'How', :class => How, :optional => true
|
44
|
-
object_node :why, 'Why', :class => Why, :optional => true
|
45
|
-
object_node :citations, 'Citations', :class => Citations, :optional => true
|
46
|
-
object_node :reference, 'Reference', :class => Reference, :optional => true
|
47
|
-
object_node :voevent_id, '@id', :class => VORuby::Resources::VOResource::V0_10::AnyURI, :optional => false
|
48
|
-
end
|
49
|
-
|
50
|
-
# Curation metadata.
|
51
|
-
class Who
|
52
|
-
include XML::Mapping
|
53
|
-
|
54
|
-
date_time_node :date, 'Date', :optional => false
|
55
|
-
|
56
|
-
array_node :publisher_ids, 'PublisherID', :class => VORuby::Resources::VOResource::V0_10::AnyURI, :optional => false,
|
57
|
-
:default_value => []
|
58
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true, :default_value => []
|
59
|
-
array_node :references, 'Reference', :class => Reference, :optional => true, :default_value => []
|
60
|
-
array_node :contacts, 'Contact', :class => Contact, :optional => true, :default_value => []
|
61
|
-
end
|
62
|
-
|
63
|
-
class Contact
|
64
|
-
include XML::Mapping
|
65
|
-
|
66
|
-
text_node :username, 'Username', :optional => true
|
67
|
-
text_node :name, 'Name', :optional => true
|
68
|
-
text_node :last_name, 'LastName', :optional => true
|
69
|
-
text_node :first_name, 'FirstName', :optional => true
|
70
|
-
text_node :institution, 'Institution', :optional => true
|
71
|
-
|
72
|
-
boolean_node :principal_investigator, '@principalInvestigator', 'true', 'false', :optional => true,
|
73
|
-
:default_value => 'false'
|
74
|
-
boolean_node :principal_contact, '@principalContact', 'true', 'false', :optional => true,
|
75
|
-
:default_value => 'false'
|
76
|
-
|
77
|
-
array_node :communications, 'Communication', :class => Communication, :optional => true, :default_value => []
|
78
|
-
end
|
79
|
-
|
80
|
-
class Communication
|
81
|
-
include XML::Mapping
|
82
|
-
|
83
|
-
text_node :address_line, 'AddressLine', :optional => true
|
84
|
-
text_node :country_code, 'CountryCode', :optional => true
|
85
|
-
text_node :fax, 'Fax', :optional => true
|
86
|
-
text_node :telephone, 'Telephone', :optional => true
|
87
|
-
|
88
|
-
object_node :email, 'Email', :class => VORuby::Resources::VOResource::V0_10::AnyURI, :optional => true
|
89
|
-
object_node :uri, 'Uri', :class => VORuby::Resources::VOResource::V0_10::AnyURI, :optional => true
|
90
|
-
end
|
91
|
-
|
92
|
-
# Event Characterization.
|
93
|
-
class What
|
94
|
-
include XML::Mapping
|
95
|
-
|
96
|
-
array_node :params, 'Param', :class => Param, :default_value => []
|
97
|
-
array_node :groups, 'Group', :class => Group, :default_value => []
|
98
|
-
array_node :descriptions, 'Description', :class => Description, :default_value => []
|
99
|
-
array_node :references, 'Reference', :class => Reference, :default_values => []
|
100
|
-
end
|
101
|
-
|
102
|
-
class Param
|
103
|
-
include XML::Mapping
|
104
|
-
|
105
|
-
text_node :name, '@name', :optional => false
|
106
|
-
text_node :ucd, '@ucd', :optional => true
|
107
|
-
text_node :value, '@value', :optional => false
|
108
|
-
text_node :unit, '@unit', :optional => true
|
109
|
-
end
|
110
|
-
|
111
|
-
class Group
|
112
|
-
include XML::Mapping
|
113
|
-
|
114
|
-
text_node :name, '@name', :optional => true
|
115
|
-
text_node :group_type, '@type', :optional => true
|
116
|
-
|
117
|
-
array_node :params, 'Param', :class => Param, :optional => false
|
118
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true
|
119
|
-
array_node :references, 'Reference', :class => Reference, :optional => true
|
120
|
-
end
|
121
|
-
|
122
|
-
# Space-Time Coordinates, uses the VO STC schema.
|
123
|
-
class WhereWhen
|
124
|
-
include XML::Mapping
|
125
|
-
|
126
|
-
# I haven't modeled STC yet...
|
127
|
-
object_node :observation_location, 'ObservationLocation', :class => ObservationLocationType,
|
128
|
-
:optional => true
|
129
|
-
|
130
|
-
object_node :description, 'Description', :class => Description, :optional => true
|
131
|
-
object_node :reference, 'Reference', :class => Reference, :optional => true
|
132
|
-
end
|
133
|
-
|
134
|
-
# Instrument Configuration, references to RTML documents.
|
135
|
-
class How
|
136
|
-
include XML::Mapping
|
137
|
-
|
138
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true, :default_value => []
|
139
|
-
array_node :references, 'Reference', :class => Reference, :optional => true, :default_value => []
|
140
|
-
end
|
141
|
-
|
142
|
-
# Initial Scientific Assessment.
|
143
|
-
class Why
|
144
|
-
include XML::Mapping
|
145
|
-
|
146
|
-
numeric_node :importance, '@importance', :optional => true
|
147
|
-
date_time_node :expires, '@expires', :optional => true
|
148
|
-
|
149
|
-
array_node :names, 'Name', :class => Name, :optional => false
|
150
|
-
array_node :concepts, 'Concept', :class => Concept, :optional => false
|
151
|
-
array_node :inferences, 'Inference', :class => Inference, :optional => true
|
152
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true
|
153
|
-
array_node :references, 'Reference', :class => Reference, :optional => true
|
154
|
-
end
|
155
|
-
|
156
|
-
class Name
|
157
|
-
include XML::Mapping
|
158
|
-
|
159
|
-
text_node :value, '', :optional => false
|
160
|
-
end
|
161
|
-
|
162
|
-
class Concept
|
163
|
-
include XML::Mapping
|
164
|
-
|
165
|
-
text_node :value, '', :optional => false
|
166
|
-
end
|
167
|
-
|
168
|
-
class Inference
|
169
|
-
include XML::Mapping
|
170
|
-
|
171
|
-
numeric_node :probability, '@probability', :optional => true
|
172
|
-
text_node :relation, '@relation', :optional => true
|
173
|
-
|
174
|
-
array_node :names, 'Name', :class => Name, :optional => false
|
175
|
-
array_node :concepts, 'Concept', :class => Concept, :optional => false
|
176
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true
|
177
|
-
array_node :references, 'Reference', :class => Reference, :optional => true
|
178
|
-
end
|
179
|
-
|
180
|
-
# Follow-up Observations.
|
181
|
-
class Citations
|
182
|
-
include XML::Mapping
|
183
|
-
|
184
|
-
array_node :event_ids, 'EventID', :class => EventID, :optional => false
|
185
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true
|
186
|
-
array_node :references, 'Reference', :class => Reference, :optional => true
|
187
|
-
end
|
188
|
-
|
189
|
-
class EventID
|
190
|
-
text_enumeration_node :cite, '@cite', :optional => false,
|
191
|
-
:choices => ['followup', 'supercedes', 'retraction']
|
192
|
-
end
|
193
|
-
|
194
|
-
# Human Oriented Content.
|
195
|
-
class Description
|
196
|
-
include XML::Mapping
|
197
|
-
|
198
|
-
text_node :value, '', :optional => false
|
199
|
-
end
|
200
|
-
|
201
|
-
# External Content.
|
202
|
-
class Reference
|
203
|
-
include XML::Mapping
|
204
|
-
|
205
|
-
text_node :reference_type, '@type', :optional => true
|
206
|
-
text_node :name, '@name', :optional => true
|
207
|
-
|
208
|
-
object_node :uri, '@uri', :class => VORuby::Resources::VOResource::V0_10::AnyURI, :optional => false
|
209
|
-
end
|
210
|
-
|
211
|
-
end
|
212
|
-
end
|
213
|
-
end
|
@@ -1,196 +0,0 @@
|
|
1
|
-
require 'voruby/voevent/loader'
|
2
|
-
|
3
|
-
#require 'voruby/stc/stc_v1_30'
|
4
|
-
#include VORuby::STC::V1_30
|
5
|
-
|
6
|
-
module VORuby
|
7
|
-
module VOEvent
|
8
|
-
module V1_1
|
9
|
-
|
10
|
-
# Forward declarations
|
11
|
-
class VOEvent; end
|
12
|
-
class Who; end
|
13
|
-
class Author; end
|
14
|
-
class What; end
|
15
|
-
class Param; end
|
16
|
-
class Group; end
|
17
|
-
class WhereWhen; end
|
18
|
-
class How; end
|
19
|
-
class Why; end
|
20
|
-
class Name; end
|
21
|
-
class Concept; end
|
22
|
-
class Inference; end
|
23
|
-
class Citations; end
|
24
|
-
class EventIVORN < VORuby::Resources::VOResource::V0_10::AnyURI; end
|
25
|
-
class Description; end
|
26
|
-
class Reference; end
|
27
|
-
|
28
|
-
# VOEvent is the root element for describing observations
|
29
|
-
# of immediate astronomical events. For more information, see
|
30
|
-
# http://www.ivoa.net/twiki/bin/view/IVOA/IvoaVOEvent.
|
31
|
-
class VOEvent
|
32
|
-
include XML::Mapping
|
33
|
-
|
34
|
-
text_node :version, '@version', :optional => false, :default_value => '1.1'
|
35
|
-
|
36
|
-
text_enumeration_node :role, '@role', :optional => true, :default_value => 'observation',
|
37
|
-
:choices => ['observation', 'prediction', 'utility', 'test']
|
38
|
-
|
39
|
-
object_node :who, 'Who', :class => Who, :optional => true
|
40
|
-
object_node :what, 'What', :class => What, :optional => true
|
41
|
-
object_node :where_when, 'WhereWhen', :class => WhereWhen, :optional => true
|
42
|
-
object_node :how, 'How', :class => How, :optional => true
|
43
|
-
object_node :why, 'Why', :class => Why, :optional => true
|
44
|
-
object_node :citations, 'Citations', :class => Citations, :optional => true
|
45
|
-
object_node :description, 'Description', :class => Description, :optional => true
|
46
|
-
object_node :reference, 'Reference', :class => Reference, :optional => true
|
47
|
-
object_node :ivorn, '@ivorn', :class => VORuby::Resources::VOResource::V0_10::AnyURI, :optional => false
|
48
|
-
end
|
49
|
-
|
50
|
-
# Curation Metadata.
|
51
|
-
class Who
|
52
|
-
include XML::Mapping
|
53
|
-
|
54
|
-
date_time_node :date, 'Date', :optional => false
|
55
|
-
|
56
|
-
array_node :author_ivorns, 'AuthorIVORN', :class => VORuby::Resources::VOResource::V0_10::AnyURI, :optional => false
|
57
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true
|
58
|
-
array_node :references, 'Reference', :class => Reference, :optional => true
|
59
|
-
array_node :authors, 'Author', :class => Author, :optional => true
|
60
|
-
end
|
61
|
-
|
62
|
-
class Author
|
63
|
-
include XML::Mapping
|
64
|
-
|
65
|
-
text_node :title, 'title', :optional => true
|
66
|
-
text_node :short_name, 'shortName', :optional => true
|
67
|
-
text_node :logo_url, 'logoURL', :optional => true
|
68
|
-
text_node :contact_name, 'contactName', :optional => true
|
69
|
-
text_node :contact_email, 'contactEmail', :optional => true
|
70
|
-
text_node :contact_phone, 'contactPhone', :optional => true
|
71
|
-
text_node :contributor, 'contributor', :optional => true
|
72
|
-
end
|
73
|
-
|
74
|
-
# Event Characterization.
|
75
|
-
class What
|
76
|
-
include XML::Mapping
|
77
|
-
|
78
|
-
array_node :params, 'Param', :class => Param, :optional => true, :default_value => []
|
79
|
-
array_node :groups, 'Group', :class => Group, :optional => true, :default_value => []
|
80
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true, :default_value => []
|
81
|
-
array_node :references, 'Reference', :class => Reference, :optional => true, :default_value => []
|
82
|
-
end
|
83
|
-
|
84
|
-
class Param
|
85
|
-
include XML::Mapping
|
86
|
-
|
87
|
-
text_node :name, '@name', :optional => false
|
88
|
-
text_node :ucd, '@ucd', :optional => true
|
89
|
-
text_node :value, '@value', :optional => false
|
90
|
-
text_node :unit, '@unit', :optional => true
|
91
|
-
end
|
92
|
-
|
93
|
-
class Group
|
94
|
-
include XML::Mapping
|
95
|
-
|
96
|
-
text_node :name, '@name', :optional => true
|
97
|
-
text_node :group_type, '@type', :optional => true
|
98
|
-
|
99
|
-
array_node :params, 'Param', :class => Param, :optional => true, :default_value => []
|
100
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true, :default_value => []
|
101
|
-
array_node :references, 'Reference', :class => Reference, :optional => true, :default_value => []
|
102
|
-
end
|
103
|
-
|
104
|
-
# Space-Time Coordinates, uses the VO STC schema.
|
105
|
-
class WhereWhen
|
106
|
-
include XML::Mapping
|
107
|
-
|
108
|
-
# I haven't modeled STC yet...
|
109
|
-
#object_node :observation_location, 'ObservationLocation', :class => ObservationLocationType,
|
110
|
-
# :optional => true
|
111
|
-
|
112
|
-
object_node :description, 'Description', :class => Description, :optional => true
|
113
|
-
object_node :reference, 'Reference', :class => Reference, :optional => true
|
114
|
-
end
|
115
|
-
|
116
|
-
# Instrument Configuration, references to RTML documents.
|
117
|
-
class How
|
118
|
-
include XML::Mapping
|
119
|
-
|
120
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true, :default_value => []
|
121
|
-
array_node :references, 'Reference', :class => Reference, :optional => true, :default_value => []
|
122
|
-
end
|
123
|
-
|
124
|
-
# Initial Scientific Assessment.
|
125
|
-
class Why
|
126
|
-
include XML::Mapping
|
127
|
-
|
128
|
-
numeric_node :importance, '@importance', :optional => true
|
129
|
-
date_time_node :expires, '@expires', :optional => true
|
130
|
-
|
131
|
-
array_node :names, 'Name', :class => Name, :optional => false
|
132
|
-
array_node :concepts, 'Concept', :class => Concept, :optional => false
|
133
|
-
array_node :inferences, 'Inference', :class => Inference, :optional => true
|
134
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true
|
135
|
-
array_node :references, 'Reference', :class => Reference, :optional => true
|
136
|
-
end
|
137
|
-
|
138
|
-
class Name
|
139
|
-
include XML::Mapping
|
140
|
-
|
141
|
-
text_node :value, '', :optional => false
|
142
|
-
end
|
143
|
-
|
144
|
-
class Concept
|
145
|
-
include XML::Mapping
|
146
|
-
|
147
|
-
text_node :value, '', :optional => false
|
148
|
-
end
|
149
|
-
|
150
|
-
class Inference
|
151
|
-
include XML::Mapping
|
152
|
-
|
153
|
-
numeric_node :probability, '@probability', :optional => true
|
154
|
-
text_node :relation, '@relation', :optional => true
|
155
|
-
|
156
|
-
array_node :names, 'Name', :class => Name, :optional => false
|
157
|
-
array_node :concepts, 'Concept', :class => Concept, :optional => false
|
158
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true
|
159
|
-
array_node :references, 'Reference', :class => Reference, :optional => true
|
160
|
-
end
|
161
|
-
|
162
|
-
# Follow-up Observations.
|
163
|
-
class Citations
|
164
|
-
include XML::Mapping
|
165
|
-
|
166
|
-
array_node :event_ivorns, 'EventIVORN', :class => EventIVORN, :optional => false
|
167
|
-
array_node :descriptions, 'Description', :class => Description, :optional => true
|
168
|
-
array_node :references, 'Reference', :class => Reference, :optional => true
|
169
|
-
end
|
170
|
-
|
171
|
-
class EventIVORN
|
172
|
-
text_enumeration_node :cite, '@cite', :optional => false,
|
173
|
-
:choices => ['followup', 'supersedes', 'retraction']
|
174
|
-
end
|
175
|
-
|
176
|
-
# Human readable text.
|
177
|
-
class Description
|
178
|
-
include XML::Mapping
|
179
|
-
|
180
|
-
text_node :value, '', :optional => false
|
181
|
-
text_node :format, '@format', :optional => true, :default_value => 'text/plain'
|
182
|
-
end
|
183
|
-
|
184
|
-
# External Content.
|
185
|
-
class Reference
|
186
|
-
include XML::Mapping
|
187
|
-
|
188
|
-
text_node :name, '@name', :optional => true
|
189
|
-
text_node :reference_type, '@type', :optional => true, :default_value => 'url'
|
190
|
-
|
191
|
-
object_node :uri, '@uri', :class => VORuby::Resources::VOResource::V0_10::AnyURI, :optional => false
|
192
|
-
end
|
193
|
-
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
@@ -1,373 +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 CHANDRA VOTable.
|
4
|
-
|
5
|
-
require 'voruby/votables/votable'
|
6
|
-
|
7
|
-
module VORuby
|
8
|
-
module VOTables
|
9
|
-
|
10
|
-
module VOTable
|
11
|
-
class CHANDRAVOTable < VOTable
|
12
|
-
|
13
|
-
# Our object's contructor
|
14
|
-
# [_votable:_]
|
15
|
-
# The VOTable object
|
16
|
-
def initialize(votable)
|
17
|
-
super(votable.id, votable.version, votable.description,
|
18
|
-
votable.definitions, votable.coosys, votable.params,
|
19
|
-
votable.info, votable.resources)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Find the column number(s) associated with a Name.
|
23
|
-
# Returns a list of column positions.
|
24
|
-
# [_res_:]
|
25
|
-
# The resource from which to extract the table in question.
|
26
|
-
# [_tbl_:]
|
27
|
-
# The resource from which to extract the table in question.
|
28
|
-
def find_columns(name, res=0, tbl=0)
|
29
|
-
columns = []
|
30
|
-
|
31
|
-
col_count = 0
|
32
|
-
fields = fields(res, tbl)
|
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
|
-
return columns
|
42
|
-
end
|
43
|
-
|
44
|
-
# Find a field in CHANDRA configuration file given a key.
|
45
|
-
# Returns a hash with the field's attributes
|
46
|
-
# [_key_:]
|
47
|
-
# The key indexing on field's attribute
|
48
|
-
def find_field_in_conf_file(key)
|
49
|
-
chandra_field = {'id'=> nil, 'name'=> nil, 'ucd'=> nil}
|
50
|
-
|
51
|
-
if key != nil
|
52
|
-
CHANDRA_ARCHIVE_CONFIG.each do |archive|
|
53
|
-
archive['votable_fields'].each do |field|
|
54
|
-
if field['key'] == key
|
55
|
-
chandra_field['id'] = field['id'] if field['id'] != 'nil'
|
56
|
-
chandra_field['name'] = field['name'] if field['name'] != 'nil'
|
57
|
-
chandra_field['ucd'] = field['ucd'] if field['ucd'] != 'nil'
|
58
|
-
break
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
return chandra_field
|
64
|
-
end
|
65
|
-
|
66
|
-
def image_access_reference_columns()
|
67
|
-
access_key = find_field_in_conf_file('URL')['name']
|
68
|
-
|
69
|
-
if find_columns(access_key).first != nil
|
70
|
-
find_columns(access_key).first
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def image_ra_columns
|
75
|
-
ra_key = find_field_in_conf_file('RA')['name']
|
76
|
-
|
77
|
-
if find_columns(ra_key).first != nil
|
78
|
-
find_columns(ra_key).first
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def image_dec_columns
|
83
|
-
dec_key = find_field_in_conf_file('Dec')['name']
|
84
|
-
|
85
|
-
if find_columns(dec_key).first != nil
|
86
|
-
find_columns(dec_key).first
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def image_filter_columns
|
91
|
-
#filter_key = find_field_in_conf_file('')['name']
|
92
|
-
|
93
|
-
#if find_columns(filter_key).first != nil
|
94
|
-
# find_columns(filter_key).first
|
95
|
-
#end
|
96
|
-
end
|
97
|
-
|
98
|
-
def image_date_obs_columns
|
99
|
-
#date_obs_key = find_field_in_conf_file('')['name']
|
100
|
-
|
101
|
-
#if find_columns(date_obs_key).first != nil
|
102
|
-
# find_columns(date_obs_key).first
|
103
|
-
#end
|
104
|
-
end
|
105
|
-
|
106
|
-
def image_telescope_columns
|
107
|
-
#telescope_key = find_field_in_conf_file('')['name']
|
108
|
-
|
109
|
-
#if find_columns(telescope_key).first != nil
|
110
|
-
# find_columns(telescope_key).first
|
111
|
-
#end
|
112
|
-
end
|
113
|
-
|
114
|
-
def image_survey_columns
|
115
|
-
survey_key = find_field_in_conf_file('Object')['name']
|
116
|
-
|
117
|
-
if find_columns(survey_key).first != nil
|
118
|
-
find_columns(survey_key).first
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
def image_instrument_columns
|
123
|
-
instrument_key = find_field_in_conf_file('Instrument')['name']
|
124
|
-
|
125
|
-
if find_columns(instrument_key).first != nil
|
126
|
-
find_columns(instrument_key).first
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def image_sky_columns
|
131
|
-
#sky_key = find_field_in_conf_file('')['name']
|
132
|
-
|
133
|
-
#if find_columns(sky_key).first != nil
|
134
|
-
# find_columns(sky_key).first
|
135
|
-
#end
|
136
|
-
end
|
137
|
-
|
138
|
-
def image_zeropoint_columns
|
139
|
-
#zeropoint_key = find_field_in_conf_file('')['name']
|
140
|
-
|
141
|
-
#if find_columns(zeropoint_key).first != nil
|
142
|
-
# find_columns(zeropoint_key).first
|
143
|
-
#end
|
144
|
-
end
|
145
|
-
|
146
|
-
def image_seeing_columns
|
147
|
-
#seeing_key = find_field_in_conf_file('')['name']
|
148
|
-
|
149
|
-
#if find_columns(seeing_key).first != nil
|
150
|
-
# find_columns(seeing_key).first
|
151
|
-
#end
|
152
|
-
end
|
153
|
-
|
154
|
-
def image_depth_columns
|
155
|
-
#depth_key = find_field_in_conf_file('')['name']
|
156
|
-
|
157
|
-
#if find_columns(depth_key).first != nil
|
158
|
-
# find_columns(depth_key).first
|
159
|
-
#end
|
160
|
-
end
|
161
|
-
|
162
|
-
def image_exptime_columns
|
163
|
-
#exptime_key = find_field_in_conf_file('')['name']
|
164
|
-
|
165
|
-
#if find_columns(exptime_key).first != nil
|
166
|
-
# find_columns(exptime_key).first
|
167
|
-
#end
|
168
|
-
end
|
169
|
-
|
170
|
-
# Create the headers for HTML table
|
171
|
-
# [_access_ref_index_:]
|
172
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
173
|
-
# [_options_:]
|
174
|
-
#
|
175
|
-
def create_headers(access_ref_index, options)
|
176
|
-
thead, thead_2row = create_header_cart_links(options)
|
177
|
-
|
178
|
-
if options[:infer_access_ref] and access_ref_index
|
179
|
-
thead << "<th>#{options[:access_ref_header_label]}</th>\n"
|
180
|
-
thead_2row.push(' ')
|
181
|
-
end
|
182
|
-
|
183
|
-
col_count = 0
|
184
|
-
fields(options[:res], options[:tbl]).each do |field|
|
185
|
-
field_archive = find_field_in_conf_file(field.name())
|
186
|
-
field_ucd = field_archive['ucd']
|
187
|
-
if options[:infer_access_ref] and col_count == access_ref_index
|
188
|
-
thead_2row[1] = field_ucd if field_ucd != 'nil'
|
189
|
-
else
|
190
|
-
thead << "<th>#{field_archive['name']}</th>\n"
|
191
|
-
if field_ucd != 'nil'
|
192
|
-
thead_2row.push(field_ucd)
|
193
|
-
else
|
194
|
-
thead_2row.push(' ')
|
195
|
-
end
|
196
|
-
end
|
197
|
-
col_count += 1
|
198
|
-
end
|
199
|
-
|
200
|
-
thead << " </tr>\n"
|
201
|
-
|
202
|
-
thead << "<tr>\n"
|
203
|
-
thead_2row.each do |h|
|
204
|
-
thead << "<th>#{h}</th>\n"
|
205
|
-
end
|
206
|
-
thead << "</tr>\n"
|
207
|
-
|
208
|
-
thead << "</thead>"
|
209
|
-
|
210
|
-
return thead
|
211
|
-
end
|
212
|
-
|
213
|
-
# Creates the cart parameters
|
214
|
-
# [_cart_params:_]
|
215
|
-
#
|
216
|
-
# [_columns:_]
|
217
|
-
#
|
218
|
-
def create_item_cart_params(cart_params, columns)
|
219
|
-
link_ref_array = []
|
220
|
-
|
221
|
-
cart_params.each do |key, value|
|
222
|
-
link_ref_array.push("#{key}=#{value}")
|
223
|
-
end
|
224
|
-
|
225
|
-
access_ref_index = image_access_reference_columns()
|
226
|
-
link_ref_array.push("resource=#{CGI.escape(columns[access_ref_index].value).to_s}") if access_ref_index
|
227
|
-
ra_index = image_ra_columns()
|
228
|
-
link_ref_array.push("rac=#{columns[ra_index].value.to_s}") if ra_index
|
229
|
-
dec_index = image_dec_columns()
|
230
|
-
link_ref_array.push("decc=#{columns[dec_index].value.to_s}") if dec_index
|
231
|
-
filter_index = image_filter_columns()
|
232
|
-
link_ref_array.push("filter=#{columns[filter_index].value.to_s}") if filter_index
|
233
|
-
date_obs_index = image_date_obs_columns()
|
234
|
-
link_ref_array.push("date_obs=#{columns[date_obs_index].value.to_s}") if date_obs_index
|
235
|
-
teles_index = image_telescope_columns()
|
236
|
-
link_ref_array.push("telescop=#{columns[teles_index].value.to_s}") if teles_index
|
237
|
-
survey_index = image_survey_columns()
|
238
|
-
link_ref_array.push("survey=#{columns[survey_index].value.to_s}") if survey_index
|
239
|
-
instrum_index = image_instrument_columns()
|
240
|
-
link_ref_array.push("instrument=#{columns[instrum_index].value.to_s}") if instrum_index
|
241
|
-
sky_index = image_sky_columns()
|
242
|
-
link_ref_array.push("sky=#{columns[sky_index].value.to_s}") if sky_index
|
243
|
-
zerop_index = image_zeropoint_columns()
|
244
|
-
link_ref_array.push("zeropoint=#{columns[zerop_index].value.to_s}") if zerop_index
|
245
|
-
seeing_index = image_seeing_columns()
|
246
|
-
link_ref_array.push("seeing=#{columns[seeing_index].value.to_s}") if seeing_index
|
247
|
-
depth_index = image_depth_columns()
|
248
|
-
link_ref_array.push("depth=#{columns[depth_index].value.to_s}") if depth_index
|
249
|
-
exptime_index = image_exptime_columns()
|
250
|
-
link_ref_array.push("exptime=#{columns[exptime_index].value.to_s}") if exptime_index
|
251
|
-
|
252
|
-
return link_ref_array.join('&')
|
253
|
-
end
|
254
|
-
|
255
|
-
# Create body for HTML table
|
256
|
-
# [_access_ref_index_:]
|
257
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
258
|
-
# [_options_:]
|
259
|
-
#
|
260
|
-
def create_body(access_ref_index, options)
|
261
|
-
tbody = "<tbody class=\"#{options[:body_class]}\" align=\"center\">\n"
|
262
|
-
row_count = 0
|
263
|
-
rows_data = rows(options[:res], options[:tbl])
|
264
|
-
if rows_data
|
265
|
-
rows_data.each do |tr|
|
266
|
-
tbody << "<tr class=\"#{options[:row_classes][row_count % 2]}\">\n"
|
267
|
-
|
268
|
-
# Specially mark up the first column to link to the image.
|
269
|
-
columns = tr.tds()
|
270
|
-
|
271
|
-
if options[:infer_add_to_cart_ref] and access_ref_index
|
272
|
-
tbody << "<td><input type=\"checkbox\" " +
|
273
|
-
"id=\"checkbox_add_#{options[:cart_params][:archive]}_#{row_count.to_s}\" " +
|
274
|
-
"value=\"#{create_item_cart_params(options[:cart_params], columns)}\"/></td>\n"
|
275
|
-
end
|
276
|
-
|
277
|
-
if options[:infer_access_ref] and access_ref_index
|
278
|
-
tbody << "<td><a href=\"#{columns[access_ref_index].value}\">#{options[:access_ref_link_label]}</a></td>\n"
|
279
|
-
end
|
280
|
-
|
281
|
-
col_count = 0
|
282
|
-
#ra_index = image_ra_columns()
|
283
|
-
#dec_index = image_dec_columns()
|
284
|
-
columns.each do |td|
|
285
|
-
if col_count != access_ref_index
|
286
|
-
#if ra_index and col_count == ra_index
|
287
|
-
# tbody << "<td>#{convert_ra_to_degrees(td.value)}</td>\n"
|
288
|
-
#elsif dec_index and col_count == dec_index
|
289
|
-
# tbody << "<td>#{convert_dec_to_degrees(td.value)}</td>\n"
|
290
|
-
#else
|
291
|
-
tbody << "<td>#{td.value}</td>\n"
|
292
|
-
#end
|
293
|
-
end
|
294
|
-
col_count += 1
|
295
|
-
end
|
296
|
-
|
297
|
-
tbody << "</tr>\n"
|
298
|
-
row_count += 1
|
299
|
-
end
|
300
|
-
end
|
301
|
-
tbody << "</tbody>"
|
302
|
-
|
303
|
-
return tbody
|
304
|
-
end
|
305
|
-
|
306
|
-
# Convert the specified table in the specified resource into an HTML
|
307
|
-
# table.
|
308
|
-
# [_options_:]
|
309
|
-
# The options for this VOTable.
|
310
|
-
def to_html(options={})
|
311
|
-
# The ID to assign to the HTML table as a whole.
|
312
|
-
options[:id] = options[:id] || "#{votable}_#{Time.now.to_i}_#{rand(10000)}"
|
313
|
-
|
314
|
-
options[:infer_add_to_cart_ref] = true if options[:infer_add_to_cart_ref] == nil
|
315
|
-
options[:add_to_cart_header_label] = options[:add_to_cart_header_label] || 'Add to Cart'
|
316
|
-
options[:cart_params] = {} if options[:cart_params] == nil
|
317
|
-
#options[:add_to_cart_url] = options[:add_to_cart_url] || nil
|
318
|
-
|
319
|
-
options[:throbber_src] = options[:throbber_src] || '/images/general/indicator.gif'
|
320
|
-
options[:throbber_size] = options[:throbber_size] || '16x16'
|
321
|
-
options[:throbber_class] = options[:throbber_class] || 'throbber'
|
322
|
-
options[:throbber_id] = options[:throbber_id] || "#{options[:id]}_throbber_id"
|
323
|
-
|
324
|
-
options[:flash_notice_class] = options[:flash_notice_class] || 'flash_notice'
|
325
|
-
options[:flash_notice_id] = options[:flash_notice_id] || "#{options[:id]}_flash_notice_id"
|
326
|
-
|
327
|
-
# Link the access reference URL associated with a row.
|
328
|
-
options[:infer_access_ref] = true if options[:infer_access_ref] == nil
|
329
|
-
#options[:retrieve_link_ref] = options[:retrieve_link_ref] || nil
|
330
|
-
# For the access reference column, place this value in the header.
|
331
|
-
options[:access_ref_header_label] = options[:access_ref_header_label] || 'URL'
|
332
|
-
# For the access reference column, link this word.
|
333
|
-
options[:access_ref_link_label] = options[:access_ref_link_label] || 'Retrieve'
|
334
|
-
options[:ssl] = false if options[:ssl] == nil
|
335
|
-
#options[:resource_link] = options[:resource_link]
|
336
|
-
|
337
|
-
# The resource from which to extract the table in question.
|
338
|
-
options[:res] = options[:res] || 0
|
339
|
-
# The table inside the resource from which to extract the rows in question.
|
340
|
-
options[:tbl] = options[:tbl] || 0
|
341
|
-
|
342
|
-
# The boolean value to show HTML table border
|
343
|
-
options[:show_border] = false if options[:show_border] == nil
|
344
|
-
# The class to assign the HTML table as a whole.
|
345
|
-
options[:table_class] = options[:table_class] || 'votable'
|
346
|
-
# The class to assign the header of the HTML table.
|
347
|
-
options[:header_class] = options[:header_class] || 'header'
|
348
|
-
# The class to assign the body of the HTML table.
|
349
|
-
options[:body_class] = options[:body_class] || 'body'
|
350
|
-
# The class to assign the HTML table body rows.
|
351
|
-
options[:row_classes] = options[:row_classes] || ['row1', 'row2']
|
352
|
-
|
353
|
-
begin
|
354
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
355
|
-
access_ref_index = image_access_reference_columns()
|
356
|
-
|
357
|
-
return create_votable(create_headers(access_ref_index, options),
|
358
|
-
create_body(access_ref_index, options),
|
359
|
-
options)
|
360
|
-
|
361
|
-
rescue Exception => e
|
362
|
-
title = 'Error...'
|
363
|
-
message = "VORuby error: #{e.message}<br>#{e.backtrace}"
|
364
|
-
message << "<br>#{@resources[0].info[0].text().to_s()}" if @resources[0].info[0]
|
365
|
-
create_message(title, message, options)
|
366
|
-
end
|
367
|
-
end
|
368
|
-
|
369
|
-
end
|
370
|
-
end
|
371
|
-
|
372
|
-
end
|
373
|
-
end
|