RegistryResource

class pyvo.registry.regtap.RegistryResource(results, index, *, session=None)[source]

Bases: Record

a dictionary for the resource metadata returned in one record of a registry query.

A SimpleResource acts as a dictionary, so in general, all attributes can be accessed by name via the [] operator, and the attribute names can by returned via the keys() function. For convenience, it also stores key values as properties; these include:

Attributes Summary

access_url

the URL that can be used to access the service resource.

content_levels

a list of content level labels that describe the intended audience for this resource.

content_types

list of natures or genres of the content of the resource.

creators

The creator(s) of the resource in the order given by the resource record author

expected_columns

ivoid

the IVOA identifier for the resource.

reference_url

URL pointing to a human-readable document describing this resource.

region_of_regard

numeric value representing the angle, given in decimal degrees, by which a positional query against this resource should be "blurred" in order to get an appropriate match.

res_description

the textual description of the resource.

res_title

the title of the resource

res_type

the resource types that characterize this resource.

service

return a service for this resource.

short_name

the short name for the resource

source_format

The format of source_value.

source_value

The bibliographic source for this resource (typically a bibcode or a DOI).

standard_id

the IVOA standard identifier

waveband

a list of names of the wavebands that the resource provides data for

Methods Summary

access_modes()

returns a set of interface identifiers available on this resource.

describe(*[, verbose, width, file])

Print a summary description of this resource.

get_contact()

return contact information for this resource in a string.

get_interface(*, service_type[, lax, ...])

returns a regtap.Interface class for service_type.

get_service([service_type, lax, keyword, ...])

return an appropriate DALService subclass for this resource that can be used to search the resource using service_type.

get_tables(*[, table_limit])

return the structure of the tables underlying the service.

search(*args, **keys)

assuming this resource refers to a searchable service, execute a search against the resource.

Attributes Documentation

access_url

the URL that can be used to access the service resource.

content_levels

a list of content level labels that describe the intended audience for this resource.

content_types

list of natures or genres of the content of the resource.

creators

The creator(s) of the resource in the order given by the resource record author

expected_columns = ['ivoid', 'res_type', 'short_name', 'res_title', 'content_level', 'res_description', 'reference_url', 'creator_seq', 'created', 'updated', 'rights', 'content_type', 'source_format', 'source_value', 'region_of_regard', 'waveband', ("\n  ivo_string_agg(COALESCE(access_url, ''), ':::py VO sep:::')", 'access_urls'), ("\n  ivo_string_agg(COALESCE(standard_id, ''), ':::py VO sep:::')", 'standard_ids'), ("\n  ivo_string_agg(COALESCE(intf_type, ''), ':::py VO sep:::')", 'intf_types'), ("\n  ivo_string_agg(COALESCE(intf_role, ''), ':::py VO sep:::')", 'intf_roles'), ("\n  ivo_string_agg(COALESCE(cap_description, ''), ':::py VO sep:::')", 'cap_descriptions'), 'alt_identifier']
ivoid

the IVOA identifier for the resource.

reference_url

URL pointing to a human-readable document describing this resource.

region_of_regard

numeric value representing the angle, given in decimal degrees, by which a positional query against this resource should be “blurred” in order to get an appropriate match.

res_description

the textual description of the resource.

See also

SimpleResource.describe
res_title

the title of the resource

res_type

the resource types that characterize this resource.

service

return a service for this resource.

This will in general only work if the registry query has constrained the service type; otherwise, many resources will have multiple capabilities. Use get_service instead in such cases.

See also

get_service

select a service of a specific service type.

list_services

return a list with all the available services.

short_name

the short name for the resource

source_format

The format of source_value.

source_value

The bibliographic source for this resource (typically a bibcode or a DOI).

standard_id

the IVOA standard identifier

waveband

a list of names of the wavebands that the resource provides data for

Methods Documentation

access_modes()[source]

returns a set of interface identifiers available on this resource.

For standard interfaces, get_service will return a service suitable for querying if you pass in an identifier from this list as the service_type.

This will ignore VOSI (infrastructure) services.

describe(*, verbose=False, width=78, file=None)[source]

Print a summary description of this resource.

Parameters:
verbosebool

If false (default), only user-oriented information is printed. If true, additional information – reference url, reference to the related article, and alternative identifier (often a DOI) – will be printed if available.

widthint

Format the description with given character-width.

outwritable file-like object

If provided, write information to this output stream. Otherwise, it is written to standard out.

get_contact()[source]

return contact information for this resource in a string.

Use this to report bugs or unexpected downtime.

get_interface(*, service_type: str, lax: bool = False, std_only: bool = False, keyword: str = None)[source]

returns a regtap.Interface class for service_type.

The meaning of the parameters is as for get_service. This method does not return services, though, so you can use it to obtain access URLs and such for interfaces that pyVO does not (directly) support.

Parameters:
service_typestr

If you leave out service_type, this will return a service for “the” standard interface of the resource. If a resource has multiple standard capabilities (e.g., both TAP and SSAP endpoints), this will raise a DALQueryError.

Otherwise, a service of the given service type will be returned. Pass in an ivoid of a standard or one of the shorthands from rtcons.SERVICE_TYPE_MAP, or “web” for a web page (the “service” for this will be an object opening a web browser when you call its query method).

laxbool

If there are multiple capabilities for service_type, the function choose the first matching capability by default Pass lax=False to instead raise a DALQueryError.

std_onlybool

Only return interfaces declared as “std”. This is what you want when you want to construct pyVO service objects later. This parameter is ignored for the “web” service type.

Returns:
Interface
get_service(service_type=None, *, lax=False, keyword=None, session=None)[source]

return an appropriate DALService subclass for this resource that can be used to search the resource using service_type.

Raise a ValueError if the service_type is not offered on the resource (or no standard service is offered). With lax=False, also raise a ValueError if multiple interfaces exist for the given service_type.

VOSI (infrastructure) services are always ignored here.

A magic service_type “web” can be passed in to get non-standard, browser-based interfaces. The service in this case is an object that opens a web browser if its query() method is called.

Parameters:
service_typestr

If you leave out service_type, this will return a service for “the” standard interface of the resource. If a resource has multiple standard capabilities (e.g., both TAP and SSAP endpoints), this will raise a DALQueryError.

Otherwise, a service of the given service type will be returned. Pass in an ivoid of a standard or one of the shorthands from rtcons.SERVICE_TYPE_MAP, or “web” for a web page (the “service” for this will be an object opening a web browser when you call its query method).

laxbool

If there are multiple capabilities for service_type, the function choose the first matching capability by default Pass lax=False to instead raise a DALQueryError.

keywordstr

A keyword that should be in the service description. Some resources have multiple capabilities (“services”) of the same type (see list_services for a discussion). get_service will usually raise a ValueError in that case. Passing a keyword that uniquely identifies the capability to query will make get_service predictably return the desired service. Use list_services to find such a unique description fragment.

sessionobject

optional requests session to use to communicate with the service constructed.

Returns:
pyvo.dal.DALService

For standard service types, a specific DAL service instance (e.g., a pyvo.dal.tap.TAPService when requesting tap services) is returned. For web services, what is returned is an opaque service object that has a search() method simply opening a web browser on the access URL.

See also

list_services

return a list with all the available services.

get_tables(*, table_limit=20)[source]

return the structure of the tables underlying the service.

This returns a dict with table names as keys and vodataservice.VODataServiceTable objects as values (pretty much what tables returns for a TAP service). The table instances will have an origin attribute pointing back to the registry record.

Note that not only TAP services can (and do) define table structures. The meaning of non-TAP tables is not always as clear.

Also note that resources do not need to define tables at all. You will receive an empty dictionary if they don’t.

search(*args, **keys)[source]

assuming this resource refers to a searchable service, execute a search against the resource. This is equivalent to:

self.to_service().search(*args, **keys)

The arguments provided should be appropriate for the service that the DAL service type would expect. See the documentation for the appropriate service type:

Service type

Use the argument syntax for

catalog

pyvo.dal.SCSService.search

image

pyvo.dal.SIAService.search

spectrum

pyvo.dal.SSAService.search

line

pyvo.dal.SLAService.search

database

not yet supported

Raises:
DALServiceError

if the resource does not describe a searchable service.