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
@@ -0,0 +1,38 @@
|
|
1
|
+
<VOTABLE version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
2
|
+
xsi:noNamespaceSchemaLocation="http://www.ivoa.net/xml/VOTable/VOTable/v1.1">
|
3
|
+
<COOSYS ID="J2000" equinox="J2000." epoch="J2000." system="eq_FK5"/>
|
4
|
+
<RESOURCE name="myFavouriteGalaxies">
|
5
|
+
<TABLE name="results">
|
6
|
+
<DESCRIPTION>Velocities and Distance estimations</DESCRIPTION>
|
7
|
+
<PARAM name="Telescope" datatype="float" ucd="phys.size;instr.tel"
|
8
|
+
unit="m" value="3.6"/>
|
9
|
+
<FIELD name="RA" ID="col1" ucd="pos.eq.ra;meta.main" ref="J2000"
|
10
|
+
datatype="float" width="6" precision="2" unit="deg"/>
|
11
|
+
<FIELD name="Dec" ID="col2" ucd="pos.eq.dec;meta.main" ref="J2000"
|
12
|
+
datatype="float" width="6" precision="2" unit="deg"/>
|
13
|
+
<FIELD name="Name" ID="col3" ucd="meta.id;meta.main"
|
14
|
+
datatype="char" arraysize="8*"/>
|
15
|
+
<FIELD name="RVel" ID="col4" ucd="src.veloc.hc" datatype="int"
|
16
|
+
width="5" unit="km/s"/>
|
17
|
+
<FIELD name="e_RVel" ID="col5" ucd="stat.error;src.veloc.hc"
|
18
|
+
datatype="int" width="3" unit="km/s"/>
|
19
|
+
<FIELD name="R" ID="col6" ucd="phys.distance" datatype="float"
|
20
|
+
width="4" precision="1" unit="Mpc">
|
21
|
+
<DESCRIPTION>Distance of Galaxy, assuming H=75km/s/Mpc</DESCRIPTION>
|
22
|
+
</FIELD>
|
23
|
+
<DATA>
|
24
|
+
<TABLEDATA>
|
25
|
+
<TR>
|
26
|
+
<TD>010.68</TD><TD>+41.27</TD><TD>N 224</TD><TD>-297</TD><TD>5</TD><TD>0.7</TD>
|
27
|
+
</TR>
|
28
|
+
<TR>
|
29
|
+
<TD>287.43</TD><TD>-63.85</TD><TD>N 6744</TD><TD>839</TD><TD>6</TD><TD>10.4</TD>
|
30
|
+
</TR>
|
31
|
+
<TR>
|
32
|
+
<TD>023.48</TD><TD>+30.66</TD><TD>N 598</TD><TD>-182</TD><TD>3</TD><TD>0.7</TD>
|
33
|
+
</TR>
|
34
|
+
</TABLEDATA>
|
35
|
+
</DATA>
|
36
|
+
</TABLE>
|
37
|
+
</RESOURCE>
|
38
|
+
</VOTABLE>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<VOTABLE version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
2
|
+
xsi:noNamespaceSchemaLocation="http://www.ivoa.net/xml/VOTable/VOTable/v1.1">
|
3
|
+
<COOSYS ID="J2000" equinox="J2000." epoch="J2000." system="eq_FK5"/>
|
4
|
+
<RESOURCE name="myFavouriteGalaxies2">
|
5
|
+
<TABLE name="results2">
|
6
|
+
<DESCRIPTION>Velocities and Distance estimations</DESCRIPTION>
|
7
|
+
<PARAM name="Telescope" datatype="float" ucd="phys.size;instr.tel"
|
8
|
+
unit="m" value="3.6"/>
|
9
|
+
<FIELD name="RA2" ID="col1" ucd="pos.eq.ra;meta.main" ref="J2000"
|
10
|
+
datatype="float" width="6" precision="2" unit="deg"/>
|
11
|
+
<FIELD name="Dec2" ID="col2" ucd="pos.eq.dec;meta.main" ref="J2000"
|
12
|
+
datatype="float" width="6" precision="2" unit="deg"/>
|
13
|
+
<FIELD name="Name2" ID="col3" ucd="meta.id;meta.main"
|
14
|
+
datatype="char" arraysize="8*"/>
|
15
|
+
<FIELD name="RVe2l" ID="col4" ucd="src.veloc.hc" datatype="int"
|
16
|
+
width="5" unit="km/s"/>
|
17
|
+
<FIELD name="e_RVel2" ID="col5" ucd="stat.error;src.veloc.hc"
|
18
|
+
datatype="int" width="3" unit="km/s"/>
|
19
|
+
<FIELD name="R2" ID="col6" ucd="phys.distance" datatype="float"
|
20
|
+
width="4" precision="1" unit="Mpc">
|
21
|
+
<DESCRIPTION>Distance of Galaxy, assuming H=75km/s/Mpc</DESCRIPTION>
|
22
|
+
</FIELD>
|
23
|
+
<DATA>
|
24
|
+
<TABLEDATA>
|
25
|
+
<TR>
|
26
|
+
<TD>999.99</TD><TD>+41.27</TD><TD>N 224</TD><TD>-297</TD><TD>5</TD><TD>0.7</TD>
|
27
|
+
</TR>
|
28
|
+
<TR>
|
29
|
+
<TD>999.99</TD><TD>-63.85</TD><TD>N 6744</TD><TD>839</TD><TD>6</TD><TD>10.4</TD>
|
30
|
+
</TR>
|
31
|
+
<TR>
|
32
|
+
<TD>999.99</TD><TD>+30.66</TD><TD>N 598</TD><TD>-182</TD><TD>3</TD><TD>0.7</TD>
|
33
|
+
</TR>
|
34
|
+
</TABLEDATA>
|
35
|
+
</DATA>
|
36
|
+
</TABLE>
|
37
|
+
</RESOURCE>
|
38
|
+
</VOTABLE>
|
@@ -0,0 +1,193 @@
|
|
1
|
+
require 'voruby/active_votable/active_votable'
|
2
|
+
include VORuby
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class ActiveVOTableTest < ::Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
@connection_params = {:adapter => 'sqlite3', :database => 'test/voruby/active_votable/votables.sqlite3'}
|
9
|
+
ActiveVOTable::Base.establish_connection(@connection_params)
|
10
|
+
end
|
11
|
+
|
12
|
+
def check_tables(tables)
|
13
|
+
tables.each do |tbl|
|
14
|
+
assert_respond_to tbl, :schema
|
15
|
+
assert_respond_to tbl.schema, :find
|
16
|
+
|
17
|
+
assert_respond_to tbl, :data
|
18
|
+
assert tbl.data.respond_to?(:page)
|
19
|
+
assert_respond_to tbl.data, :find
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_table_contents(table)
|
24
|
+
row = table.data.find(:first)
|
25
|
+
assert_equal 10.68, row.ra
|
26
|
+
assert_equal 41.27, row.dec
|
27
|
+
assert_equal 'N 224', row.name
|
28
|
+
assert_equal -297, row.rvel
|
29
|
+
assert_equal 5, row.e_rvel
|
30
|
+
assert_equal 0.7, row.r
|
31
|
+
|
32
|
+
field = table.schema.find(:first)
|
33
|
+
assert_equal 'RA', field.name
|
34
|
+
assert_equal 'col1', field.vid
|
35
|
+
assert_equal 'pos.eq.ra;meta.main', field.ucd
|
36
|
+
assert_equal 'J2000', field.ref
|
37
|
+
assert_equal 'float', field.datatype
|
38
|
+
assert_equal 6, field.width
|
39
|
+
assert_equal '2', field.precision
|
40
|
+
assert_equal 'deg', field.unit
|
41
|
+
end
|
42
|
+
|
43
|
+
def check_independence(vot1, vot2)
|
44
|
+
table1 = vot1.tables.first
|
45
|
+
table2 = vot2.tables.first
|
46
|
+
|
47
|
+
assert_equal 'RA', table1.schema.find(:first).name
|
48
|
+
assert_equal 10.68, table1.data.find(:first).ra
|
49
|
+
|
50
|
+
assert_equal 'RA2', table2.schema.find(:first).name
|
51
|
+
assert_equal 999.99, table2.data.find(:first).ra2
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_from_xml
|
55
|
+
vot = ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/simple1.vot'))
|
56
|
+
|
57
|
+
tables = vot.tables
|
58
|
+
assert_equal 1, tables.size
|
59
|
+
check_tables(tables)
|
60
|
+
|
61
|
+
check_table_contents(tables.first)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_from_db
|
65
|
+
ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/simple1.vot'), 'simple1')
|
66
|
+
|
67
|
+
vot = ActiveVOTable::Base.from(:db, 'simple1')
|
68
|
+
|
69
|
+
tables = vot.tables
|
70
|
+
assert_equal 1, tables.size
|
71
|
+
check_tables(tables)
|
72
|
+
|
73
|
+
check_table_contents(tables.first)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_from_xml_with_nonexistent
|
77
|
+
assert_raises RuntimeError do
|
78
|
+
ActiveVOTable::Base.from(:xml, 123)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_from_db_with_nonexistent
|
83
|
+
assert_raises RuntimeError do
|
84
|
+
ActiveVOTable::Base.from(:db, 'simple')
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_cleanup
|
89
|
+
vot1 = ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/simple1.vot'), 'simple1')
|
90
|
+
vot2 = ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/simple1.vot'), 'simple2')
|
91
|
+
|
92
|
+
# let's create the constants
|
93
|
+
vot1.tables
|
94
|
+
vot2.tables
|
95
|
+
|
96
|
+
vot1.cleanup(true) do |v|
|
97
|
+
assert_equal 0, v.dbtables.size # tables should already be gone...
|
98
|
+
assert ActiveVOTable::Base.const_defined?('Simple1') # but the constant should still be hanging around
|
99
|
+
end
|
100
|
+
|
101
|
+
assert !ActiveVOTable::Base.const_defined?('Simple1') # and now it shouldn't be...
|
102
|
+
assert ActiveVOTable::Base.const_defined?('Simple2')
|
103
|
+
|
104
|
+
assert_equal 0, vot1.dbtables.size
|
105
|
+
assert_equal 2, vot2.dbtables.size
|
106
|
+
|
107
|
+
vot2.cleanup # this form doesn't remove the constant
|
108
|
+
assert ActiveVOTable::Base.const_defined?('Simple2')
|
109
|
+
assert_equal 0, vot2.dbtables.size
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_independence_of_databases
|
113
|
+
check_independence(
|
114
|
+
ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/simple1.vot'), nil, {:adapter => 'sqlite3', :database => 'test/voruby/active_votable/votables.sqlite3'}),
|
115
|
+
ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/simple2.vot'), nil, {:adapter => 'sqlite3', :database => 'test/voruby/active_votable/votables2.sqlite3'})
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_independence_of_tables
|
120
|
+
check_independence(
|
121
|
+
ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/simple1.vot')),
|
122
|
+
ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/simple2.vot'))
|
123
|
+
)
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_paging
|
127
|
+
vot = ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/simple1.vot'))
|
128
|
+
data = vot.tables.first.data
|
129
|
+
|
130
|
+
data.per_page = 2 # 2 records per page
|
131
|
+
|
132
|
+
p1 = data.page(1)
|
133
|
+
assert_equal 2, p1.size
|
134
|
+
assert_equal 41.27, p1[0].dec
|
135
|
+
assert_equal -63.85, p1[1].dec
|
136
|
+
|
137
|
+
p2 = data.page(2)
|
138
|
+
assert_equal 1, p2.size
|
139
|
+
assert_equal 30.66, p2[0].dec
|
140
|
+
|
141
|
+
p1 = data.page(1, 1) # 1 record per page
|
142
|
+
assert_equal 1, p1.size
|
143
|
+
assert_equal 41.27, p1[0].dec
|
144
|
+
|
145
|
+
p3 = data.page(3, 1) # 1 record per page
|
146
|
+
assert_equal 1, p3.size
|
147
|
+
assert_equal 30.66, p3[0].dec
|
148
|
+
|
149
|
+
niter = 0
|
150
|
+
data.each_page(2) do |p, n|
|
151
|
+
niter += 1
|
152
|
+
end
|
153
|
+
assert_equal 2, niter
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_multi_table
|
157
|
+
vot = ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/complex.vot'))
|
158
|
+
assert_equal 3, vot.tables.size
|
159
|
+
|
160
|
+
faves = vot.tables[0]
|
161
|
+
messiers = vot.tables[1]
|
162
|
+
authors = vot.tables[2]
|
163
|
+
|
164
|
+
assert_equal 'RA', faves.schema.find(:first).name
|
165
|
+
assert_equal 10.68, faves.data.find(:first).ra
|
166
|
+
|
167
|
+
assert_equal 'Identifier', messiers.schema.find(:first).name
|
168
|
+
assert_equal 'M51', messiers.data.find(:first).identifier
|
169
|
+
|
170
|
+
assert_equal 'AuthorName', authors.schema.find(:first).name
|
171
|
+
assert_equal 'Charles Messier', authors.data.find(:first).authorname
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_large_table
|
175
|
+
vot = ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/large.vot'), 'large')
|
176
|
+
|
177
|
+
assert 5000, vot.tables.first.data.count()
|
178
|
+
assert_equal '588848898838954139', vot.tables.first.data.find(:first).objid
|
179
|
+
assert_equal '587722982276923446', vot.tables.first.data.find(:first, :order => 'id DESC', :limit => 1).objid
|
180
|
+
|
181
|
+
vot.cleanup(true)
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_error_table
|
185
|
+
assert_raises RuntimeError do
|
186
|
+
ActiveVOTable::Base.from(:xml, File.open('test/voruby/active_votable/error.vot'), 'error')
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def teardown
|
191
|
+
Dir.glob('test/voruby/active_votable/*.sqlite3').each{ |f| File.delete(f) }
|
192
|
+
end
|
193
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT (a.b - c.d) AS aone, b.e AS atwo FROM Tab a, Bob b GROUP BY a.f
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Select xmlns="http://www.ivoa.net/xml/ADQL/v1.0" xmlns:coo="http://www.ivoa.net/xml/STC/STCcoords/v1.10" xmlns:reg="http://www.ivoa.net/xml/STC/STCregion/v1.10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
3
|
+
|
4
|
+
<SelectionList>
|
5
|
+
<Item xsi:type="aliasSelectionItemType" As="aone">
|
6
|
+
<Expression xsi:type="closedExprType">
|
7
|
+
<Arg xsi:type="binaryExprType" Oper="-">
|
8
|
+
<Arg xsi:type="columnReferenceType" Table="a" Name="b"/>
|
9
|
+
<Arg xsi:type="columnReferenceType" Table="c" Name="d"/>
|
10
|
+
</Arg>
|
11
|
+
</Expression>
|
12
|
+
</Item>
|
13
|
+
<Item xsi:type="aliasSelectionItemType" As="atwo">
|
14
|
+
<Expression xsi:type="columnReferenceType" Table="b" Name="e"/>
|
15
|
+
</Item>
|
16
|
+
</SelectionList>
|
17
|
+
|
18
|
+
<From>
|
19
|
+
<Table xsi:type="tableType" Name="Tab" Alias="a" />
|
20
|
+
<Table xsi:type="tableType" Name="Bob" Alias="b" />
|
21
|
+
</From>
|
22
|
+
|
23
|
+
<GroupBy>
|
24
|
+
<Column xsi:type="columnReferenceType" Table="a" Name="f"/>
|
25
|
+
</GroupBy>
|
26
|
+
</Select>
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT t.b, b.* FROM Tab t, Bob b WHERE AVG(b.dd) < 4.56 ORDER BY b.dd
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Select xmlns="http://www.ivoa.net/xml/ADQL/v1.0" xmlns:coo="http://www.ivoa.net/xml/STC/STCcoords/v1.10" xmlns:reg="http://www.ivoa.net/xml/STC/STCregion/v1.10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
3
|
+
|
4
|
+
<SelectionList>
|
5
|
+
<Item xsi:type="columnReferenceType" Table="t" Name="b"/>
|
6
|
+
<Item xsi:type="columnReferenceType" Table="b" Name="*"/>
|
7
|
+
</SelectionList>
|
8
|
+
|
9
|
+
<From>
|
10
|
+
<Table xsi:type="tableType" Name="Tab" Alias="t" />
|
11
|
+
<Table xsi:type="tableType" Name="Bob" Alias="b" />
|
12
|
+
</From>
|
13
|
+
|
14
|
+
<Where>
|
15
|
+
<Condition xsi:type="comparisonPredType" Comparison="<">
|
16
|
+
<Arg xsi:type="aggregateFunctionType" Name="AVG">
|
17
|
+
<Arg xsi:type="columnReferenceType" Table="b" Name="dd"/>
|
18
|
+
</Arg>
|
19
|
+
<Arg xsi:type="atomType">
|
20
|
+
<Literal xsi:type="realType" Value="4.56"/>
|
21
|
+
</Arg>
|
22
|
+
</Condition>
|
23
|
+
</Where>
|
24
|
+
|
25
|
+
<OrderBy>
|
26
|
+
<Item xsi:type="orderType">
|
27
|
+
<Expression xsi:type="columnReferenceType" Table="b" Name="dd"/>
|
28
|
+
</Item>
|
29
|
+
</OrderBy>
|
30
|
+
|
31
|
+
</Select>
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT t.*, b.* FROM Tab t, Bob b WHERE a.d < d.e AND REGION('Circle J2000 12.5 23 5') ORDER BY t.g - b.g, b.h
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Select xmlns="http://www.ivoa.net/xml/ADQL/v1.0" xmlns:coo="http://www.ivoa.net/xml/STC/STCcoords/v1.10" xmlns:reg="http://www.ivoa.net/xml/STC/STCregion/v1.10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
3
|
+
|
4
|
+
<SelectionList>
|
5
|
+
<Item xsi:type="columnReferenceType" Table="t" Name="*"/>
|
6
|
+
<Item xsi:type="columnReferenceType" Table="b" Name="*"/>
|
7
|
+
</SelectionList>
|
8
|
+
|
9
|
+
<From>
|
10
|
+
<Table xsi:type="tableType" Name="Tab" Alias="t" />
|
11
|
+
<Table xsi:type="tableType" Name="Bob" Alias="b" />
|
12
|
+
</From>
|
13
|
+
|
14
|
+
<Where>
|
15
|
+
<Condition xsi:type="intersectionSearchType">
|
16
|
+
<Condition xsi:type="comparisonPredType" Comparison="<">
|
17
|
+
<Arg xsi:type="columnReferenceType" Table="a" Name="d"/>
|
18
|
+
<Arg xsi:type="columnReferenceType" Table="d" Name="e"/>
|
19
|
+
</Condition>
|
20
|
+
|
21
|
+
<Condition xsi:type="regionSearchType">
|
22
|
+
<Region xsi:type="reg:circleType" unit="deg">
|
23
|
+
<reg:Center xmlns="http://www.ivoa.net/xml/STC/STCregion/v1.10">
|
24
|
+
12.5 23
|
25
|
+
</reg:Center>
|
26
|
+
<reg:Radius>5</reg:Radius>
|
27
|
+
</Region>
|
28
|
+
</Condition>
|
29
|
+
|
30
|
+
</Condition>
|
31
|
+
</Where>
|
32
|
+
|
33
|
+
<OrderBy>
|
34
|
+
<Item>
|
35
|
+
<Expression xsi:type="binaryExprType" Oper="-">
|
36
|
+
<Arg xsi:type="columnReferenceType" Table="t" Name="g"/>
|
37
|
+
<Arg xsi:type="columnReferenceType" Table="b" Name="g"/>
|
38
|
+
</Expression>
|
39
|
+
</Item>
|
40
|
+
<Item>
|
41
|
+
<Expression xsi:type="columnReferenceType" Table="b" Name="h"/>
|
42
|
+
</Item>
|
43
|
+
</OrderBy>
|
44
|
+
|
45
|
+
</Select>
|
46
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT a.d, d.e FROM Tab a, Tab d WHERE a.d < d.e AND a.f BETWEEN a.f AND d.f ORDER BY g.b
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Select xmlns="http://www.ivoa.net/xml/ADQL/v1.0" xmlns:coo="http://www.ivoa.net/xml/STC/STCcoords/v1.10" xmlns:reg="http://www.ivoa.net/xml/STC/STCregion/v1.10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
3
|
+
|
4
|
+
<SelectionList>
|
5
|
+
<Item xsi:type="columnReferenceType" Table="a" Name="d"/>
|
6
|
+
<Item xsi:type="columnReferenceType" Table="d" Name="e"/>
|
7
|
+
</SelectionList>
|
8
|
+
|
9
|
+
<From>
|
10
|
+
<Table xsi:type="tableType" Name="Tab" Alias="a" />
|
11
|
+
<Table xsi:type="tableType" Name="Tab" Alias="d" />
|
12
|
+
</From>
|
13
|
+
|
14
|
+
<Where>
|
15
|
+
<Condition xsi:type="intersectionSearchType">
|
16
|
+
<Condition xsi:type="comparisonPredType" Comparison="<">
|
17
|
+
<Arg xsi:type="columnReferenceType" Table="a" Name="d"/>
|
18
|
+
<Arg xsi:type="columnReferenceType" Table="d" Name="e"/>
|
19
|
+
</Condition>
|
20
|
+
<Condition xsi:type="betweenPredType">
|
21
|
+
<Arg xsi:type="columnReferenceType" Table="a" Name="f"/>
|
22
|
+
<Arg xsi:type="columnReferenceType" Table="a" Name="f"/>
|
23
|
+
<Arg xsi:type="columnReferenceType" Table="d" Name="f"/>
|
24
|
+
</Condition>
|
25
|
+
</Condition>
|
26
|
+
</Where>
|
27
|
+
|
28
|
+
<OrderBy>
|
29
|
+
<Item xsi:type="orderType">
|
30
|
+
<Expression xsi:type="columnReferenceType" Table="g" Name="b"/>
|
31
|
+
</Item>
|
32
|
+
</OrderBy>
|
33
|
+
|
34
|
+
</Select>
|
@@ -0,0 +1 @@
|
|
1
|
+
SELECT SIN(A.b) AS MM, * FROM Tab a WHERE REGION('Circle J2000 1.2 2.4 0.2') AND (LOG(a.d) < 1.24)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Select xmlns="http://www.ivoa.net/xml/ADQL/v1.0" xmlns:coo="http://www.ivoa.net/xml/STC/STCcoords/v1.10" xmlns:reg="http://www.ivoa.net/xml/STC/STCregion/v1.10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
3
|
+
|
4
|
+
<SelectionList>
|
5
|
+
<Item xsi:type="aliasSelectionItemType" As="MM">
|
6
|
+
<Expression xsi:type="trigonometricFunctionType" Name="SIN">
|
7
|
+
<Arg xsi:type="columnReferenceType" Table="A" Name="b"/>
|
8
|
+
</Expression>
|
9
|
+
</Item>
|
10
|
+
<Item xsi:type="allSelectionItemType"/>
|
11
|
+
</SelectionList>
|
12
|
+
|
13
|
+
<From>
|
14
|
+
<Table xsi:type="tableType" Name="Tab" Alias="a" />
|
15
|
+
</From>
|
16
|
+
|
17
|
+
<Where>
|
18
|
+
<Condition xsi:type="intersectionSearchType">
|
19
|
+
<Condition xsi:type="regionSearchType">
|
20
|
+
<Region xsi:type="reg:circleType" unit="deg">
|
21
|
+
<reg:Center xmlns="http://www.ivoa.net/xml/STC/STCregion/v1.10">
|
22
|
+
1.2 2.4
|
23
|
+
</reg:Center>
|
24
|
+
<reg:Radius>0.2</reg:Radius>
|
25
|
+
</Region>
|
26
|
+
</Condition>
|
27
|
+
|
28
|
+
<Condition xsi:type="closedSearchType">
|
29
|
+
<Condition xsi:type="comparisonPredType" Comparison="<">
|
30
|
+
<Arg xsi:type="mathFunctionType" Name="LOG">
|
31
|
+
<Arg xsi:type="columnReferenceType" Table="a" Name="d"/>
|
32
|
+
</Arg>
|
33
|
+
<Arg xsi:type="atomType">
|
34
|
+
<Literal xsi:type="realType" Value="1.24"/>
|
35
|
+
</Arg>
|
36
|
+
</Condition>
|
37
|
+
</Condition>
|
38
|
+
</Condition>
|
39
|
+
</Where>
|
40
|
+
|
41
|
+
</Select>
|