RegistryQuery¶
-
class
pyvo.registry.vao.
RegistryQuery
(baseurl=None, orKeywords=False, version='1.0')[source]¶ Bases:
pyvo.dal.query.DALQuery
Deprecated since version 0.5: The RegistryQuery class is deprecated and may be removed in a future version.
a representation of a registry query that can be built up over successive method calls and then executed. An instance is normally obtained via a call to RegistrySearch.create_query()
Deprecated since version 0.5: The RegistryQuery class is deprecated and may be removed in a future version.
create the query instance
Parameters: baseurl : str
the base URL for the VAO registry. If None, it will be set to the public VAO registry at STScI.
orKeywords : bool
if True, keyword constraints will by default be OR-ed together; that is, a resource that matches any of the keywords will be returned. If FALSE, the keywords will be AND-ed, thus requiring a resource to match all the keywords.
Attributes Summary
ALLOWED_CAPS
ALLOWED_WAVEBANDS
RESULTSET_TYPE_ARG
SERVICE_NAME
WAVEBAND_SYN
keywords
return the current set of keyword constraints predicates
the (read-only) list of predicate constraints that will servicetype
the type of service that query results will be restricted to. waveband
the waveband to restrict the query by. The query results will Methods Summary
addkeywords
(keywords)add keywords that should be added to this query. Keywords addpredicate
(pred)add an SQL search predicate to the query. This predicate should clearkeywords
()remove all keywords that have been added to this query. clearpredicates
()remove all previously added predicates. execute
()submit the query and return the results as a RegistryResults execute_stream
()submit the query and return the raw VOTable XML as a file stream execute_votable
()submit the query and return the results as an AstroPy votable instance getqueryurl
([lax])return the GET URL that will submit the query and return the keywords_to_predicate
(keywords[, ored])return the given keywords as a predicate that can be added to or_keywords
(ored)set whether keywords are OR-ed or AND-ed together. When removekeywords
(keywords)remove the given keyword or keywords from the query. A removepredicate
(pred)remove the give predicate from the current set of predicate will_or_keywords
()Return true if the keywords will be OR-ed. Attributes Documentation
-
ALLOWED_CAPS
= {'table': 'ConeSearch', 'catalog': 'ConeSearch', 'scs': 'ConeSearch', 'conesearch': 'ConeSearch', 'image': 'SimpleImageAccess', 'sia': 'SimpleImageAccess', 'spectra': 'SimpleSpectralAccess', 'spectrum': 'SimpleSpectralAccess', 'ssa': 'SimpleSpectralAccess', 'ssap': 'SimpleSpectralAccess', 'line': 'SimpleLineAccess', 'sla': 'SimpleLineAccess', 'slap': 'SimpleLineAccess', 'tap': 'TableAccess', 'database': 'TableAccess', 'tableAccess': 'TableAccess', 'simpleImageAccess': 'SimpleImageAccess', 'simpleLineAccess': 'SimpleLineAccess', 'simpleSpectralAccess': 'SimpleSpectralAccess'}¶
-
ALLOWED_WAVEBANDS
= ['Radio', 'Millimeter', 'Infrared', 'Optical', 'UV', 'EUV', 'X-ray', 'Gamma-ray']¶
-
RESULTSET_TYPE_ARG
= 'VOTStyleOption=2'¶
-
SERVICE_NAME
= 'VOTCapBandPredOpt'¶
-
WAVEBAND_SYN
= {'ir': 'Infrared', 'IR': 'Infrared', 'uv': 'UV', 'euv': 'EUV', 'xray': 'X-ray'}¶
-
keywords
¶ return the current set of keyword constraints
To update, use addkeywords(), removekeywords(), or clearkeywords().
-
predicates
¶ the (read-only) list of predicate constraints that will be applied to the query. These will be AND-ed with all other constraints (including previously added predicates); that is, this constraint must be satisfied in addition to the other constraints to match a particular resource record.
To update, use addpredicate(), removepredicate(), or clearpredicate().
-
servicetype
¶ the type of service that query results will be restricted to.
-
waveband
¶ the waveband to restrict the query by. The query results will include only those resourse that indicate they have data from this waveband. Allowed values include “Radio”, “Millimeter”, “Infrared” (synonym: “IR”), “Optical”, “UV”, “EUV”, “X-ray” (synonym: “Xray”); when setting, the value is case-insensitive.
Methods Documentation
-
addkeywords
(keywords)[source]¶ add keywords that should be added to this query. Keywords are searched against key fields in the registry record. A keyword can in fact be a phrase–a sequence of words; in this case the sequence of words must appear verbatim in the record for that record to be matched.
Parameters: keywords : str or list of str
either a single keyword phrase (as a string) or a list of keyword phrases to add to the query.
-
addpredicate
(pred)[source]¶ add an SQL search predicate to the query. This predicate should be of form supported by STScI VOTable search services. This predicate will be AND-ed with all other constraints (including previously added predicates); that is, this constraint must be satisfied in addition to the other constraints to match a particular resource record.
-
execute
()[source]¶ submit the query and return the results as a RegistryResults instance.
Raises: RegistryServiceError
for errors connecting to or communicating with the service
RegistryQueryError
if the service responds with an error, including a query syntax error. A syntax error should only occur if the query contains non-sensical predicates.
-
execute_stream
()[source]¶ submit the query and return the raw VOTable XML as a file stream
Raises: DALServiceError
for errors connecting to or communicating with the service
DALQueryError
for errors in the input query syntax
-
execute_votable
()[source]¶ submit the query and return the results as an AstroPy votable instance
Raises: DALServiceError
for errors connecting to or communicating with the service
DALFormatError
for errors parsing the VOTable response
DALQueryError
for errors in the input query syntax
-
getqueryurl
(lax=False)[source]¶ return the GET URL that will submit the query and return the results as a VOTable
-
keywords_to_predicate
(keywords, ored=True)[source]¶ return the given keywords as a predicate that can be added to the current query. This function can be overridden to change how keyword searches are implemented.
Parameters: *keywords* a python list of the keywords
- ored if True, the keywords should be ORed together;
otherwise, they should be ANDed
-
or_keywords
(ored)[source]¶ set whether keywords are OR-ed or AND-ed together. When the keywords are OR-ed, returned records will match at least one of the keywords. When they are AND-ed, the records will match all of the keywords provided.
Parameters: ored : bool
true, if the keywords should be OR-ed; false, if they should be AND-ed.
-
removekeywords
(keywords)[source]¶ remove the given keyword or keywords from the query. A keyword can in fact be a phrase–a sequence of words; in this case, the phrase will be remove.
Parameters: keywords : str or list of str
either a single keyword phrase (as a string) or a list of keyword phrases to remove from the query.
-