Package uk.ac.starlink.vo

# Class DataModelAdqlExample

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

All Implemented Interfaces:
  `AdqlExample`

public abstract class DataModelAdqlExample extends Object implements AdqlExample
AdqlExample implementation that provides fixed-text examples specific to a given standard declared data model. The getText method returns a non-null value only if the supplied TapCapability declares a data model that the example recognises.

Since:
  3 Jun 2015
Author:
  Mark Taylor

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`DataModelAdqlExample(String name, String description, String infoUrl)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static DataModelAdqlExample[]`
`createObsTapExamples()`
Returns a list of examples applicable for the ObsCore data model.
`static DataModelAdqlExample[]`
`createRegTapExamples()`
Returns a list of examples applicable for the RegTAP data model.
`String`
`getAdqlText(boolean lineBreaks, VersionedLanguage lang, TapCapability tcap, TableMeta[] tables, TableMeta table, double[] skypos)`
Produces ADQL text for a query of the type represented by this object, for a given set of service details.
`String`
`getDescription()`
Returns this example's description.
`URL`
`getInfoUrl()`
Returns a documentation URL associated with this example if available.
`String`
`getName()`
Returns this example's name.
`protected abstract String[]`
`getTextLines(double[] skypos)`
Returns the lines of ADQL text for this example.
`abstract boolean`
`isDataModel(Ivoid dm)`
Indicates whether a given data model string is the one to which this example corresponds.

### Methods inherited from class java.lang.Object

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

## Constructor Details

### DataModelAdqlExample

protected DataModelAdqlExample(String name, String description, String infoUrl)
Constructor.

Parameters:
  `name` - example name
  `description` - example short description
  `infoUrl` - URL for explanation

## Method Details

### isDataModel

public abstract boolean isDataModel(Ivoid dm)
Indicates whether a given data model string is the one to which this example corresponds. The supplied value is the ivo-id attribute of the TAPRegExt `dataModel` attribute, available from `TapCapability.getDataModels()`.

Parameters:
  `dm` - data model identifier

### getTextLines

protected abstract String[] getTextLines(double[] skypos)
Returns the lines of ADQL text for this example.

Parameters:
  `skypos` - 2-element array giving preferred (RA,Dec) sky position in degrees, or null if none preferred

### getName

public String getName()
Description copied from interface: `AdqlExample`
Returns this example's name.

Specified by:
  `getName` in interface `AdqlExample`
Returns:
  name

### getDescription

public String getDescription()
Description copied from interface: `AdqlExample`
Returns this example's description.

Specified by:
  `getDescription` in interface `AdqlExample`
Returns:
  short description

### getInfoUrl

public URL getInfoUrl()
Description copied from interface: `AdqlExample`
Returns a documentation URL associated with this example if available.

Specified by:
  `getInfoUrl` in interface `AdqlExample`
Returns:
  documentation URL (suitable for browser display), or null

### getAdqlText

public String getAdqlText(boolean lineBreaks, VersionedLanguage lang, TapCapability tcap, TableMeta[] tables, TableMeta table, double[] skypos)
Description copied from interface: `AdqlExample`
Produces ADQL text for a query of the type represented by this object, for a given set of service details.

Specified by:
  `getAdqlText` in interface `AdqlExample`
Parameters:
  `lineBreaks` - whether output ADQL should include multiline formatting
  `lang` - ADQL language variant
  `tcap` - TAP capability object
  `tables` - table metadata set
  `table` - currently selected table
  `skypos` - 2-element array giving preferred (RA,Dec) sky position in degrees, or null if none preferred
Returns:
  example text, or null if no example can be constructed given the input values

### createRegTapExamples

public static DataModelAdqlExample[] createRegTapExamples()
Returns a list of examples applicable for the RegTAP data model. This list is taken from section 10 of RegTAP 1.0.

Returns:
  example list
See Also:
  - RegTAP 1.0

### createObsTapExamples

public static DataModelAdqlExample[] createObsTapExamples()
Returns a list of examples applicable for the ObsCore data model. These examples are written with reference to Appendix A of ObsCore 1.0, with a few alterations and corrections.

Returns:
  example list
See Also:
  - ObsCore 1.0