# Class RegTapRegistryQuery

java.lang.Object
uk.ac.starlink.vo.RegTapRegistryQuery

All Implemented Interfaces:
  `RegistryQuery`

public class RegTapRegistryQuery extends Object implements RegistryQuery
Registry Query implementation that uses TAP to access a Relational Registry.

Since:
  11 Apr 2014
Author:
  Mark Taylor
See Also:
  - IVOA Registry Relational Schema

## Field Summary

Fields
Modifier and Type
Field
Description
`static final uk.ac.starlink.table.ValueInfo`
`ADQL_INFO`
Description of metadata item describing query text.
`static final String`
`AIP_REG`
TAP base URL for GAVO registry hosted at AIP.
`static final String`
`ARI_REG`
TAP base URL for GAVO registry hosted at ARI Heidelberg.
`static final String`
`EUROVO_REG`
TAP base URL for Euro-VO registry, currently hosted at ESAC.
`static final String`
`GAVO_REG`
TAP base URL for high-availablity GAVO registry (DNS pointer).
`static final String`
`INAF_REG`
TAP base URL for INAF registry (not sure if this is permanent).
`static final String`
`PARIS_REG`
TAP base URL for registry hosted at ObsPM, synced with GAVO.
`static final String[]`
`REGISTRIES`
List of known registry TAP base URLs.
`static final uk.ac.starlink.table.ValueInfo`
`REGISTRY_INFO`
Description of metadata item describing registry location.
`static final String`
`STSCI_REG`
TAP base URL for STScI registry.

## Constructor Summary

Constructors
Constructor
Description
`RegTapRegistryQuery(TapService tapService, Ivoid[] standardIds, String adqlWhere)`
Constructs a query which will return RegResource lists for registry resource records with two optional restrictions: (a) restricted to a given service type, and (b) restricted by some free-form ADQL.

## Method Summary

Modifier and Type
Method
Description
`static String`
`getAdqlCondition(ResourceField field, String keyword, boolean hasSubjectsTable)`
Returns text that can be used as part of a WHERE clause to supply to this class that tests for a keyword in a given RR field.
`uk.ac.starlink.table.DescribedValue[]`
`getMetadata()`
Returns a set of DescribedValue objects which characterise this query.
`Iterator<RegResource>`
`getQueryIterator()`
Executes the query described by this object and returns an Iterator over `RegResource` objects.
`RegResource[]`
`getQueryResources()`
Executes the query described by this object and returns the result as an array of `RegResource`s.
`URL`
`getRegistry()`
Returns the registry URL.
`static String[]`
`getSearchableRegistries(TapService regtapService)`
Queries a given registry for searchable registries suitable for use with this class.
`String`
`getText()`
Returns the query text.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### GAVO_REG

public static final String GAVO_REG
TAP base URL for high-availablity GAVO registry (DNS pointer).

See Also:
  - Constant Field Values

### ARI_REG

public static final String ARI_REG
TAP base URL for GAVO registry hosted at ARI Heidelberg.

See Also:
  - Constant Field Values

### AIP_REG

public static final String AIP_REG
TAP base URL for GAVO registry hosted at AIP.

See Also:
  - Constant Field Values

### PARIS_REG

public static final String PARIS_REG
TAP base URL for registry hosted at ObsPM, synced with GAVO.

See Also:
  - Constant Field Values

### EUROVO_REG

public static final String EUROVO_REG
TAP base URL for Euro-VO registry, currently hosted at ESAC.

See Also:
  - Constant Field Values

### STSCI_REG

public static final String STSCI_REG
TAP base URL for STScI registry.

See Also:
  - Constant Field Values

### INAF_REG

public static final String INAF_REG
TAP base URL for INAF registry (not sure if this is permanent).

See Also:
  - Constant Field Values

### REGISTRIES

public static final String[] REGISTRIES
List of known registry TAP base URLs.

### REGISTRY_INFO

public static final uk.ac.starlink.table.ValueInfo REGISTRY_INFO
Description of metadata item describing registry location.

### ADQL_INFO

public static final uk.ac.starlink.table.ValueInfo ADQL_INFO
Description of metadata item describing query text.

## Constructor Details

### RegTapRegistryQuery

public RegTapRegistryQuery(TapService tapService, Ivoid[] standardIds, String adqlWhere)
Constructs a query which will return RegResource lists for registry resource records with two optional restrictions: (a) restricted to a given service type, and (b) restricted by some free-form ADQL. The supplied `adqlWhere` text has to be written with some knowledge of the internals of this class, for instance what columns are available.

Parameters:
  `tapService` - TAP service hosting relational registry
  `standardIds` - possible case-insensitive values for RR `standard_id` field, or null if not restricted by service
  `adqlWhere` - text to be ANDed with existing ADQL WHERE clause, or null for no further restriction

## Method Details

### getMetadata

public uk.ac.starlink.table.DescribedValue[] getMetadata()
Description copied from interface: `RegistryQuery`
Returns a set of DescribedValue objects which characterise this query. These would be suitable for use in the parameter list of a `StarTable` resulting from the execution of this query.

Specified by:
  `getMetadata` in interface `RegistryQuery`

### getRegistry

public URL getRegistry()
Description copied from interface: `RegistryQuery`
Returns the registry URL.

Specified by:
  `getRegistry` in interface `RegistryQuery`
Returns:
  url

### getText

public String getText()
Description copied from interface: `RegistryQuery`
Returns the query text.

Specified by:
  `getText` in interface `RegistryQuery`
Returns:
  query

### getQueryResources

public RegResource[] getQueryResources() throws IOException
Description copied from interface: `RegistryQuery`
Executes the query described by this object and returns the result as an array of `RegResource`s.

Specified by:
  `getQueryResources` in interface `RegistryQuery`
Returns:
  resource list
Throws:
  `IOException`

### getQueryIterator

public Iterator<RegResource> getQueryIterator() throws IOException
Description copied from interface: `RegistryQuery`
Executes the query described by this object and returns an Iterator over `RegResource` objects. Note that the iterator's `next` method may throw the unchecked exception `RegistryQueryException` with a cause indicating the underlying error in case of a registry access problem.

Specified by:
  `getQueryIterator` in interface `RegistryQuery`
Returns:
  iterator over `RegResource`s
Throws:
  `IOException`

### getAdqlCondition

public static String getAdqlCondition(ResourceField field, String keyword, boolean hasSubjectsTable)
Returns text that can be used as part of a WHERE clause to supply to this class that tests for a keyword in a given RR field. The nature of the test (=, LIKE etc) depends on the field. If no suitable ADQL can be written, null is returned

Note that this code currently works by identifying known ResourceFields, so unknown ResourceFields will return null.

Parameters:
  `field` - field whose content is to be tested
  `keyword` - value to test against
  `hasSubjectsTable` - true iff the rr.res_subject table is available for the query (hack; if not it assumes the res_subjects field is available)
Returns:
  ADQL snippet that may be inserted into WHERE clause, or null if it can't be done

### getSearchableRegistries

public static String[] getSearchableRegistries(TapService regtapService) throws IOException
Queries a given registry for searchable registries suitable for use with this class.

Parameters:
  `regtapService` - TAP service description of bootstrap relational registry
Returns:
  list of TAP base URLs for found relational registries
Throws:
  `IOException`