DatalinkResults¶
- class pyvo.dal.adhoc.DatalinkResults(*args, **kwargs)[source]¶
- Bases: - DatalinkResultsMixin,- DALResults- The list of matching records resulting from an datalink query. Each record contains a set of metadata that describes an available record matching the query constraints. The number of records in the results is available by passing it to the Python built-in - len()function.- This class supports iterable semantics; thus, individual records (in the form of - Recordinstances) are typically accessed by iterating over an- DatalinkResultsinstance.- Alternatively, records can be accessed randomly via - getrecord()or through a Python Database API (v2) Cursor (via- cursor()). Column-based data access is possible via the- getcolumn()method.- DatalinkResultsis essentially a wrapper around an Astropy- votable- TableElementinstance where the columns contain the various metadata describing the images. One can access that VOTable directly via the- votableattribute. Thus, when one retrieves a whole column via- getcolumn(), the result is a Numpy array. Alternatively, one can manipulate the results as an Astropy- Tablevia the following conversion:- table = results.to_table()- DatalinkResultssupports the array item operator- [...]in a read-only context. When the argument is numerical, the result is an- Recordinstance, representing the record at the position given by the numerical index. If the argument is a string, it is interpreted as the name of a column, and the data from the column matching that name is returned as a Numpy array.- initialize the cursor. This constructor is not typically called by directly applications; rather an instance is obtained from calling a DALQuery’s execute(). - Parameters:
- votableastropy.io.votable.tree.VOTableFile
- the service response parsed into an astropy.io.votable.tree.VOTableFile instance. 
- urlstr
- the URL that produced the response 
- sessionobject
- optional session to use for network requests 
 
- Raises:
- DALFormatError
- if the response VOTable does not contain a response table 
 
 - See also - Methods Summary - bysemantics(semantics, *[, include_narrower])- return the rows with the dataset identified by the given semantics - clone_byid(id, *[, original_row])- return a clone of the object with results and corresponding resources matching a given id - from_result_url(result_url, *[, session, ...])- Create a result object from a url. - returns the first datalink row with a processing service. - getdataset(*[, timeout])- return the first row with the dataset identified by semantics #this - getrecord(index)- return a representation of a datalink result record that follows dictionary semantics. - iterate over all rows with a processing service - Methods Documentation - bysemantics(semantics, *, include_narrower=True)[source]¶
- return the rows with the dataset identified by the given semantics - Parameters:
- semantics: str or list
- One or more term(s) from the datalink vocabulary (http://www.ivoa.net/rdf/datalink/core). datalink/core terms may be passed in with or without a leading hash. Free URIs may also be passed an and will be compared literally, i.e., without any URI normalisation. 
- include_narrower: boolean
- If true, the result will include matches for any term that is narrower than the term passed in. 
 
- Returns:
- Sequence of DatalinkRecord
- a sequence of dictionary-like wrappers containing the result record 
 
 
 - clone_byid(id, *, original_row=None)[source]¶
- return a clone of the object with results and corresponding resources matching a given id - Returns:
- Sequence of DatalinkRecord
- a sequence of dictionary-like wrappers containing the result record 
 
 
 - classmethod from_result_url(result_url, *, session=None, original_row=None)[source]¶
- Create a result object from a url. - Uses the optional session to make the request. 
 - getdataset(*, timeout=None)[source]¶
- return the first row with the dataset identified by semantics #this - Returns:
- DatalinkRecord
- a dictionary-like wrapper containing the result record. 
 
 
 - getrecord(index)[source]¶
- return a representation of a datalink result record that follows dictionary semantics. The keys of the dictionary are those returned by this instance’s fieldnames attribute. The returned record has the additional function - getdataset- Parameters:
- indexint
- the integer index of the desired record where 0 returns the first record 
 
- Returns:
- Rec
- a dictionary-like wrapper containing the result record metadata. 
 
- Raises:
- IndexError
- if index is negative or equal or larger than the number of rows in the result table. 
 
 - See also