voruby 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. data/LICENSE +339 -0
  2. data/REQUIREMENTS +4 -0
  3. data/Rakefile.rb +296 -0
  4. data/lib/voruby/adql/adql.rb +2735 -0
  5. data/lib/voruby/adql/ext.rb +15 -0
  6. data/lib/voruby/adql/loader.rb +5 -0
  7. data/lib/voruby/adql/operations.rb +54 -0
  8. data/lib/voruby/adql/parser.rb +160 -0
  9. data/lib/voruby/adql/transforms.rb +573 -0
  10. data/lib/voruby/ext.rb +17 -0
  11. data/lib/voruby/loader.rb +4 -0
  12. data/lib/voruby/misc/propertyfile.rb +36 -0
  13. data/lib/voruby/plastic/applications.rb +174 -0
  14. data/lib/voruby/plastic/constants.rb +30 -0
  15. data/lib/voruby/plastic/loader.rb +10 -0
  16. data/lib/voruby/plastic/plastic.rb +1 -0
  17. data/lib/voruby/resources/conesearch/conesearch.rb +9 -0
  18. data/lib/voruby/resources/conesearch/conesearch_v0_2.rb +55 -0
  19. data/lib/voruby/resources/conesearch/conesearch_v0_3.rb +50 -0
  20. data/lib/voruby/resources/conesearch/conesearch_v1_0.rb +72 -0
  21. data/lib/voruby/resources/conesearch/loader.rb +4 -0
  22. data/lib/voruby/resources/loader.rb +50 -0
  23. data/lib/voruby/resources/nodes.rb +190 -0
  24. data/lib/voruby/resources/openskynode/loader.rb +4 -0
  25. data/lib/voruby/resources/openskynode/openskynode.rb +9 -0
  26. data/lib/voruby/resources/openskynode/openskynode_v0_1.rb +54 -0
  27. data/lib/voruby/resources/sia/loader.rb +5 -0
  28. data/lib/voruby/resources/sia/sia.rb +9 -0
  29. data/lib/voruby/resources/sia/sia_v0_6.rb +90 -0
  30. data/lib/voruby/resources/sia/sia_v0_7.rb +89 -0
  31. data/lib/voruby/resources/sia/sia_v1_0.rb +122 -0
  32. data/lib/voruby/resources/stsci.rb +59 -0
  33. data/lib/voruby/resources/vodataservice/coverage_v0_2.rb +195 -0
  34. data/lib/voruby/resources/vodataservice/coverage_v0_3.rb +158 -0
  35. data/lib/voruby/resources/vodataservice/loader.rb +5 -0
  36. data/lib/voruby/resources/vodataservice/vodataservice.rb +9 -0
  37. data/lib/voruby/resources/vodataservice/vodataservice_v0_4.rb +189 -0
  38. data/lib/voruby/resources/vodataservice/vodataservice_v0_5.rb +163 -0
  39. data/lib/voruby/resources/vodataservice/vodataservice_v1_0.rb +221 -0
  40. data/lib/voruby/resources/voregistry/loader.rb +4 -0
  41. data/lib/voruby/resources/voregistry/voregistry.rb +9 -0
  42. data/lib/voruby/resources/voregistry/voregistry_v0_2.rb +40 -0
  43. data/lib/voruby/resources/voregistry/voregistry_v0_3.rb +30 -0
  44. data/lib/voruby/resources/voregistry/voregistry_v1_0.rb +86 -0
  45. data/lib/voruby/resources/voresource/loader.rb +17 -0
  46. data/lib/voruby/resources/voresource/voresource.rb +9 -0
  47. data/lib/voruby/resources/voresource/voresource_v0_10.rb +322 -0
  48. data/lib/voruby/resources/voresource/voresource_v0_9.rb +405 -0
  49. data/lib/voruby/resources/voresource/voresource_v1_0.rb +230 -0
  50. data/lib/voruby/services/ext.rb +11 -0
  51. data/lib/voruby/services/gestalt/footprint.rb +95 -0
  52. data/lib/voruby/services/gestalt/wcs_fixer.rb +105 -0
  53. data/lib/voruby/services/gestalt/wesix.rb +155 -0
  54. data/lib/voruby/services/loader.rb +7 -0
  55. data/lib/voruby/services/registry/registry.rb +53 -0
  56. data/lib/voruby/services/resolver/resolver.rb +35 -0
  57. data/lib/voruby/sesame/loader.rb +6 -0
  58. data/lib/voruby/sesame/sesame_v1_0.rb +64 -0
  59. data/lib/voruby/simple/loader.rb +6 -0
  60. data/lib/voruby/simple/parameters.rb +196 -0
  61. data/lib/voruby/simple/sap.rb +446 -0
  62. data/lib/voruby/spacetime/loader.rb +3 -0
  63. data/lib/voruby/spacetime/spacetime.rb +607 -0
  64. data/lib/voruby/stc/coords_v1_20.rb +900 -0
  65. data/lib/voruby/stc/loader.rb +55 -0
  66. data/lib/voruby/stc/region_v1_20.rb +274 -0
  67. data/lib/voruby/stc/stc_v1_20.rb +1196 -0
  68. data/lib/voruby/util.rb +27 -0
  69. data/lib/voruby/voevent/loader.rb +7 -0
  70. data/lib/voruby/voevent/voevent_v1_0.rb +213 -0
  71. data/lib/voruby/voevent/voevent_v1_1.rb +196 -0
  72. data/lib/voruby/votables/chandra.rb +410 -0
  73. data/lib/voruby/votables/cnoc.rb +393 -0
  74. data/lib/voruby/votables/data.rb +179 -0
  75. data/lib/voruby/votables/galex.rb +390 -0
  76. data/lib/voruby/votables/hst.rb +391 -0
  77. data/lib/voruby/votables/int.rb +391 -0
  78. data/lib/voruby/votables/libxml_parser.rb +411 -0
  79. data/lib/voruby/votables/libxml_votable.rb +67 -0
  80. data/lib/voruby/votables/loader.rb +10 -0
  81. data/lib/voruby/votables/meta.rb +763 -0
  82. data/lib/voruby/votables/misc.rb +51 -0
  83. data/lib/voruby/votables/nsa.rb +393 -0
  84. data/lib/voruby/votables/nsar3.rb +410 -0
  85. data/lib/voruby/votables/rexml_parser.rb +408 -0
  86. data/lib/voruby/votables/rexml_votable.rb +67 -0
  87. data/lib/voruby/votables/sdss.rb +393 -0
  88. data/lib/voruby/votables/transforms.rb +388 -0
  89. data/lib/voruby/votables/tree.rb +45 -0
  90. data/lib/voruby/votables/types.rb +391 -0
  91. data/lib/voruby/votables/votable.rb +630 -0
  92. data/lib/voruby/votables/xmm.rb +394 -0
  93. data/test/adql/test1.adql +49 -0
  94. data/test/adql/test2.adql +51 -0
  95. data/test/adql/test3.adql +81 -0
  96. data/test/adql/test4.adql +53 -0
  97. data/test/adql/test5.adql +55 -0
  98. data/test/adql/test6.adql +18 -0
  99. data/test/adql/test7.adql +48 -0
  100. data/test/adql/unittest.rb +1672 -0
  101. data/test/plastic/test.rb +44 -0
  102. data/test/plastic/test.vot +5385 -0
  103. data/test/plastic/unittest.rb +66 -0
  104. data/test/resources/conesearch/conesearch_v0_3.xml +31 -0
  105. data/test/resources/conesearch/conesearch_v1_0.xml +86 -0
  106. data/test/resources/conesearch/unittest_v0_3.rb +22 -0
  107. data/test/resources/conesearch/unittest_v1_0.rb +24 -0
  108. data/test/resources/openskynode/open_sky_node_v0_1.xml +32 -0
  109. data/test/resources/openskynode/unittest_v0_1.rb +31 -0
  110. data/test/resources/sia/simple_image_access_v0_7.xml +36 -0
  111. data/test/resources/sia/simple_image_access_v1_0.xml +122 -0
  112. data/test/resources/sia/unittest_v0_7.rb +24 -0
  113. data/test/resources/sia/unittest_v1_0.rb +29 -0
  114. data/test/resources/stsci.xml +336 -0
  115. data/test/resources/unittest_stsci.rb +25 -0
  116. data/test/resources/vodataservice/catalog_service_resource_v1_0.xml +128 -0
  117. data/test/resources/vodataservice/data_collection_resource_v0_5.xml +54 -0
  118. data/test/resources/vodataservice/data_collection_resource_v1_0.xml +117 -0
  119. data/test/resources/vodataservice/data_service_resource_v1_0.xml +115 -0
  120. data/test/resources/vodataservice/sky_service_resource_v0_10.xml +45 -0
  121. data/test/resources/vodataservice/table_service_resource_v1_0.xml +122 -0
  122. data/test/resources/vodataservice/tabular_sky_service_resource_v0_10.xml +60 -0
  123. data/test/resources/vodataservice/unittest_v0_5.rb +126 -0
  124. data/test/resources/vodataservice/unittest_v1_0.rb +151 -0
  125. data/test/resources/voregistry/authority_resource_v0_3.xml +20 -0
  126. data/test/resources/voregistry/authority_resource_v1_0.xml +82 -0
  127. data/test/resources/voregistry/registry_service_v0_3.xml +20 -0
  128. data/test/resources/voregistry/registry_service_v1_0.xml +107 -0
  129. data/test/resources/voregistry/unittest_v0_3.rb +31 -0
  130. data/test/resources/voregistry/unittest_v1_0.rb +34 -0
  131. data/test/resources/voresource/organisation_resource_v1_0.xml +90 -0
  132. data/test/resources/voresource/resource_organisation_v0_10.xml +22 -0
  133. data/test/resources/voresource/resource_service_v0_10.xml +19 -0
  134. data/test/resources/voresource/resource_v0_10.xml +19 -0
  135. data/test/resources/voresource/resource_v1_0.xml +79 -0
  136. data/test/resources/voresource/service_resource_v1_0.xml +91 -0
  137. data/test/resources/voresource/unittest_v0_10.rb +61 -0
  138. data/test/resources/voresource/unittest_v0_9.rb +4 -0
  139. data/test/resources/voresource/unittest_v1_0.rb +190 -0
  140. data/test/services/gestalt/unittest.rb +74 -0
  141. data/test/services/registry/unittest.rb +34 -0
  142. data/test/services/resolver/unittest.rb +38 -0
  143. data/test/simple/unittest.rb +46 -0
  144. data/test/spacetime/unittest.rb +39 -0
  145. data/test/stc/catalog_entry_location_v1_20.xml +112 -0
  146. data/test/stc/obs_data_location_v1_20.xml +108 -0
  147. data/test/stc/search_location_v1_20.xml +54 -0
  148. data/test/stc/stc_resource_profile_v1_20.xml +60 -0
  149. data/test/stc/unittest_v1_20.rb +620 -0
  150. data/test/voevent/unittest_v1_0.rb +79 -0
  151. data/test/voevent/unittest_v1_1.rb +70 -0
  152. data/test/voevent/voevent_v1_0.xml +96 -0
  153. data/test/voevent/voevent_v1_1.xml +76 -0
  154. data/test/votables/test.vot +366 -0
  155. data/test/votables/unittest.rb +54 -0
  156. metadata +256 -0
@@ -0,0 +1,15 @@
1
+ class REXML::Element
2
+ def find_attribute(attr_name, ns=nil)
3
+ if !ns
4
+ return self.attributes[attr_name]
5
+ else
6
+ ns_index = self.namespaces.index(ns)
7
+ if ns_index
8
+ ns_prefix = self.prefixes[ns_index]
9
+ return self.attributes["#{ns_prefix}:#{attr_name}"]
10
+ else
11
+ return nil
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ require 'rexml/element'
2
+
3
+ require 'voruby/loader'
4
+ require 'voruby/votables/misc'
5
+ require 'voruby/adql/ext'
@@ -0,0 +1,54 @@
1
+ # This class gives a set of operations
2
+ module VORuby
3
+ module ADQL
4
+
5
+ class Operations
6
+
7
+ # This method returns an array of column names. For now, it reads
8
+ # a file from somewhere path. In the future we'll have a service
9
+ # that will return a xml file with similar information.
10
+ #[_path_]
11
+ # It's temporal param
12
+ def self.get_columns(path)
13
+ columns_array = [{'name'=>'All'}]
14
+
15
+ document = REXML::Document.new(File.new(path))#This is temporal way
16
+ raise "Document haven't elements" if document.root == nil
17
+
18
+ document.root.elements.each('String') do |element|
19
+ columns_array.push({'name'=>element.text})
20
+ end
21
+
22
+ return columns_array
23
+ end
24
+
25
+ # This method returns an array of column info. For now, it reads
26
+ # a file from somewhere path. In the future we'll have a service
27
+ # that will return a xml file with similar information.
28
+ #[_path_]
29
+ # It's temporal param
30
+ def self.get_meta_columns(path)
31
+ columns_array = []
32
+
33
+ document = REXML::Document.new(File.new(path))#This is temporal way
34
+ raise "Document haven't elements" if document.root == nil
35
+
36
+ document.root.elements.each('MetaColumn') do |meta_element|
37
+ node_name = REXML::XPath.first(meta_element, 'Name')
38
+ node_unit = REXML::XPath.first(meta_element, 'Unit')
39
+ node_des = REXML::XPath.first(meta_element, 'Description')
40
+ node_ucd = REXML::XPath.first(meta_element, 'UCD')
41
+
42
+ columns_array.push({'name'=> node_name.text,
43
+ 'unit'=> node_unit.text,
44
+ 'description'=> node_des.text,
45
+ 'ucd'=>node_ucd.text})
46
+ end
47
+
48
+ return columns_array
49
+ end
50
+
51
+ end
52
+ end
53
+
54
+ end
@@ -0,0 +1,160 @@
1
+ require 'voruby/adql/transforms'
2
+ require 'rexml/document'
3
+
4
+ module VORuby
5
+
6
+ module ADQL
7
+ class Item
8
+ def self.from_xml(node)
9
+ #type_s = node.attributes['xsi:type']
10
+ type_s = node.find_attribute('type', 'http://www.w3.org/2001/XMLSchema-instance')
11
+ item = ObjectBuilder.get_class_for(type_s).from_xml(node)
12
+ end
13
+ end
14
+
15
+ class Qualifier
16
+ def self.from_xml(node)
17
+ return JointTableQualifier.from_xml(node)
18
+ end
19
+ end
20
+
21
+ class Arg
22
+ def self.from_xml(node)
23
+ #type_s = node.attributes['xsi:type']
24
+ type_s = node.find_attribute('type', 'http://www.w3.org/2001/XMLSchema-instance')
25
+ arg = ObjectBuilder.get_class_for(type_s).from_xml(node)
26
+ end
27
+ end
28
+
29
+ class Allow
30
+ def self.from_xml(node)
31
+ return SelectionOption.from_xml(node)
32
+ end
33
+ end
34
+
35
+ class Restrict
36
+ def self.from_xml(node)
37
+ return SelectionLimit.from_xml(node)
38
+ end
39
+ end
40
+
41
+ class Unit
42
+ attr_accessor :unit
43
+
44
+ def initialize(unit)
45
+ self.unit = unit
46
+ end
47
+
48
+ def self.from_xml(node)
49
+ return Unit.new(node.text)
50
+ end
51
+
52
+ def to_s
53
+ "{unit=#{self.unit}}"
54
+ end
55
+ end
56
+
57
+ class Expression
58
+ def self.from_xml(node)
59
+ return ScalarExpression.from_xml(node)
60
+ end
61
+ end
62
+
63
+ class Condition
64
+ def self.from_xml(node)
65
+ return Search.from_xml(node)
66
+ end
67
+ end
68
+
69
+ class Pattern
70
+ def self.from_xml(node)
71
+ literal_node = REXML::XPath.first(node, 'Literal')
72
+ return LiteralType.from_xml(literal_node)
73
+ end
74
+ end
75
+
76
+ class Set
77
+ def self.from_xml(node)
78
+ return InclusionSet.from_xml(node)
79
+ end
80
+ end
81
+
82
+ class Tables
83
+ def self.from_xml(node)
84
+ return ArrayOfFromTable.from_xml(node)
85
+ end
86
+ end
87
+
88
+ class Nature
89
+ def self.from_xml(node)
90
+ return Comparison.from_xml(node)
91
+ end
92
+ end
93
+
94
+ class Sigma
95
+ def self.from_xml(node)
96
+ return NumberType.from_xml(node)
97
+ end
98
+ end
99
+
100
+ class Column
101
+ def self.from_xml(node)
102
+ return ColumnReference.from_xml(node)
103
+ end
104
+ end
105
+
106
+ class TableName
107
+ def self.from_xml(node)
108
+ return node.text
109
+ end
110
+ end
111
+
112
+ class StartComment
113
+ def self.from_xml(node)
114
+ return node.text
115
+ end
116
+ end
117
+
118
+ class EndComment
119
+ def self.from_xml(node)
120
+ return node.text
121
+ end
122
+ end
123
+
124
+ class OrderBy
125
+ def self.from_xml(node)
126
+ return OrderExpression.from_xml(node)
127
+ end
128
+ end
129
+
130
+ class Name
131
+ def self.from_xml(node)
132
+ return node.text
133
+ end
134
+ end
135
+
136
+ class Params
137
+ def self.from_xml(node)
138
+ return ScalarExpression.from_xml(node)
139
+ end
140
+ end
141
+
142
+ class Parser
143
+ attr_reader :select_doc
144
+
145
+ def initialize(src)
146
+ @select_doc = REXML::Document.new(src)
147
+ end
148
+
149
+ def parse
150
+ return Select.from_xml(self.select_doc.root)
151
+ end
152
+
153
+ def self.convert_to_adqls(src)
154
+ return Parser.new(src).parse.to_adqls
155
+ end
156
+
157
+ end
158
+ end
159
+
160
+ end