Skip to content

Commit

Permalink
gaia: start adding TAP support.
Browse files Browse the repository at this point in the history
Note considerable changes to RegistryResults_vot3.xsl, this now creates an
output row per capability, not Resource, as each capability represents an
endpoint of sorts.
  • Loading branch information
pwdraper committed Aug 8, 2014
1 parent 7d544f9 commit 079638d
Show file tree
Hide file tree
Showing 10 changed files with 2,492 additions and 245 deletions.
51 changes: 48 additions & 3 deletions applications/gaia/gaia/library/Gaia.tcl
Expand Up @@ -2625,7 +2625,7 @@ window gives you access to this."
# Find and open the current list of servers.
set cone_file [vo_config_file_ GaiaConeServers.vot]

utilReUseWidget gaiavo::GaiaVOCatRegistry $w_.voregistry \
utilReUseWidget gaiavo::GaiaVOCatRegistry $w_.voregistrycone \
-catalog $cone_file \
-service CONE \
-title "Catalogue Cone search" \
Expand Down Expand Up @@ -2660,12 +2660,57 @@ window gives you access to this."
}
}

# Open a dialog for querying TAP services.
public method vo_find_tap {} {
if { [gaia::GaiaVOTableAccess::check_for_gaiavo] } {

# Find and open the current list of servers.
set tap_file [vo_config_file_ GaiaTAPServers.vot]

utilReUseWidget gaiavo::GaiaVOCatRegistry $w_.voregistrytap \
-catalog $tap_file \
-service TAP \
-title "TAP server queries" \
-show_cols {shortName title} \
-activate_cmd [code $this vo_query_tap_] \
-whole_operation 0 \
-help_file tap
} else {
error_dialog "No GAIA-VO extension is available" $w_
}
}

# Open a dialog for querying a TAP server.
protected method vo_query_tap_ {headers row} {
if { [gaia::GaiaVOTableAccess::check_for_gaiavo] } {

# See if the given headers and row data specify a TAP
# service. Need a URL resource for that.
set accessURL [gaiavo::GaiaVOTAP::getAccessURL $headers $row]
if { $accessURL != {} } {
set name [gaiavo::GaiaVOTAP::getName $headers $row]
gaiavo::GaiaVOTAP $w_.tap\#auto \
-accessURL $accessURL \
-shortname $name \
-gaia $this \
-title "$name TAP service" \
-help_file tapquery
} else {
warning_dialog "TAP service does not specify a resource URL" $w_
}
}
}

# Get a cached configuration file. If not present use builtin list.
protected method vo_config_file_ {name} {
set config_file [utilGetConfigFilename .skycat $name]
if { ! [::file exists $config_file] } {
# Use builtin defaults.
::file copy -force $::gaiavo_library/$name $config_file
# Use builtin defaults. If any.
if { [::file exists $::gaiavo_library/$name ] } {
::file copy -force $::gaiavo_library/$name $config_file
} else {
puts stderr "Warning: no $name configuation file located"
}
}
return $config_file
}
Expand Down
7 changes: 6 additions & 1 deletion applications/gaia/gaia/library/GaiaSearch.tcl
Expand Up @@ -873,11 +873,16 @@ itcl::class gaia::GaiaSearch {
set state disabled
}

# Cone Search.
# Cone search.
$w add_menuitem $m command "Query a VO catalog server..." \
{Find VO cone search servers and query for catalogs} \
-command [code $w vo_find_cone] -state $state

# TAP query.
$w add_menuitem $m command "Query a TAP service..." \
{Find TAP services and query} \
-command [code $w vo_find_tap] -state $state

# Add SIAP query dialogs
$w add_menuitem $m command "Query a VO image server..." \
{Find VO image servers and make requests for images} \
Expand Down
1,413 changes: 1,413 additions & 0 deletions applications/gaia/gaiavo/library/GaiaTAPServers.vot

Large diffs are not rendered by default.

34 changes: 31 additions & 3 deletions applications/gaia/gaiavo/library/GaiaVORegistrySearch.tcl
Expand Up @@ -34,7 +34,7 @@
# Performs the given method on this object.

# Copyright:
# Copyright (C) 2008-2009 Science and Technology Facilities Council
# Copyright (C) 2008-2014 Science and Technology Facilities Council
# All Rights Reserved.

# Licence:
Expand Down Expand Up @@ -253,7 +253,7 @@ itcl::class gaiavo::GaiaVORegistrySearch {
# Read the query directly from an existing file.
public method read_query {filename} {

# Convert to a TST file so we can open it up as usual.
# Convert to a TST file so we can open it up as usual.
set vot [gaiavotable::open $filename]

# Check the STATUS return.
Expand All @@ -266,6 +266,32 @@ itcl::class gaiavo::GaiaVORegistrySearch {

# This is the current VOTable now.
set votable_ $filename

# Wart: seems that registries do not only return resources with the
# expected capability class, so apply a retrospective filter. Esp.
# bad for TAP services. Shouldn't be a large response so just eat the
# file process into the same name.
set fp [::open $tempname]
set data [::read $fp]
::close $fp
set fp [::open $tempname "w"]
set pattern [get_service_]
set ok 1
foreach line [split $data "\n"] {
if { $ok } {
# Just passthrough header section.
if { [string first "--" $line] == 0 } {
set ok 0
}
puts $fp $line
} else {
if { [string first $pattern $line] != -1 } {
puts $fp $line
}
}
}
::close $fp

} else {
set status 0
set tempname \
Expand All @@ -284,7 +310,7 @@ itcl::class gaiavo::GaiaVORegistrySearch {
# The type of VO registry to query, NVO or AstroGrid.
itk_option define -registry registry Registry "NVO"

# The type of query, SIAP, SSAP or CONE.
# The type of query, SIAP, SSAP, CONE or TAP.
itk_option define -service service Service "SIAP"

# Command to execute when a list of servers is accepted.
Expand Down Expand Up @@ -333,12 +359,14 @@ itcl::class gaiavo::GaiaVORegistrySearch {
set services_(SIAP) "SimpleImageAccess"
set services_(SSAP) "SimpleSpectralAccess"
set services_(CONE) "ConeSearch"
set services_(TAP) "TableAccess"

# Mapping of short service names to their standard ids.
protected common standardIDs_
set standardIDs_(SIAP) "ivo://ivoa.net/std/SIA"
set standardIDs_(SSAP) "ivo://ivoa.net/std/SSA"
set standardIDs_(CONE) "ivo://ivoa.net/std/ConeSearch"
set standardIDs_(TAP) "ivo://ivoa.net/std/TAP"

# Possible columns for adding a predicate.
protected common columns_ "title shortName"
Expand Down

0 comments on commit 079638d

Please sign in to comment.