Package uk.ac.starlink.vo
Class DalQuery
java.lang.Object
uk.ac.starlink.vo.DalQuery
Represents a particular query to a DAL-like service.
DAL refers to the the Data Access Layer family of protocols defined
by the IVOA.
- Since:
- 2 Feb 2009
- Author:
- Mark Taylor (Starlink)
-
Constructor Summary
ConstructorsConstructorDescriptionDalQuery
(String baseURL, String serviceType, double raPos, double decPos, double size, uk.ac.starlink.util.ContentCoding coding) Constructs a DAL query based on a service URL.DalQuery
(RegResource resource, RegCapabilityInterface capability, String serviceType, double raPos, double decPos, double size) Constructs a DAL query based on a resource from a registry. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addArgument
(String name, String value) Adds an argument to the query.doubleToString
(double value) Encodes a floating point value as a string for use in a DAL query.uk.ac.starlink.table.StarTable
execute
(uk.ac.starlink.table.StarTableFactory tfact) Executes this query synchronously, returning a StarTable which represents the results.static uk.ac.starlink.table.StarTable
executeQuery
(URL qurl, uk.ac.starlink.table.StarTableFactory tfact, uk.ac.starlink.util.ContentCoding coding) Submits a synchronous query to a URL and retrieves the result as a StarTable following standard DAL conventions.toString()
-
Constructor Details
-
DalQuery
public DalQuery(RegResource resource, RegCapabilityInterface capability, String serviceType, double raPos, double decPos, double size) Constructs a DAL query based on a resource from a registry.- Parameters:
resource
- resource describing the DAL servicecapability
- DAL capability from resourceserviceType
- short name for service type; informative, used for error messages etcraPos
- right ascension of ROI center in degreesdecPos
- declination of ROI center in degreessize
- ROI size in degrees
-
DalQuery
public DalQuery(String baseURL, String serviceType, double raPos, double decPos, double size, uk.ac.starlink.util.ContentCoding coding) Constructs a DAL query based on a service URL.- Parameters:
baseURL
- URL forming basis of CGI query for the DAL serviceserviceType
- short name for service type; informative, used for error messages etcraPos
- right ascension of ROI center in degreesdecPos
- declination of ROI center in degreessize
- size in degreescoding
- controls HTTP-level byte-stream compression
-
-
Method Details
-
addArgument
Adds an argument to the query. No validation is performed to check it is one of the ones that the DAL service knows about.- Parameters:
name
- service argument namevalue
- argument value
-
execute
public uk.ac.starlink.table.StarTable execute(uk.ac.starlink.table.StarTableFactory tfact) throws IOException Executes this query synchronously, returning a StarTable which represents the results. If the query resulted in a QUERY_STATUS of ERROR, or if the returned VOTable document is not comprehensible according to the DAL rules, an IOException will be thrown.- Parameters:
tfact
- factory which may be used to influence how the table is built- Throws:
IOException
- in absence of good data
-
toString
-
doubleToString
Encodes a floating point value as a string for use in a DAL query. There ought to be a definition within the DAL protocols of how to do this. At time of writing there is not, so the current implementation defers to the ad-hoc implementation inCgiQuery.formatDouble(double)
, which avoids exponential notation except for very large/small values.- Parameters:
value
- numeric value- Returns:
- string equivalent
-
executeQuery
public static uk.ac.starlink.table.StarTable executeQuery(URL qurl, uk.ac.starlink.table.StarTableFactory tfact, uk.ac.starlink.util.ContentCoding coding) throws IOException Submits a synchronous query to a URL and retrieves the result as a StarTable following standard DAL conventions.- Parameters:
qurl
- query URLtfact
- table factorycoding
- encoding to use for communications- Returns:
- table included in DAL result resource
- Throws:
IOException
-