SesameQuery¶
-
class
pyvo.nameresolver.sesame.
SesameQuery
(baseurl=None)[source]¶ Bases:
object
a class for preparing a query to a sesame service. Query constraints are added via properties. The execute() function will submit the query and return the results.
The base URL for the query can be changed via the baseurl property.
initialize the query object with a baseurl
Parameters: baseurl : str
the service endpoint. If None, the value of the module attribute, default_endpoint will be used. (see also set_default_endpoint().)
Attributes Summary
aliases
a boolean indicating whether to return all known identifiers for baseurl
the base URL that this query will be sent to when one of the database_codes
dbs
the database selection argument. This is a sequence of any of the fluxes
a boolean indicating whether to return all known identifiers for ignorecache
boolean indicating whether the database caches will be ignored when names
the list of the object names to resolve opts
the options that control the content and format of the output. Methods Summary
execute
()execute the query and return a list Target instances, one for execute_stream
([format, astext, lax])submit the query and return the raw file stream getqueryurl
([lax, format, astext])return the GET URL that encodes the current query. This is the useDatabases
(\*args)use the given databases to resolve the names. The arguments are useDefaultDatabase
()clear any previously set database selection so as to use the Attributes Documentation
-
aliases
¶ a boolean indicating whether to return all known identifiers for the resolved source. If false, only the main designation will be returned.
-
baseurl
¶ the base URL that this query will be sent to when one of the execute functions is called.
-
database_codes
= {'simbad': 'S', 'vizier': 'V', 'ned': 'N', 'all': 'A'}¶
-
dbs
¶ the database selection argument. This is a sequence of any of the following characters, indicating which databases to query:
S Simbad V Vizier N NED A All of the above Without
A
included, only the result from the database returning a matched result will be returned. A value preceded by a ‘~’ requests that the result cache be ignored.No syntax checking is done on this value upon setting (though it is done via getqueryurl when lax=false); consider using useDatabases().
-
fluxes
¶ a boolean indicating whether to return all known identifiers for the resolved source. If false, only the main designation will be returned.
-
ignorecache
¶ boolean indicating whether the database caches will be ignored when retrieving results. If true, the databases will queried directly; otherwise, the cache will be consulted first.
-
names
¶ the list of the object names to resolve
-
opts
¶ the options that control the content and format of the output.
Methods Documentation
-
execute
()[source]¶ execute the query and return a list Target instances, one for each requested target.
Raises: DALServiceError
for errors connecting to or communicating with the service
DALQueryError
for errors in the input query syntax
DALFormatError
if the XML response is corrupted
-
execute_stream
(format=None, astext=False, lax=False)[source]¶ submit the query and return the raw file stream
Parameters: format : str
a format code for the return results, overriding the default XML format. The value should be one or “x”, “x4”, “x2”, “t”. The first three are different versions of the XML formats, and “pc” is the default percent-code format.
astext : bool
request results be returned with a MIME-type of “text/plain”, regardless of the format.
lax : bool
if False (default), a DALQueryError exception will be raised if the current set of parameters cannot be used to form a legal query. This implementation does no syntax checking; thus, this argument is ignored.
Raises: DALServiceError
for errors connecting to or communicating with the service
DALQueryError
for errors in the input query syntax
-
getqueryurl
(lax=False, format=None, astext=False)[source]¶ return the GET URL that encodes the current query. This is the URL that the execute functions will use if called next.
Parameters: lax : bool
if False (default), a DALQueryError exception will be raised if the current set of parameters cannot be used to form a legal query. This implementation does no syntax checking; thus, this argument is ignored.
format : str
a format code for the return results, overriding the default XML format. The value should be one or “x”, “x4”, “x2”, “t”. The first three are different versions of the XML formats, and “pc” is the default percent-code format.
astext : bool
request results be returned with a MIME-type of text/plain”, regardless of the format.
Raises: DALQueryError
when lax=False, for errors in the input query syntax
-
useDatabases
(*args)[source]¶ use the given databases to resolve the names. The arguments are database names that are case-insensitive, minimum matches to any of
["Simbad", "NED", "Vizier", "all"]
. The order indicates the order that the databases will be checked. Unless “all” is included, Only the result from the first database returning a positive result will be returned by the query.
-