voruby 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +339 -0
- data/REQUIREMENTS +4 -0
- data/Rakefile.rb +296 -0
- data/lib/voruby/adql/adql.rb +2735 -0
- data/lib/voruby/adql/ext.rb +15 -0
- data/lib/voruby/adql/loader.rb +5 -0
- data/lib/voruby/adql/operations.rb +54 -0
- data/lib/voruby/adql/parser.rb +160 -0
- data/lib/voruby/adql/transforms.rb +573 -0
- data/lib/voruby/ext.rb +17 -0
- data/lib/voruby/loader.rb +4 -0
- data/lib/voruby/misc/propertyfile.rb +36 -0
- data/lib/voruby/plastic/applications.rb +174 -0
- data/lib/voruby/plastic/constants.rb +30 -0
- data/lib/voruby/plastic/loader.rb +10 -0
- data/lib/voruby/plastic/plastic.rb +1 -0
- data/lib/voruby/resources/conesearch/conesearch.rb +9 -0
- data/lib/voruby/resources/conesearch/conesearch_v0_2.rb +55 -0
- data/lib/voruby/resources/conesearch/conesearch_v0_3.rb +50 -0
- data/lib/voruby/resources/conesearch/conesearch_v1_0.rb +72 -0
- data/lib/voruby/resources/conesearch/loader.rb +4 -0
- data/lib/voruby/resources/loader.rb +50 -0
- data/lib/voruby/resources/nodes.rb +190 -0
- data/lib/voruby/resources/openskynode/loader.rb +4 -0
- data/lib/voruby/resources/openskynode/openskynode.rb +9 -0
- data/lib/voruby/resources/openskynode/openskynode_v0_1.rb +54 -0
- data/lib/voruby/resources/sia/loader.rb +5 -0
- data/lib/voruby/resources/sia/sia.rb +9 -0
- data/lib/voruby/resources/sia/sia_v0_6.rb +90 -0
- data/lib/voruby/resources/sia/sia_v0_7.rb +89 -0
- data/lib/voruby/resources/sia/sia_v1_0.rb +122 -0
- data/lib/voruby/resources/stsci.rb +59 -0
- data/lib/voruby/resources/vodataservice/coverage_v0_2.rb +195 -0
- data/lib/voruby/resources/vodataservice/coverage_v0_3.rb +158 -0
- data/lib/voruby/resources/vodataservice/loader.rb +5 -0
- data/lib/voruby/resources/vodataservice/vodataservice.rb +9 -0
- data/lib/voruby/resources/vodataservice/vodataservice_v0_4.rb +189 -0
- data/lib/voruby/resources/vodataservice/vodataservice_v0_5.rb +163 -0
- data/lib/voruby/resources/vodataservice/vodataservice_v1_0.rb +221 -0
- data/lib/voruby/resources/voregistry/loader.rb +4 -0
- data/lib/voruby/resources/voregistry/voregistry.rb +9 -0
- data/lib/voruby/resources/voregistry/voregistry_v0_2.rb +40 -0
- data/lib/voruby/resources/voregistry/voregistry_v0_3.rb +30 -0
- data/lib/voruby/resources/voregistry/voregistry_v1_0.rb +86 -0
- data/lib/voruby/resources/voresource/loader.rb +17 -0
- data/lib/voruby/resources/voresource/voresource.rb +9 -0
- data/lib/voruby/resources/voresource/voresource_v0_10.rb +322 -0
- data/lib/voruby/resources/voresource/voresource_v0_9.rb +405 -0
- data/lib/voruby/resources/voresource/voresource_v1_0.rb +230 -0
- data/lib/voruby/services/ext.rb +11 -0
- data/lib/voruby/services/gestalt/footprint.rb +95 -0
- data/lib/voruby/services/gestalt/wcs_fixer.rb +105 -0
- data/lib/voruby/services/gestalt/wesix.rb +155 -0
- data/lib/voruby/services/loader.rb +7 -0
- data/lib/voruby/services/registry/registry.rb +53 -0
- data/lib/voruby/services/resolver/resolver.rb +35 -0
- data/lib/voruby/sesame/loader.rb +6 -0
- data/lib/voruby/sesame/sesame_v1_0.rb +64 -0
- data/lib/voruby/simple/loader.rb +6 -0
- data/lib/voruby/simple/parameters.rb +196 -0
- data/lib/voruby/simple/sap.rb +446 -0
- data/lib/voruby/spacetime/loader.rb +3 -0
- data/lib/voruby/spacetime/spacetime.rb +607 -0
- data/lib/voruby/stc/coords_v1_20.rb +900 -0
- data/lib/voruby/stc/loader.rb +55 -0
- data/lib/voruby/stc/region_v1_20.rb +274 -0
- data/lib/voruby/stc/stc_v1_20.rb +1196 -0
- data/lib/voruby/util.rb +27 -0
- data/lib/voruby/voevent/loader.rb +7 -0
- data/lib/voruby/voevent/voevent_v1_0.rb +213 -0
- data/lib/voruby/voevent/voevent_v1_1.rb +196 -0
- data/lib/voruby/votables/chandra.rb +410 -0
- data/lib/voruby/votables/cnoc.rb +393 -0
- data/lib/voruby/votables/data.rb +179 -0
- data/lib/voruby/votables/galex.rb +390 -0
- data/lib/voruby/votables/hst.rb +391 -0
- data/lib/voruby/votables/int.rb +391 -0
- data/lib/voruby/votables/libxml_parser.rb +411 -0
- data/lib/voruby/votables/libxml_votable.rb +67 -0
- data/lib/voruby/votables/loader.rb +10 -0
- data/lib/voruby/votables/meta.rb +763 -0
- data/lib/voruby/votables/misc.rb +51 -0
- data/lib/voruby/votables/nsa.rb +393 -0
- data/lib/voruby/votables/nsar3.rb +410 -0
- data/lib/voruby/votables/rexml_parser.rb +408 -0
- data/lib/voruby/votables/rexml_votable.rb +67 -0
- data/lib/voruby/votables/sdss.rb +393 -0
- data/lib/voruby/votables/transforms.rb +388 -0
- data/lib/voruby/votables/tree.rb +45 -0
- data/lib/voruby/votables/types.rb +391 -0
- data/lib/voruby/votables/votable.rb +630 -0
- data/lib/voruby/votables/xmm.rb +394 -0
- data/test/adql/test1.adql +49 -0
- data/test/adql/test2.adql +51 -0
- data/test/adql/test3.adql +81 -0
- data/test/adql/test4.adql +53 -0
- data/test/adql/test5.adql +55 -0
- data/test/adql/test6.adql +18 -0
- data/test/adql/test7.adql +48 -0
- data/test/adql/unittest.rb +1672 -0
- data/test/plastic/test.rb +44 -0
- data/test/plastic/test.vot +5385 -0
- data/test/plastic/unittest.rb +66 -0
- data/test/resources/conesearch/conesearch_v0_3.xml +31 -0
- data/test/resources/conesearch/conesearch_v1_0.xml +86 -0
- data/test/resources/conesearch/unittest_v0_3.rb +22 -0
- data/test/resources/conesearch/unittest_v1_0.rb +24 -0
- data/test/resources/openskynode/open_sky_node_v0_1.xml +32 -0
- data/test/resources/openskynode/unittest_v0_1.rb +31 -0
- data/test/resources/sia/simple_image_access_v0_7.xml +36 -0
- data/test/resources/sia/simple_image_access_v1_0.xml +122 -0
- data/test/resources/sia/unittest_v0_7.rb +24 -0
- data/test/resources/sia/unittest_v1_0.rb +29 -0
- data/test/resources/stsci.xml +336 -0
- data/test/resources/unittest_stsci.rb +25 -0
- data/test/resources/vodataservice/catalog_service_resource_v1_0.xml +128 -0
- data/test/resources/vodataservice/data_collection_resource_v0_5.xml +54 -0
- data/test/resources/vodataservice/data_collection_resource_v1_0.xml +117 -0
- data/test/resources/vodataservice/data_service_resource_v1_0.xml +115 -0
- data/test/resources/vodataservice/sky_service_resource_v0_10.xml +45 -0
- data/test/resources/vodataservice/table_service_resource_v1_0.xml +122 -0
- data/test/resources/vodataservice/tabular_sky_service_resource_v0_10.xml +60 -0
- data/test/resources/vodataservice/unittest_v0_5.rb +126 -0
- data/test/resources/vodataservice/unittest_v1_0.rb +151 -0
- data/test/resources/voregistry/authority_resource_v0_3.xml +20 -0
- data/test/resources/voregistry/authority_resource_v1_0.xml +82 -0
- data/test/resources/voregistry/registry_service_v0_3.xml +20 -0
- data/test/resources/voregistry/registry_service_v1_0.xml +107 -0
- data/test/resources/voregistry/unittest_v0_3.rb +31 -0
- data/test/resources/voregistry/unittest_v1_0.rb +34 -0
- data/test/resources/voresource/organisation_resource_v1_0.xml +90 -0
- data/test/resources/voresource/resource_organisation_v0_10.xml +22 -0
- data/test/resources/voresource/resource_service_v0_10.xml +19 -0
- data/test/resources/voresource/resource_v0_10.xml +19 -0
- data/test/resources/voresource/resource_v1_0.xml +79 -0
- data/test/resources/voresource/service_resource_v1_0.xml +91 -0
- data/test/resources/voresource/unittest_v0_10.rb +61 -0
- data/test/resources/voresource/unittest_v0_9.rb +4 -0
- data/test/resources/voresource/unittest_v1_0.rb +190 -0
- data/test/services/gestalt/unittest.rb +74 -0
- data/test/services/registry/unittest.rb +34 -0
- data/test/services/resolver/unittest.rb +38 -0
- data/test/simple/unittest.rb +46 -0
- data/test/spacetime/unittest.rb +39 -0
- data/test/stc/catalog_entry_location_v1_20.xml +112 -0
- data/test/stc/obs_data_location_v1_20.xml +108 -0
- data/test/stc/search_location_v1_20.xml +54 -0
- data/test/stc/stc_resource_profile_v1_20.xml +60 -0
- data/test/stc/unittest_v1_20.rb +620 -0
- data/test/voevent/unittest_v1_0.rb +79 -0
- data/test/voevent/unittest_v1_1.rb +70 -0
- data/test/voevent/voevent_v1_0.xml +96 -0
- data/test/voevent/voevent_v1_1.xml +76 -0
- data/test/votables/test.vot +366 -0
- data/test/votables/unittest.rb +54 -0
- 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,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
|