voruby 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
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,95 @@
1
+ require 'voruby/services/loader'
2
+
3
+ module VORuby
4
+ module Services
5
+ module Gestalt
6
+
7
+ class FootPrintService
8
+ attr_reader :driver
9
+
10
+ def initialize(driver, debug=false)
11
+ @driver = driver
12
+ @driver.wiredump_dev = $stderr if debug
13
+ end
14
+
15
+ def self.from_wsdl(wsdl='http://nvogre.phyast.pitt.edu:8080/axis2/services/GestaltService?wsdl', debug=false)
16
+ return FootPrintService.new(SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver, debug)
17
+ end
18
+
19
+ def makeCircleMap(ra, dec, radius, multiple_tables=false)
20
+ ra = [ra] if !ra.is_a?(Array)
21
+ dec = [dec] if !dec.is_a?(Array)
22
+ radius = [radius] if !radius.is_a?(Array)
23
+
24
+ params = {}
25
+ params['in0'] = ra
26
+ params['in1'] = dec
27
+ params['in2'] = radius
28
+ params['in3'] = multiple_tables
29
+
30
+ map_names = @driver.makeCircleMap(params.to_soap_map)['makeCircleMapReturn']
31
+
32
+ map_names = [map_names] if !map_names.is_a?(Array)
33
+ return map_names
34
+ end
35
+
36
+ def deleteTables(map_name)
37
+ params = {}
38
+ params['in0'] = map_name
39
+
40
+ # Successful deletion is 0 for some reason...
41
+ return true if @driver.deleteTables(params.to_soap_map)['deleteTablesReturn'] == '0'
42
+ return false
43
+ end
44
+
45
+ def deleteAllTables(map_names)
46
+ responses = []
47
+ map_names.each do |map_name|
48
+ responses.push(self.deleteTables(map_name))
49
+ end
50
+
51
+ return responses
52
+ end
53
+
54
+ def makePlot(map_names, ramin, ramax, decmin, decmax, fill=false, color=1)
55
+ params = {}
56
+ params['in0'] = ramin
57
+ params['in1'] = ramax
58
+ params['in2'] = decmin
59
+ params['in3'] = decmax
60
+ params['in4'] = fill
61
+ params['in5'] = color
62
+ if !map_names.is_a?(Array)
63
+ params['in6'] = [map_names]
64
+ else
65
+ params['in6'] = map_names
66
+ end
67
+
68
+ return @driver.makePlot(params.to_soap_map)['makePlotReturn']
69
+ end
70
+
71
+ def self.plot_limits(ra, dec, radius, buffer=1.0)
72
+ ra = [ra] if !ra.is_a?(Array)
73
+ dec = [dec] if !dec.is_a?(Array)
74
+ radius = [radius] if !radius.is_a?(Array)
75
+
76
+ min_ra_ind = ra.index(ra.min)
77
+ min_ra = ra.min - (radius[min_ra_ind] + buffer)
78
+ max_ra_ind = ra.index(ra.max)
79
+ max_ra = ra.max + (radius[max_ra_ind] + buffer)
80
+
81
+ min_dec_ind = dec.index(dec.min)
82
+ min_dec = dec.min - (radius[min_dec_ind] + buffer)
83
+ max_dec_ind = dec.index(dec.max)
84
+ max_dec = dec.max + (radius[max_dec_ind] + buffer)
85
+
86
+ return [min_ra, max_ra, min_dec, max_dec]
87
+ end
88
+ end
89
+
90
+ end
91
+ end
92
+ end
93
+
94
+
95
+
@@ -0,0 +1,105 @@
1
+ require 'voruby/services/loader'
2
+
3
+ module VORuby
4
+ module Services
5
+ module Gestalt
6
+
7
+ class WCSFixerException < RuntimeError; end
8
+ class WCSFixerSoapException < WCSFixerException; end
9
+
10
+ class WCSFixerService
11
+ attr_reader :driver
12
+
13
+ def initialize(driver, debug=false)
14
+ @driver = driver
15
+ @driver.wiredump_dev = $stderr if debug
16
+ end
17
+
18
+ def self.from_wsdl(wsdl='http://nvogre.phyast.pitt.edu:9090/wcs/WcsFixer.asmx?wsdl', debug=false)
19
+ return WCSFixerService.new(SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver, debug)
20
+ end
21
+
22
+ # Corrects a FITS image URL with WCS information.
23
+ # If output_file is specified, the corrected FITS images is retrieved and stored locally,
24
+ # otherwise its URI is returned.
25
+ def fixUrl(url, output_file=nil, calibration_db="SDSSDR3", approx_img_offset=5.0, num_objects=50, ellipticity_cut=1.2)
26
+ params = {'url' => url,
27
+ 'db' => calibration_db,
28
+ 'offset' => approx_img_offset,
29
+ 'numObjects' => num_objects,
30
+ 'elongCut' => ellipticity_cut}
31
+
32
+ begin
33
+ # If an output file is specified, retrieve the fixed FITS and save it locally.
34
+ retrieval_url = @driver.fixUrl(params.to_soap_map)['FixUrlResult']
35
+ (output_file != nil)? (return VORuby::Utilities::save_to(output_file, URI.parse(retrieval_url).read)): (return retrieval_url)
36
+ rescue SOAP::FaultError => sfe
37
+ raise WCSFixerSoapException, sfe
38
+ end
39
+ end
40
+
41
+ # Corrects a FITS image with WCS information.
42
+ def fix(fitsfile, output_file, calibration_db="SDSSDR3", approx_img_offset=5.0, num_objects=50, ellipticity_cut=1.2)
43
+ params = {'fitsfile' => File.read(fitsfile),
44
+ 'db' => calibration_db,
45
+ 'offset' => approx_img_offset,
46
+ 'numObjects' => num_objects,
47
+ 'elongCut' => ellipticity_cut}
48
+
49
+ begin
50
+ corrected_fits = @driver.fix(params.to_soap_map)['FixWithoutWcsResult']
51
+ return VORuby::Utilities::save_to(output_file, corrected_fits)
52
+ rescue SOAP::FaultError => sfe
53
+ raise WCSFixerSoapException, sfe
54
+ end
55
+ end
56
+
57
+ # Corrects a FITS image URL without WCS information.
58
+ # If output_file is specified, the corrected FITS images is retrieved and stored locally,
59
+ # otherwise its URI is returned.
60
+ def fixWithoutWcsUrl(url, output_file,
61
+ ra_center, dec_center, pixel_scale,
62
+ calibration_db="SDSSDR3", approx_img_offset=5.0, num_objects=50, ellipticity_cut=1.2)
63
+ params = {'url' => url,
64
+ 'db' => calibration_db,
65
+ 'offset' => approx_img_offset,
66
+ 'numObjects' => num_objects,
67
+ 'elongCut' => ellipticity_cut,
68
+ 'raCenter' => ra_center,
69
+ 'decCenter' => dec_center,
70
+ 'pixelScale' => pixel_scale}
71
+
72
+ begin
73
+ # If an output file is specified, retrieve the fixed FITS and save it locally.
74
+ retrieval_url = @driver.fixWithoutWcsUrl(params.to_soap_map)['FixUrlResult']
75
+ (output_file != nil)? (return VORuby::Utilities::save_to(output_file, URI.parse(retrieval_url).read)): (return retrieval_url)
76
+ rescue SOAP::FaultError => sfe
77
+ raise WCSFixerSoapException, sfe
78
+ end
79
+ end
80
+
81
+ # Corrects a FITS image with WCS information.
82
+ def fixWithoutWcs(fitsfile, output_file,
83
+ ra_center, dec_center, pixel_scale,
84
+ calibration_db="SDSSDR3", approx_img_offset=5.0, num_objects=50, ellipticity_cut=1.2)
85
+ params = {'fitsfile' => File.read(fitsfile),
86
+ 'db' => calibration_db,
87
+ 'offset' => approx_img_offset,
88
+ 'numObjects' => num_objects,
89
+ 'elongCut' => ellipticity_cut,
90
+ 'raCenter' => ra_center,
91
+ 'decCenter' => dec_center,
92
+ 'pixelScale' => pixel_scale}
93
+
94
+ begin
95
+ corrected_fits = @driver.fixWithoutWcs(params.to_soap_map)['FixWithoutWcsResult']
96
+ return VORuby::Utilities::save_to(output_file, corrected_fits)
97
+ rescue SOAP::FaultError => sfe
98
+ raise WCSFixerSoapException, sfe
99
+ end
100
+ end
101
+ end
102
+
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,155 @@
1
+ require 'voruby/services/loader'
2
+
3
+ module VORuby
4
+ module Services
5
+ module Gestalt
6
+
7
+ class WesixException < RuntimeError; end
8
+ class NoVotableException < WesixException
9
+ def initialize
10
+ super('VOTABLE missing from SOAP response. ' +
11
+ 'Often this is caused by an overly large catalog. ' +
12
+ 'Try increasing your detection threshold.')
13
+ end
14
+ end
15
+
16
+ class Wesix
17
+ attr_reader :factory, :driver,
18
+ :allowed_in_params, :allowed_out_params, :in_params, :out_params
19
+
20
+ def initialize(driver, bootstrap=true, debug=false)
21
+ @driver = driver
22
+ @driver.wiredump_dev = $stderr if debug
23
+
24
+ @in_params = {}
25
+ @out_params = {}
26
+
27
+ define_accessors()
28
+ bootstrap_params() if bootstrap
29
+ end
30
+
31
+ def self.from_wsdl(wsdl="http://nvogre.phyast.pitt.edu:8080/axis/services/WesixTest?wsdl", bootstrap=true, debug=false)
32
+ return Wesix.new(SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver, bootstrap, debug)
33
+ end
34
+
35
+ def define_accessors
36
+ @allowed_in_params = []
37
+ @allowed_out_params = []
38
+
39
+ @driver.proxy.literal_mapping_registry.definedtypes.each do |el|
40
+ case el.name.name
41
+ when 'SexParams'
42
+ el.each_element do |ctype|
43
+ @allowed_in_params.push(ctype.name.name)
44
+ meta_def(ctype.name.name.downcase){get_in_param(ctype.name.name)}
45
+ meta_def(ctype.name.name.downcase + '='){|value| set_in_param(ctype.name.name, value)}
46
+ end
47
+ when 'SexOutputParams'
48
+ el.each_element do |ctype|
49
+ @allowed_out_params.push(ctype.name.name)
50
+ meta_def(ctype.name.name.downcase){get_out_param(ctype.name.name)}
51
+ meta_def(ctype.name.name.downcase + '='){|value| set_out_param(ctype.name.name, value)}
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ def bootstrap_params
58
+ bootstrap_in_params
59
+ bootstrap_out_params
60
+ end
61
+
62
+ def reset_params
63
+ reset_in_params
64
+ reset_out_params
65
+ end
66
+
67
+ def bootstrap_in_params
68
+ in_params = @driver.getSexParams()[0]
69
+ @allowed_in_params.each do |param_name|
70
+ @in_params[param_name] = in_params[param_name]
71
+ end
72
+ end
73
+
74
+ def reset_in_params
75
+ @in_params = {}
76
+ end
77
+
78
+ def bootstrap_out_params
79
+ out_params = @driver.getSexOutputParams()[0]
80
+ @allowed_out_params.each do |param_name|
81
+ @out_params[param_name] = out_params[param_name]
82
+ end
83
+ end
84
+
85
+ def reset_out_params
86
+ @out_params = {}
87
+ end
88
+
89
+ def set_in_param(name, value)
90
+ if @allowed_in_params.include?(name)
91
+ @in_params[name] = value
92
+ else
93
+ raise "Input parameter #{name} is not recognized"
94
+ end
95
+ end
96
+
97
+ def get_in_param(name)
98
+ @in_params[name]
99
+ end
100
+
101
+ def set_out_param(name, value)
102
+ if @allowed_out_params.include?(name)
103
+ @out_params[name] = value
104
+ else
105
+ raise "Output parameter #{name} is not recognized"
106
+ end
107
+ end
108
+
109
+ def get_out_param(name)
110
+ @out_params[name]
111
+ end
112
+
113
+ def _file_as_string(file)
114
+ bytes = nil
115
+ File.open(file){ |file_obj|
116
+ bytes = file_obj.readlines.join()
117
+ }
118
+
119
+ return bytes
120
+ end
121
+
122
+ def wsextractor3VO(file, flag=0)
123
+ response = @driver.wsextractor3VO(_file_as_string(file), @in_params.to_soap_map, @out_params.to_soap_map, flag)
124
+ return VOTable::VOTable.from_soap_obj(response[0].vOTABLE) if response[0].respond_to?(:vOTABLE)
125
+
126
+ raise NoVotableException
127
+ end
128
+
129
+ def wsextractor3VOXmatch(file, flag=0)
130
+ response = @driver.wsextractor3VOXmatch(_file_as_string(file), @in_params.to_soap_map, @out_params.to_soap_map, flag)
131
+ return VOTable::VOTable.from_soap_obj(response[0].vOTABLE) if response[0].respond_to?(:vOTABLE)
132
+
133
+ raise NoVotableException
134
+ end
135
+
136
+ def wsextractorURL3VO(file, flag=0)
137
+ response = @driver.wsextractorURL3VO(file, @in_params.to_soap_map, @out_params.to_soap_map, flag)
138
+ return VOTables::VOTable::VOTable.from_soap_obj(response[0].vOTABLE) if response[0].respond_to?(:vOTABLE)
139
+
140
+ raise NoVotableException
141
+ end
142
+
143
+ def wsextractorURL3VOXmatch(file, flag=0)
144
+ response = @driver.wsextractorURL3VOXmatch(file, @in_params.to_soap_map, @out_params.to_soap_map, flag)
145
+ return VOTable::VOTable.from_soap_obj(response[0].vOTABLE) if response[0].respond_to?(:vOTABLE)
146
+
147
+ raise NoVotableException
148
+ end
149
+
150
+ private :define_accessors, :bootstrap_in_params, :bootstrap_out_params, :bootstrap_params, :_file_as_string
151
+ end
152
+
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,7 @@
1
+ require 'open-uri'
2
+ require 'soap/wsdlDriver'
3
+ require 'rexml/document'
4
+
5
+ require 'voruby/loader'
6
+ require 'voruby/services/ext'
7
+ require 'voruby/votables/votable'
@@ -0,0 +1,53 @@
1
+ require 'tmpdir'
2
+
3
+ require 'voruby/services/loader'
4
+ require 'voruby/resources/stsci'
5
+
6
+ module VORuby
7
+ module Services
8
+ module Registry
9
+
10
+ class STScI
11
+ attr_reader :factory, :driver
12
+
13
+ def initialize(driver, debug=false)
14
+ @driver = driver
15
+ @driver.wiredump_dev = $stderr if debug
16
+
17
+ # This is basically a big hack. We are going to ignore everything soap4r
18
+ # does for us in terms of interpreting the result of a query. Instead
19
+ # we'll dump the raw SOAP to file and parse it on our own. This is obviously
20
+ # not optimal, but works for now.
21
+ @driver.wiredump_file_base = Dir::tmpdir() + '/stsci_registry'
22
+ end
23
+
24
+ def self.from_wsdl(wsdl="http://nvo.stsci.edu/VORegistry/registry.asmx?WSDL", debug=false)
25
+ return STScI.new(SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver, debug)
26
+ end
27
+
28
+ def queryVOResource(predicate)
29
+ params = {'predicate' => predicate}
30
+
31
+ request_file = @driver.wiredump_file_base() + '_queryVOResource_request.xml'
32
+ response_file = @driver.wiredump_file_base() + '_queryVOResource_response.xml'
33
+
34
+ # Query the registry
35
+ @driver.queryVOResource(params.to_soap_map)
36
+
37
+ # Parse the returned SOAP envelope and extract the query result
38
+ soap_envelope = REXML::Document.new File.new(response_file)
39
+ response = REXML::XPath.first(soap_envelope.root, '//QueryVOResourceResult')
40
+
41
+ # Convert the result into our own domain objects
42
+ resources = VORuby::Resources::STScI::ArrayOfResource.load_from_xml(VORuby::Resources::STScI::clean(response))
43
+
44
+ # Clean up the wiredump files.
45
+ File.unlink(request_file, response_file)
46
+
47
+ return resources
48
+ end
49
+ end
50
+
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,35 @@
1
+ require 'voruby/services/loader'
2
+
3
+ require 'voruby/sesame/sesame_v1_0'
4
+
5
+ include VORuby::Sesame::V1_0
6
+
7
+ module VORuby
8
+ module Services
9
+ module Resolver
10
+
11
+ class Sesame
12
+ attr_reader :factor, :driver
13
+
14
+ def initialize(driver, debug=false)
15
+ @driver = driver
16
+ @driver.wiredump_dev = $stderr if debug
17
+ end
18
+
19
+ def self.from_wsdl(wsdl='http://vizier.cfa.harvard.edu:8080/axis/services/Sesame?wsdl', debug=false)
20
+ return Sesame.new(SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver, debug)
21
+ end
22
+
23
+ def query(object_name)
24
+ VORuby::Sesame::V1_0::Sesame.load_from_xml(REXML::Document.new(@driver.sesameXML(object_name)).root)
25
+ end
26
+
27
+ def query_position(object_name)
28
+ query = query(object_name)
29
+ Equatorial::RADecPosition.new(query.resolvers[0].jradeg, query.resolvers[0].jdedeg)
30
+ end
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'xml/mapping'
3
+
4
+ require 'voruby/loader'
5
+
6
+ require 'voruby/resources/nodes'
@@ -0,0 +1,64 @@
1
+ require 'voruby/sesame/loader'
2
+
3
+ require 'voruby/spacetime/spacetime'
4
+
5
+ include VORuby::CoordinateSystems
6
+
7
+ module VORuby
8
+ module Sesame
9
+ module V1_0
10
+
11
+ # Forward declarations
12
+ class Sesame; end
13
+ class Target; end
14
+ class SimpleString; end
15
+ class Resolver; end
16
+
17
+ # Sesame is the root element.
18
+ class Sesame
19
+ include XML::Mapping
20
+
21
+ array_node :info, 'INFO', :class => SimpleString, :optional => true, :default_value => []
22
+ array_node :errors, 'ERROR', :class => SimpleString, :optional => true, :default_value => []
23
+ array_node :resolvers, 'Resolver', :class => Resolver, :optional => false
24
+
25
+ object_node :target, 'target', :class => Target, :optional => false
26
+ end
27
+
28
+ class Target
29
+ include XML::Mapping
30
+
31
+ text_node :value, '', :optional => false
32
+ text_node :option, '@option', :optional => false
33
+ end
34
+
35
+ class SimpleString
36
+ include XML::Mapping
37
+
38
+ text_node :value, '', :optional => false
39
+ end
40
+
41
+ class Resolver
42
+ include XML::Mapping
43
+
44
+ array_node :info, 'INFO', :class => SimpleString, :optional => true, :default_value => []
45
+ array_node :errors, 'ERROR', :class => SimpleString, :optional => true, :default_value => []
46
+ array_node :aliases, 'alias', :class => SimpleString, :optional => true, :default_value => []
47
+
48
+ text_node :otype, 'otype', :optional => true
49
+ text_node :jpos, 'jpos', :optional => true
50
+ text_node :ref_pos, 'refPos', :optional => true
51
+ text_node :oname, 'oname', :optional => true
52
+ text_node :name, '@name', :optional => false
53
+ text_node :code, '@code', :optional => true
54
+
55
+ numeric_node :jradeg, 'jradeg', :optional => true
56
+ numeric_node :jdedeg, 'jdedeg', :optional => true
57
+ numeric_node :err_ra_mas, 'errRAmas', :optional => true
58
+ numeric_node :err_de_mas, 'errDEmas', :optional => true
59
+ numeric_node :nrefs, 'nrefs', :optional => true
60
+ end
61
+
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,6 @@
1
+ require 'net/http'
2
+ require 'tempfile'
3
+
4
+ require 'voruby/loader'
5
+ require 'voruby/simple/parameters'
6
+ require 'voruby/votables/tree'