====================
VOTable Format Definition
====================
Official bibliographic entry for published version :cite:p:`2025ivoa.spec.0116O`.
:Status: VOTable 1.5 REC 2025-01-16
.. role:: raw-latex(raw)
:format: latex
..
.. _`VOTable:introduction`:
1 Introduction
==============
The VOTable format is an XML standard for the interchange of data represented as a set of tables. In this context, a table is an unordered set of rows, each of a uniform structure, as specified in the table description (the table *metadata*). Each row in a table is a sequence of table cells, and each of these contains either a primitive data type, or an array of such primitives. VOTable is derived from the Astrores format :cite:p:`astrores`, itself modeled on the FITS Table format :cite:p:`std:FITS`; VOTable was designed to be close to the FITS Binary Table format.
.. _`VOTable:why-votable`:
1.1 Why VOTable?
----------------
Astronomers have always been at the forefront of developments in information technology, and funding agencies across the world have recognized this by supporting the Virtual Observatory movement, in the hopes that other sciences and business can follow their lead in making online data both *interoperable* and *scalable*.
VOTable is designed as a flexible storage and exchange format for tabular data, with particular emphasis on astronomical tables.
Interoperability is encouraged through the use of standards (XML). The XML fabric allows applications to easily validate an input document, as well as facilitating transformations through XSLT (eXtensible Style Language Transformation) engines.
.. _`VOTable:grid-computing`:
Grid Computing
~~~~~~~~~~~~~~
VOTable has built-in features for big-data and Grid computing. It allows metadata and data to be stored separately, with the remote data linked. Processes can then use metadata to ‘get ready’ for their input data, or to organize third-party or parallel transfers of the data. Remote data allow the metadata to be sent in email and referenced in documents without pulling the whole dataset with it: just as we are used to the idea of sending a pointer to a document (URL) in place of the document, so we can now send metadata-rich pointers to data tables in place of the tables themselves. The remote data is referenced with the URL syntax protocol://location, meaning that arbitrarily complex protocols are allowed.
When we are working with very large tables in a distributed-computing environment (“the Grid”), the data stream between processors, with flows being filtered, joined, and cached in different geographic locations. It would be very difficult if the number of rows of the table were required in the header – we would need to stream in the whole table into a cache, compute the number of rows, then stream it again for the computation. In the Grid-data environment, the component in short supply is not the computers, but rather these very large caches. Furthermore, these remote data streams may be created dynamically by another process or cached in temporary storage: for this reason VOTable can express that remote data may not be available after a certain time (:raw-latex:`\color{DarkRed}`\ ``expires``). Data on the net may require authentication for access, so VOTable allows expression of password or other identity information (the ‘:raw-latex:`\color{DarkRed}`\ ``rights``’ attribute).
.. _`VOTable:data-storage-flexible-and-efficient`:
Data Storage: Flexible and Efficient
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The data part in a VOTable may be represented using one of four different formats: TABLEDATA, FITS, BINARY and BINARY2. TABLEDATA is a pure XML format so that small tables can be easily handled in their entirety by XML tools. The FITS binary table format is well-known to astronomers, and VOTable can be used either to encapsulate such a file, or to re-encode the metadata; unfortunately it is difficult to stream FITS, since the dataset size is required in the header (NAXIS2 keyword), and FITS requires a specification up front of the maximum size of its variable-length arrays. The BINARY and BINARY2 formats are supported for efficiency and ease of programming: no FITS library is required, and the streaming paradigm is supported.
VOTable can be used in different ways, as a data storage and transport format, and also as a way to store metadata alone (table structure only). In the latter case, a VOTable structure can be sent to a server, which can then open a high-bandwidth connection to receive the actual data, using the previously-digested structure as a way to interpret the stream of bytes from the data socket.
VOTable can be used for small numbers of small records (pure XML tables), or for large numbers of simple records (streaming data), or it can be used for small numbers of larger objects. In the latter case, there will be software to spread large data blocks among multiple processors on the Grid. Currently the most complex structure that can be in a VOTable Cell is a multidimensional array.
.. _`VOTable:xml-conventions`:
1.2 XML Conventions
-------------------
VOTable is constructed with `XML `__ (extensible Markup Language), a powerful standard for structured data throughout the Internet industries. It derives from SGML, a standard used in the publishing industry and for technical documentation for many years. XML consists of *elements* and payload, where an element consists of a *start tag* (the part in angle brackets), the payload, and an *end tag* (with angle brackets and a slash). Elements can contain other elements. Elements can also bear :raw-latex:`\color{DarkRed}`\ ``attributes`` (keyword-value combinations).
The payload may be in two forms: parsed or unparsed character data. Examples are:
::
François
In the first example, the sequence ``ç`` is interpreted as part of the ISO/IEC 10646 character set (Unicode), and translates to an accented character, so that the text is “François". The second example uses the special ``CDATA`` sequence so that the characters ``<``, ``>``, and ``&`` can be used without interpretation; in this case, any ASCII characters are allowed except the terminating sequence ``]]>``. For more information, see any book on XML.
.. _`VOTable:syntax-policy`:
1.3 Syntax Policy
-----------------
Following the general XML rule, element and attribute names are case-sensitive and have to be used with the specified capitalisation. For VOTable, we have adopted the convention that element names are spelled in uppercase and attribute names in lowercase (with an exception for the :raw-latex:`\color{DarkRed}`\ ``ID`` attribute). Element and attribute names are further distinguished in this paper by being typed with a :raw-latex:`\color{DarkRed}`\ ``red fixed-width`` font, and the values of the attributes by being ``"``\ :raw-latex:`\color{DarkPurple}`coloured\ ``"``.
.. _`VOTable:sec:voarch`:
1.4 VOTable in the VO Architecture
----------------------------------
.. container:: float
:name: VOTable:fig:archdiag
.. raw:: latex
\centering
|image1|
VOTable is a core IVOA standard. Figure :ref:`VOTable:fig:archdiag` shows the role this document plays within the IVOA architecture.
Wherever tabular data is transferred between Virtual Observatory components, VOTable provides the preferred serialization format. Since tables are used to list available resources as well as to represent science data which is itself tabular, this means that VOTable is used pervasively in the definitions of the Data Access protocols (e.g. SCS, SIA, SSA, TAP), and hence for exchange of data and metadata between user layer applications and data-providing services. VOTable is also used as a serialization format for some of the IVOA Data Models.
In order to represent semantically rich metadata, VOTable relies on the other IVOA standards UCD, Utype, VOUnits, and DALI. This document explains how information structured according to those standards are managed within the VOTable framework.
.. _`VOTable:data-model`:
2 Data Model
============
In this section we define the data model of a VOTable, and in the next sections its syntax when expressed as XML. The data model of VOTable can be expressed as:
.. raw:: latex
\medskip
+----------------+------------------+---+------------------------------------------------------------------------------------------------+
| .. raw:: latex | **VOTable** | = | hierarchy of **Metadata** + associated **TableData**, arranged as a set of **Tables** |
| | | | |
| \hspace | | | |
+----------------+------------------+---+------------------------------------------------------------------------------------------------+
| | **Metadata** | = | **Parameters** + **Infos** + **Descriptions** + **:raw-latex:`\color`Links + Fields + Groups** |
+----------------+------------------+---+------------------------------------------------------------------------------------------------+
| | **Table** | = | list of **Fields + TableData** |
+----------------+------------------+---+------------------------------------------------------------------------------------------------+
| | **TableData**\ | = | stream of **Rows** |
+----------------+------------------+---+------------------------------------------------------------------------------------------------+
| | **Row** | = | list of **Cells** |
+----------------+------------------+---+------------------------------------------------------------------------------------------------+
| | **Cell** | = | :math:`\left\{ |
| | | | \begin{tabular}{l} |
| | | | {\bf Primitive} \\ |
| | | | or variable-length list of {\bf Primitives} \\ |
| | | | or multidimensional array of {\bf Primitives}\\ |
| | | | \end{tabular} |
| | | | \right.` |
+----------------+------------------+---+------------------------------------------------------------------------------------------------+
| | **Primitive** | = | integer, character, float, floatComplex, etc (see Table :raw-latex:`\ref` below). |
+----------------+------------------+---+------------------------------------------------------------------------------------------------+
.. raw:: latex
\medskip
:raw-latex:`\noindent` Metadata is divided into that which concerns the table itself (parameters), and the definitions of the fields (or column attributes) of the table. Each :raw-latex:`\color{DarkRed}`\ ``FIELD`` represents the metadata that can be found at the top of the column in a paper version of the table: in the example introduced in section :ref:`VOTable:example1` below, the first :raw-latex:`\color{DarkRed}`\ ``FIELD`` has its :raw-latex:`\color{DarkRed}`\ ``name`` attribute set to ``"``\ :raw-latex:`\color{DarkPurple}`RA\ ``"``. The Field can be thought of as a class definition, and the table cells below it are the instances of that class.
A parameter (:raw-latex:`\color{DarkRed}`\ ``PARAM``) is similar to a :raw-latex:`\color{DarkRed}`\ ``FIELD``, except that it has a :raw-latex:`\color{DarkRed}`\ ``value`` attribute. Parameters can be seen as “constant columns”, containing for instance FITS keywords or any other information pertaining to the table itself or its environment, such as the ``Telescope`` parameter in the example of section :ref:`VOTable:example1`.
An informative parameter (:raw-latex:`\color{DarkRed}`\ ``INFO``) (see section :ref:`VOTable:elem:INFO`) is a restricted form of the :raw-latex:`\color{DarkRed}`\ ``PARAM`` — it is always understood as a *string* (i.e. :raw-latex:`\color{DarkRed}`\ ``datatype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``char``\ ``"`` and :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``*``\ ``"`` are *implied*).
:raw-latex:`\mbox{}{\color{black}}` The ordered list of Fields at the top of the table thus provides a template for a Row object (also called a *record*). The template allows interpretation of the data in the Row. The record is a set of Cells, with the number and order of Cells the same for each Row, and the same as the number of Fields defined in the Metadata.
In VOTable, there is generally no advance specification of the number of rows in the table: this is to allow streaming of large tables, as discussed above. However, if the number of rows is known, it may be specified in a dedicated :raw-latex:`\color{DarkRed}`\ ``nrows`` attribute.
From Version 1.1, columns may be logically grouped, so that it is possible to define table substructures made of column associations. Such an association is declared as a :raw-latex:`\color{DarkRed}`\ ``GROUP``, which typically contains column references (:raw-latex:`\color{DarkRed}`\ ``FIELDref``) and associated parameters (:raw-latex:`\color{DarkRed}`\ ``PARAM``).
.. _`VOTable:primitives`:
2.1 Primitives
--------------
.. container:: center
.. table:: :raw-latex:`\label{primitives}`List of the Primitives *(details in section :ref:`VOTable:sec:datatypes`)*
+------------------------------------------------+-------------------+------------------------------------+--------+
| :raw-latex:`\color`\ ``datatype`` | Meaning | :raw-latex:`\color`\ ``FITS`` | Bytes |
+================================================+===================+====================================+========+
| ``"``\ :raw-latex:`\color`boolean\ ``"`` | Logical | ``"``\ :raw-latex:`\color`L\ ``"`` | 1 |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`bit\ ``"`` | Bit | ``"``\ :raw-latex:`\color`X\ ``"`` | \* |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`unsignedByte\ ``"`` | Byte (0 to 255) | ``"``\ :raw-latex:`\color`B\ ``"`` | 1 |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`short\ ``"`` | Short Integer | ``"``\ :raw-latex:`\color`I\ ``"`` | 2 |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`int\ ``"`` | Integer | ``"``\ :raw-latex:`\color`J\ ``"`` | 4 |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`long\ ``"`` | Long integer | ``"``\ :raw-latex:`\color`K\ ``"`` | 8 |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`char\ ``"`` | ASCII Character | ``"``\ :raw-latex:`\color`A\ ``"`` | 1 |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`unicodeChar\ ``"`` | Unicode Character | | 2 |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`float\ ``"`` | Floating point | ``"``\ :raw-latex:`\color`E\ ``"`` | 4 |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`double\ ``"`` | Double | ``"``\ :raw-latex:`\color`D\ ``"`` | 8 |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`floatComplex\ ``"`` | Float Complex | ``"``\ :raw-latex:`\color`C\ ``"`` | 8 |
+------------------------------------------------+-------------------+------------------------------------+--------+
| ``"``\ :raw-latex:`\color`doubleComplex\ ``"`` | Double Complex | ``"``\ :raw-latex:`\color`M\ ``"`` | 16 |
+------------------------------------------------+-------------------+------------------------------------+--------+
Each Cell is composed from Primitives, each of which is a datatype of fixed-length binary representation, as listed in Table :ref:`VOTable:primitives`. Cells may consist of a single Primitive (this is the default), or of an *array* (which may be multidimensional) of Primitives (see section :ref:`VOTable:array`).
Except for the Bit type, each primitive has the fixed length in bytes given in Table :ref:`VOTable:primitives`. Bit scalars and arrays are stored in the minimum number of bytes feasible (so that :math:`b` bits take the integer part of :math:`(b+7)/8` bytes). These primitives are described in more detail in section :ref:`VOTable:sec:datatypes`.
VOTables support two kinds of characters: ASCII 1-byte characters and Unicode (UCS-2) 2-byte characters. Unicode is a way to represent characters that is an alternative to ASCII. It uses two bytes per character instead of one, it is strongly supported by XML tools, and it can handle a large variety of international alphabets. Therefore VOTable supports not only ASCII strings (:raw-latex:`\color{DarkRed}`\ ``datatype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``char``\ ``"``), but also Unicode (:raw-latex:`\color{DarkRed}`\ ``datatype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``unicodeChar``\ ``"``).
Note that strings are not a primitive type: strings are represented in VOTable as an array of characters.
.. _`VOTable:array`:
2.2 Columns as Arrays
---------------------
:raw-latex:`\label{sec:dim}`
A table cell can contain an *array* of a given primitive type, with a fixed or variable number of elements; the array may even be multidimensional. For instance, the position of a point in a 3D space can be defined by the following:
:raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``FIELD``\ ````\ :raw-latex:`\color{DarkRed}`\ ``ID``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``point_3D``\ ``"``\ ````\ :raw-latex:`\color{DarkRed}`\ ``datatype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``double``\ ``"``\ ````\ :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``3``\ ``"``:raw-latex:`\color{blue}`\ ``/``:raw-latex:`\color{blue}`\ ``>``
:raw-latex:`\noindent `and each cell corresponding to that definition must contain exactly 3 numbers. An asterisk () may be appended to indicate a *variable* number of elements in the array, as in:
:raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``FIELD``\ ````\ :raw-latex:`\color{DarkRed}`\ ``ID``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``values``\ ``"``\ ````\ :raw-latex:`\color{DarkRed}`\ ``datatype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``int``\ ``"``\ ````\ :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``100*``\ ``"``:raw-latex:`\color{blue}`\ ``/``:raw-latex:`\color{blue}`\ ``>``
:raw-latex:`\noindent `where it is specified that each cell corresponding to that definition contains 0 to 100 integer numbers. The number may be omitted to specify an unbounded array (in practice up to :math:`\simeq 2\times10^9` elements).
A table cell can also contain a *multidimensional array* of a given primitive type. This is specified by a sequence of dimensions separated by the ``x`` character, with the first dimension changing fastest; as in the case of a simple array, the last dimension may be variable in length. As an example, the following definition declares a table cell which may contain a set of up to 10 images, each of 64x64 bytes:
:raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``FIELD``\ ````\ :raw-latex:`\color{DarkRed}`\ ``ID``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``thumbs``\ ``"``\ ````\ :raw-latex:`\color{DarkRed}`\ ``datatype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``unsignedByte``\ ``"``\ ````\ :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``64x64x10*``\ ``"``:raw-latex:`\color{blue}`\ ``/``:raw-latex:`\color{blue}`\ ``>``
Strings, which are defined as a set of characters, can therefore be represented in VOTable as a fixed- or variable-length array of characters:
:raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``FIELD``\ ````\ :raw-latex:`\color{DarkRed}`\ ``name``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``unboundedString``\ ``"``\ ````\ :raw-latex:`\color{DarkRed}`\ ``datatype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``char``\ ``"``\ ````\ :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``*``\ ``"``:raw-latex:`\color{blue}`\ ``/``:raw-latex:`\color{blue}`\ ``>``
A 1D array of strings can be represented as a 2D array of characters, but given the logic above, it is possible to define a variable-length array of fixed-length strings, but not a fixed-length array of variable-length strings. A convention to express an array of variable-length strings exists (see section :ref:`VOTable:sec:arraystring`) but is not part of this standard.
**Note:** :raw-latex:`\color{DarkRed}`\ ``arraysize`` should be present if, and only if, each table cell for the :raw-latex:`\color{DarkRed}`\ ``FIELD`` is intended to be treated as an array. :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``1``\ ``"`` should not be used, as it is interpreted differently by different clients at this point. If a future VOTable specification re-encourages its use, :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``1``\ ``"`` will mean “array of length 1”.
.. _`VOTable:compatibility-with-fits-binary-tables`:
2.3 Compatibility with FITS Binary Tables
-----------------------------------------
VOTable is closely compatible with the FITS Binary Table format. Henceforth, we shall abbreviate “FITS Binary Table and its Conventions" simply by the word “FITS". Given a FITS file that represents a binary table, the header may be converted to VOTable, with a pointer to the original file, or with the original file included directly in VOTable. Since the original file is still present, it is clear that no data has been lost. A :raw-latex:`\color{DarkRed}`\ ``PARAM`` element can be used to hold any FITS keyword with its value and comment string.
We might ask two more significant questions, about how much of the FITS header and data can be represented in VOTable. The answer is that there is considerable overlap.
For instance, the recommended formatting of the data for an edition of the data is expressed by the non-mandatory TDISP keyword: for example F12.4 means 12 characters are to be used, and 4 decimal places. This has been converted in VOTable as the attributes :raw-latex:`\color{DarkRed}`\ ``width`` and :raw-latex:`\color{DarkRed}`\ ``precision`` which, connected with **:raw-latex:`\color{DarkRed}`\ ``datatype``**, are semantically identical to the TDISP keyword.
.. _`VOTable:what-can-fits-do-but-not-votable`:
What can FITS do but not VOTable?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FITS has complex semantics, with many conventions (see *e.g.* the Registry of FITS Conventions [1]_) which have been developed mainly to be able to cope with the increasing complexity of astronomical instrumentation. In the frame of the *Virtual Observatory* the complexity is described by means of *data models*, and from its version 1.1, *VOTable* can refer to these data models by means of the :raw-latex:`\color{DarkRed}`\ ``utype`` attribute described in section :ref:`VOTable:sec:utype`.
.. _`VOTable:what-can-votable-do-but-not-fits`:
What can VOTable do but not FITS?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VOTable supports separating of data from metadata and the streaming of tables, and other ideas from modern distributed computing. It bridges two ways to express structured data: XML and FITS. It uses UCDs – see section :ref:`VOTable:sec:ucd`) to formally express the semantic content of a parameter or field. It has the hierarchy and flexibility of XML: using :raw-latex:`\color{DarkRed}`\ ``GROUP`` elements introduced in version 1.1, columns in a VOTable can be grouped in arbitrarily complex hierarchies; and the ID attribute can be used in XML to enable what are essentially pointers. FITS does not handle Unicode (extended alphabet) characters.
.. raw:: latex
\medskip
:raw-latex:`\noindent{\color{black}It should be noticed that the transformation
of FITS to VOTable is reversible:
any FITS table can be converted to a VOTable without loss of
information and the resulting VOTable can be converted back to a
FITS table also without loss of information.
However, it is
possible to create new VOTables which cannot be converted to FITS
tables without loss of information.
}`
.. _`VOTable:elem:VOTABLE`:
3 The VOTable Document Structure
================================
The overall VOTable document structure is described and controlled by its XML Schema :cite:p:`std:XSD`. The schema for VOTable version :raw-latex:`\ivoaDocversion{}` is given in appendix :ref:`VOTable:XML-schema` of this document. It can also be retrieved from http://www.ivoa.net/xml/VOTable/votable-1.5.xsd.
A VOTable document consists of a single all-containing element called :raw-latex:`\color{DarkRed}`\ ``VOTABLE``, which contains descriptive elements and global definitions (:raw-latex:`\color{DarkRed}`\ ``DESCRIPTION``, :raw-latex:`\color{DarkRed}`\ ``GROUP``, :raw-latex:`\color{DarkRed}`\ ``PARAM``, :raw-latex:`\color{DarkRed}`\ ``INFO``), followed by one or more :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` elements. Each Resource element contains zero or more :raw-latex:`\color{DarkRed}`\ ``TABLE`` elements, and possibly other :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` elements.
The :raw-latex:`\color{DarkRed}`\ ``TABLE`` element, the actual heart of VOTable, contains a description of the columns and parameters (described in section :ref:`VOTable:sec:field`) followed by the data values (described in section :ref:`VOTable:sec:data`).
As the root element, :raw-latex:`\color{DarkRed}`\ ``VOTABLE`` has attributes which specify the VOTable version number and XML namespaces used in the document. For VOTable :raw-latex:`\ivoaDocversion{}`, the :raw-latex:`\color{DarkRed}`\ ``VOTABLE`` element MUST define :raw-latex:`\color{DarkRed}`\ ``version``\ ``="``\ :raw-latex:`\color{DarkPurple}`:raw-latex:`\ivoaDocversion{}`\ ``"``. All VOTable :raw-latex:`\ivoaDocversion{}` elements come from the namespace ``http://www.ivoa.net/xml/VOTable/v1.3``. It is recommended to bind the empty namespace prefix to this URI, as in
.. math:: \hbox{{\tt{\color{DarkRed}xmlns}="{\color{DarkPurple}http://www.ivoa.net/xml/VOTable/v1.3}"}~,}
\ but instance documents are free to use whatever namespace prefix is convenient for them.
Note that starting with VOTable 1.3, the namespace URI for VOTable will remain fixed at ``http://www.ivoa.net/xml/VOTable/v1.3`` until the next major version as discussed in :cite:t:`2018ivoa.spec.0529H`. As per IVOA recommendations, this namespace URI will always redirect to the latest recommended schema for VOTable version 1.x.
VOTable consumers doing schema validation are free to use either this latest recommended schema or the version-specific schema relevant to the VOTable version. So, while instance documents may include the :raw-latex:`\color{DarkRed}`\ ``schemaLocation`` attribute, consumers are not required to honor it.
Documents claiming to represent VOTables must validate against the relevant version of the VOTable schema without error. Notice that the validation is a necessary, *but not sufficient*, condition for correctness.
.. _`VOTable:example`:
3.1 Example
-----------
This simple example of a VOTable document lists 3 galaxies with their position, velocity and error, and their estimated distance.
:raw-latex:`\label{example1}` :raw-latex:`\small` :raw-latex:`\verbatiminput{stc_example1.vot}`
This simple :raw-latex:`\color{DarkRed}`\ ``VOTABLE`` document shows a single :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` made of a single :raw-latex:`\color{DarkRed}`\ ``TABLE``; the table is made of 6 columns, each described by a :raw-latex:`\color{DarkRed}`\ ``FIELD``, and has one additional :raw-latex:`\color{DarkRed}`\ ``PARAM`` parameter (the Telescope). The actual rows are listed in the :raw-latex:`\color{DarkRed}`\ ``DATA`` part of the table, here in XML format (introduced by :raw-latex:`\color{DarkRed}`\ ``TABLEDATA``); each cell is marked by the :raw-latex:`\color{DarkRed}`\ ``TD`` element, and follow the same order as their :raw-latex:`\color{DarkRed}`\ ``FIELD`` description: *RA, Dec, Name, RVel, e_RVel, R*.
.. _`VOTable:sec:name`:
3.2 :raw-latex:`\color{DarkRed}`\ ``name``, :raw-latex:`\color{DarkRed}`\ ``ID`` and :raw-latex:`\color{DarkRed}`\ ``ref`` attributes
-------------------------------------------------------------------------------------------------------------------------------------
Most of the elements defined by VOTable may have or have to have *names*, like a :raw-latex:`\color{DarkRed}`\ ``RESOURCE``, a :raw-latex:`\color{DarkRed}`\ ``TABLE``, a :raw-latex:`\color{DarkRed}`\ ``PARAM`` or a :raw-latex:`\color{DarkRed}`\ ``FIELD``. The content of the :raw-latex:`\color{DarkRed}`\ ``name`` attribute is defined as a *token* XML type, that is a string of characters where the blanks and spaces are not meaningful (no leading or trailing spaces, no multiple spaces): :raw-latex:`\color{DarkRed}`\ ``name``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``NVSS flux(1.4GHz)``\ ``"`` represents therefore a valid name.
The :raw-latex:`\color{DarkRed}`\ ``ID`` and :raw-latex:`\color{DarkRed}`\ ``ref`` attributes are defined as XML types *ID* and *IDREF* respectively. This means that the contents of :raw-latex:`\color{DarkRed}`\ ``ID`` is an *identifier* which must be unique throughout a VOTable document, and that the contents of the :raw-latex:`\color{DarkRed}`\ ``ref`` attribute represents a reference to an identifier which must exist in the VOTable document. In other terms, if :raw-latex:`\color{DarkRed}`\ ``ref``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``myStar``\ ``"`` is found in one element, there must exist an element in the same document with the :raw-latex:`\color{DarkRed}`\ ``ID``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``myStar``\ ``"`` attribute. The XML standard moreover specifies that an *ID* type is a string beginning with a letter or underscore (``_``), followed by a sequence of Unicode letters, digits, or any of the punctuation characters ``.`` (dot), ``-`` (dash) or ``_`` (underscore). The ``:`` (colon) is reserved for namespace use and should be avoided. Therefore :raw-latex:`\color{DarkRed}`\ ``ID``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``1``\ ``"`` is *not* valid, but :raw-latex:`\color{DarkRed}`\ ``ID``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``_1``\ ``"`` or :raw-latex:`\color{DarkRed}`\ ``ID``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``ref.1``\ ``"`` are both valid.
The :raw-latex:`\color{DarkRed}`\ ``ID`` attribute is therefore required in the elements which *have to be referenced*, but the elements having an :raw-latex:`\color{DarkRed}`\ ``ID`` attribute do not need to be referenced.
The relative position of an :raw-latex:`\color{DarkRed}`\ ``ID`` and its corresponding reference(s) may have an impact on the performance or functionality of streaming parsers. For this reason, earlier versions of VOTable recommended placing the :raw-latex:`\color{DarkRed}`\ ``ID`` attribute before any references to it, but there may be cases where the opposite is more appropriate. In practical terms, no requirement has ever been placed on the ordering of an :raw-latex:`\color{DarkRed}`\ ``ID`` and its references, so VOTable creators are free to use either order and parsers/consumers should handle either order.
While the :raw-latex:`\color{DarkRed}`\ ``ID`` attribute has to be unique in a VOTable document, the :raw-latex:`\color{DarkRed}`\ ``name`` attribute need not. It is however recommended, as a good practice, to assign unique names within a :raw-latex:`\color{DarkRed}`\ ``TABLE`` element. This recommendation means that, between a :raw-latex:`\color{DarkRed}`\ ``TABLE`` and its corresponding closing :raw-latex:`\color{DarkRed}{\color{blue}/}`\ ``TABLE`` tag, :raw-latex:`\color{DarkRed}`\ ``name`` attributes of :raw-latex:`\color{DarkRed}`\ ``FIELD``, :raw-latex:`\color{DarkRed}`\ ``PARAM`` and optional :raw-latex:`\color{DarkRed}`\ ``GROUP`` elements should be all different.
.. _`VOTable:sec:definitions`:
3.3 :raw-latex:`\color{DarkRed}`\ ``VOTABLE`` Element
-----------------------------------------------------
The :raw-latex:`\color{DarkRed}`\ ``VOTABLE`` element may contain definitions consisting of a :raw-latex:`\color{DarkRed}`\ ``DESCRIPTION``, followed by any mixture of parameters and informative notes eventually structured in *groups*. These elements represent values which are meaningful over all tables included in a :raw-latex:`\color{DarkRed}`\ ``VOTABLE`` document — definitions specific to a :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` (section :ref:`VOTable:elem:RESOURCE`) or a :raw-latex:`\color{DarkRed}`\ ``TABLE`` (section :ref:`VOTable:elem:TABLE`) are better placed within their most appropriate element.
Note that version 1.0 of VOTable required the usage of a :raw-latex:`\color{DarkRed}`\ ``DEFINITIONS`` element holding the VOTable global definitions — this usage is deprecated since version 1.1.
.. _`VOTable:elem:COOSYS`:
3.4 :raw-latex:`\color{DarkRed}`\ ``COOSYS`` Element
----------------------------------------------------
The :raw-latex:`\color{DarkRed}`\ ``COOSYS`` element defines a celestial coordinate system, to which the components of a position on the celestial sphere refer. It has the following attributes, all of them (syntactically) optional:
:raw-latex:`\color{DarkRed}`\ ``ID``
Required if the :raw-latex:`\color{DarkRed}`\ ``COOSYS`` element has to be referred to via the :raw-latex:`\color{DarkRed}`\ ``ref`` attribute of the position components, which is generally the case.
:raw-latex:`\color{DarkRed}`\ ``system``
Specifies the reference frame of the coordinates. The value must be taken from the IVOA *refframe* vocabulary (http://www.ivoa.net/rdf/refframe). At the time of writing, this vocabulary includes the terms: *AZ_EL*, *BODY*, *ecl_FK4*, *ECLIPTIC*, *EQUATORIAL*, *FK4*, *FK5*, *GALACTIC*, *GALACTIC_I*, *GENERIC_GALACTIC*, *ICRS*, *SUPER_GALACTIC*, *UNKNOWN*
As that vocabulary can be extended at any time, clients should fail gracefully when they encounter unknown reference frames. Up through VOTable 1.4, these identifiers were defined in the VOTable schema, and some systems had different identifiers. These legacy identifiers are still in the vocabulary, but they are deprecated. Clients should use the vocabulary (see sect. 3 of :cite:t:`2023ivoa.spec.0206D` for how to do that without RDF tooling) to map the legacy identifiers to current identifiers.
:raw-latex:`\color{DarkRed}`\ ``equinox``
Fixes the equatorial or ecliptic systems (as e.g., ``"J2000"`` as the default for ``"FK5"`` or ``"B1950"``, as the default for ``"FK4"``).
:raw-latex:`\color{DarkRed}`\ ``epoch``
Specifies the epoch of the positions if necessary, again as an astroYear (i.e, prefixed with J or B depending on whether Julian or Besselian years are used). COOSYS only supports time specifications in Julian or Besselian years.
:raw-latex:`\color{DarkRed}`\ ``refposition``
The reference position for which the positions are given. The values of this attribute should be taken from the IVOA *refposition* vocabulary (http://www.ivoa.net/rdf/refposition). At the time of writing, this vocabulary includes the terms *BARYCENTER*, *EMBARYCENTER*, *GEOCENTER*, *HELIOCENTER*, *TOPOCENTER*, *UNKNOWN*
Also note that :raw-latex:`\color{DarkRed}`\ ``COOSYS`` may be deprecated in the future in favor of a more generic way of describing the conventions used to define the positions of the objects studied in the enclosed tables.
A :raw-latex:`\color{DarkRed}`\ ``COOSYS`` element referenced via a :raw-latex:`\color{DarkRed}`\ ``ref`` attribute SHOULD appear before the element that references it.
.. _`VOTable:elem:TIMESYS`:
3.5 :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` Element
-----------------------------------------------------
The :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` element (introduced in VOTable 1.4) defines metadata for temporal coordinates. To reference the time system defined by a :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` element, :raw-latex:`\color{DarkRed}`\ ``FIELD``s (and possibly :raw-latex:`\color{DarkRed}`\ ``PARAM``s) MUST reference the :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` using the VOTable :raw-latex:`\color{DarkRed}`\ ``ref`` attribute.
If a :raw-latex:`\color{DarkRed}`\ ``FIELD`` or :raw-latex:`\color{DarkRed}`\ ``PARAM`` represents a time-like quantity but does not reference a :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` element, then no assertion is made about its time system. A :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` element referenced via a :raw-latex:`\color{DarkRed}`\ ``ref`` attribute MUST appear before the element that references it.
:raw-latex:`\color{DarkRed}`\ ``TIMESYS`` has the following attributes:
:raw-latex:`\color{DarkRed}`\ ``ID``
This attribute is used to reference :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` elements from the elements using the time system.
:raw-latex:`\color{DarkRed}`\ ``timeorigin``
This is the time origin of the time coordinate, given as a Julian Date for the time scale and reference point defined. It is usually given as a floating point literal; for convenience, the magic strings ``MJD-origin`` (standing for 2400000.5) and ``JD-origin`` (standing for 0) are also allowed. The timeorigin attribute MUST be given unless the time’s representation contains a year of a calendar era, in which case it MUST NOT be present. In VOTables, these representations currently are Gregorian calendar years with :raw-latex:`\color{DarkRed}`\ ``xtype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``timestamp``\ ``"``, or years in the Julian or Besselian calendar when a column has ``yr``, ``a`` or ``Ba`` as its unit and no time origin is given. When using calendar epochs written in julian or besselian years, note that conventionally Julian years are tied to the TDB timescale and Besselian years to the ET (equivalent to TT) timescale :cite:p:`2015A+A...574A..36R`.
:raw-latex:`\color{DarkRed}`\ ``timescale``
This is the time scale used. Values SHOULD be taken from the IVOA *timescale* vocabulary (http://www.ivoa.net/rdf/timescale). At the time of writing, this vocabulary includes the terms: *GPS*, *TAI*, *TCB*, *TCG*, *TDB*, *TT*, *UNKNOWN*, *UT*, *UTC*
This attribute is mandatory.
:raw-latex:`\color{DarkRed}`\ ``refposition``
The reference position again is a simple string. As with the COOSYS attribute of this name, the values SHOULD be taken from the IVOA *refposition* vocabulary (http://www.ivoa.net/rdf/refposition) which at the time of writing includes the terms *BARYCENTER*, *EMBARYCENTER*, *GEOCENTER*, *HELIOCENTER*, *TOPOCENTER*, *UNKNOWN*
This attribute is mandatory.
The example below shows a VOTable in which each row would have an observation time, a flux, and a magnitude. The observation time values are given in days since Julian Date 2455197.5 (the time origin for the Gaia observatory) in the Barycentric Coordinate Time (TCB) time scale, with the reference position being the barycenter of the solar system.
In the example, the :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` element describes that time system. The :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` ID value needs to be unique within the document so that it can be referenced by :raw-latex:`\color{DarkRed}`\ ``FIELD``s or :raw-latex:`\color{DarkRed}`\ ``PARAM``s. Then the :raw-latex:`\color{DarkRed}`\ ``obs_time`` :raw-latex:`\color{DarkRed}`\ ``FIELD`` indicates that its values should be interpreted in that time system by referring back to the :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` element using :raw-latex:`\color{DarkRed}`\ ``ref``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``time_frame``\ ``"``.
Similarly, the :raw-latex:`\color{DarkRed}`\ ``COOSYS`` element defines the coordinate system, and is referred to by the :raw-latex:`\color{DarkRed}`\ ``ra`` and :raw-latex:`\color{DarkRed}`\ ``dec`` :raw-latex:`\color{DarkRed}`\ ``PARAM`` elements. Note that since the sky position is defined by :raw-latex:`\color{DarkRed}`\ ``PARAM``s instead of :raw-latex:`\color{DarkRed}`\ ``FIELD``s, the same sky position applies to each row of the :raw-latex:`\color{DarkRed}`\ ``TABLE`` without the values appearing in :raw-latex:`\color{DarkRed}`\ ``TD`` elements.
Further (non-normative) information on best practices and usage patterns for :raw-latex:`\color{DarkRed}`\ ``TIMESYS`` can be found in :cite:t:`timesys`.
.. raw:: latex
\begingroup
.. raw:: latex
\small
.. raw:: latex
\verbatiminput{timesys_example.vot}
.. raw:: latex
\endgroup
.. _`VOTable:sec:resource`:
3.6 :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` Element
------------------------------------------------------
:raw-latex:`\label{elem:RESOURCE}`
A VOTable document contains one or more :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` elements, each of these providing a description and the data values of some logically independent data structure.
Each :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` may include the descriptive element :raw-latex:`\color{DarkRed}`\ ``DESCRIPTION``, followed by a mixture of :raw-latex:`\color{DarkRed}`\ ``INFO``, :raw-latex:`\color{DarkRed}`\ ``GROUP`` and :raw-latex:`\color{DarkRed}`\ ``PARAM`` elements; it may also contain :raw-latex:`\color{DarkRed}`\ ``LINK`` elements to provide URL-type pointers that give further information.
The main component of a :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` is typically one or more :raw-latex:`\color{DarkRed}`\ ``TABLE`` elements – in other words a :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` is basically a set of related tables. The :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` is recursive (it can contain other :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` elements), which means that the set of tables making up a :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` may become a tree structure.
A :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` may have one or both of the :raw-latex:`\color{DarkRed}`\ ``name`` or :raw-latex:`\color{DarkRed}`\ ``ID`` attributes (see section :ref:`VOTable:sec:name`); it may also be qualified by :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``meta``\ ``"``, meaning that the resource is *descriptive* only, i.e. does not contain any actual data: no :raw-latex:`\color{DarkRed}`\ ``DATA`` element should exist in any of its sub-elements. A :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` without this attribute *may* however have no :raw-latex:`\color{DarkRed}`\ ``DATA`` sub-element.
For example, a :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` qualified by :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``meta``\ ``"`` can be used to transmit MIVOT (Model Instances in VOTables) annotations :cite:p:`2023ivoa.spec.0620M`. MIVOT defines a syntax to map VOTable contents to any model serizalized in VO-DML :cite:p:`2018ivoa.spec.0910L`. It operates as a bridge between models and data that associates VOTable metadata to data model entities, possibly adding advanced metadata not representable in plain VOTable. MIVOT annotations have their own XMLnamespace. The VOTable schema allows MIVOT, and any elements from a foreign namespace, in a :raw-latex:`\color{DarkRed}`\ ``RESOURCE``.
Finally, the :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` element may have a :raw-latex:`\color{DarkRed}`\ ``utype`` attribute to link the element to some external data model (introduced in version 1.1, see section :ref:`VOTable:sec:utype`).
.. _`VOTable:sec:link`:
3.7 :raw-latex:`\color{DarkRed}`\ ``LINK`` Element
--------------------------------------------------
:raw-latex:`\label{elem:LINK}`
The role of the :raw-latex:`\color{DarkRed}`\ ``LINK`` element is to provide pointers to external resources through a URI. In VOTable, the :raw-latex:`\color{DarkRed}`\ ``LINK`` element may be part of a :raw-latex:`\color{DarkRed}`\ ``RESOURCE``, :raw-latex:`\color{DarkRed}`\ ``TABLE``, :raw-latex:`\color{DarkRed}`\ ``GROUP``, :raw-latex:`\color{DarkRed}`\ ``FIELD`` or :raw-latex:`\color{DarkRed}`\ ``PARAM`` element.
The linked URI is given by the :raw-latex:`\color{DarkRed}`\ ``href`` attribute, and the nature of the link is indicated by the :raw-latex:`\color{DarkRed}`\ ``content-role`` attribute. The URI should ideally be dereferenceable, but this is not an absolute requirement, and appropriate use of the URI depends on the content-role. This document defines two values for the :raw-latex:`\color{DarkRed}`\ ``content-role`` attribute:
- :raw-latex:`\color{DarkRed}`\ ``content-role``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``doc``\ ``"`` indicates documentation. Dereferencing the URI should yield a document suitable for presentation to the user which describes the LINK’s parent element. If the URI can produce more than one type, a human-readable response must be the default. Appropriate behaviour for a client might be to pass the link to a browser for presentation.
- :raw-latex:`\color{DarkRed}`\ ``content-role``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``type``\ ``"`` indicates a type-like relationship between the URI and the LINK’s parent. The type is named by the URI string itself, while the content retrieved by dereferencing it, if any, is secondary. This content-role value would for instance be appropriate to mark the LINK’s href value as a SKOS concept, e.g.:
::
A :raw-latex:`\color{DarkRed}`\ ``content-role`` should be provided for all :raw-latex:`\color{DarkRed}`\ ``LINK`` elements, but if it is absent, a doc-like role may be assumed. Other values of the :raw-latex:`\color{DarkRed}`\ ``content-role`` attribute may be defined as appropriate outside of this VOTable specification, for instance by the Semantics Working Group or as part of other standards that make use of VOTable.
In addition the :raw-latex:`\color{DarkRed}`\ ``LINK`` element may announce the RFC 2046 media type of the data it references with a :raw-latex:`\color{DarkRed}`\ ``content-type`` attribute (e.g. :raw-latex:`\color{DarkRed}`\ ``content-type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``image/fits``\ ``"``). Although this might be overridden by metadata received during the retrieval operation (e.g. the HTTP Content-Type header) it can serve as a hint to the application about what to expect.
In the Astrores format, from which VOTable is derived, there are additional semantics for the :raw-latex:`\color{DarkRed}`\ ``LINK`` element; the :raw-latex:`\color{DarkRed}`\ ``href`` attribute is used as a template for creating URLs. This behavior is explained in appendix :ref:`VOTable:LINK`, and it represents a possible extension of VOTable.
.. _`VOTable:elem:TABLE`:
3.8 :raw-latex:`\color{DarkRed}`\ ``TABLE`` Element
---------------------------------------------------
The :raw-latex:`\color{DarkRed}`\ ``TABLE`` element represents the basic data structure in VOTable; it comprises a description of the table structure (the *metadata*) essentially in the form of :raw-latex:`\color{DarkRed}`\ ``PARAM`` and :raw-latex:`\color{DarkRed}`\ ``FIELD`` elements (detailed in section :ref:`VOTable:sec:field`), followed by the *values* of the described fields in a :raw-latex:`\color{DarkRed}`\ ``DATA`` element (detailed in section :ref:`VOTable:sec:data`).
The :raw-latex:`\color{DarkRed}`\ ``TABLE`` element is always contained in a :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` element: in other words any :raw-latex:`\color{DarkRed}`\ ``TABLE`` element has a single parent made of the :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` element in which the table is embedded.
The :raw-latex:`\color{DarkRed}`\ ``TABLE`` element contains a :raw-latex:`\color{DarkRed}`\ ``DESCRIPTION`` element for descriptive remarks, followed by a mixed collection of :raw-latex:`\color{DarkRed}`\ ``PARAM``, :raw-latex:`\color{DarkRed}`\ ``FIELD`` or :raw-latex:`\color{DarkRed}`\ ``GROUP`` elements which describe a parameter (constant column), a field (column) or a group of columns respectively. :raw-latex:`\color{DarkRed}`\ ``PARAM`` and :raw-latex:`\color{DarkRed}`\ ``FIELD`` elements are detailed in section :ref:`VOTable:sec:field`, and the :raw-latex:`\color{DarkRed}`\ ``GROUP`` element is presented in section :ref:`VOTable:sec:group`.
Furthermore the :raw-latex:`\color{DarkRed}`\ ``TABLE`` element may contain :raw-latex:`\color{DarkRed}`\ ``LINK`` elements that provide URL-type pointers, exactly like the :raw-latex:`\color{DarkRed}`\ ``LINK`` elements existing within a :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` element (see section :ref:`VOTable:sec:link`).
The last element included in a :raw-latex:`\color{DarkRed}`\ ``TABLE`` is the optional :raw-latex:`\color{DarkRed}`\ ``DATA`` element (see section :ref:`VOTable:sec:data`): a table without any actual data is quite valid, and is typically used to supply a complete description of an existing resource e.g. for query purposes.
The :raw-latex:`\color{DarkRed}`\ ``TABLE`` element may have the naming attributes :raw-latex:`\color{DarkRed}`\ ``name`` and/or :raw-latex:`\color{DarkRed}`\ ``ID`` (see section :ref:`VOTable:sec:name`). A :raw-latex:`\color{DarkRed}`\ ``TABLE`` may also have a :raw-latex:`\color{DarkRed}`\ ``ref`` attribute referencing the ID of another table previously described, which is interpreted as *defining a table having a structure identical to the one referenced*: this facility avoids a repetition of the definition of tables which may be present many times in a VOTable document. It is recommended that the :raw-latex:`\color{DarkRed}`\ ``ref`` attribute references an *empty table* (i.e. a table without a :raw-latex:`\color{DarkRed}`\ ``DATA`` part), which avoids any ambiguity about the referencing.
Finally, the :raw-latex:`\color{DarkRed}`\ ``TABLE`` element may have a :raw-latex:`\color{DarkRed}`\ ``utype`` and :raw-latex:`\color{DarkRed}`\ ``ucd`` attribute to specify the table semantics, similarly to the :raw-latex:`\color{DarkRed}`\ ``FIELD`` and :raw-latex:`\color{DarkRed}`\ ``PARAM`` elements (see section :ref:`VOTable:elem:FIELD`).
.. _`VOTable:sec:field`:
4 :raw-latex:`\color{DarkRed}`\ ``FIELD``s and :raw-latex:`\color{DarkRed}`\ ``PARAM``eters
===========================================================================================
The atoms of the table structure are represented by :raw-latex:`\color{DarkRed}`\ ``FIELD`` and :raw-latex:`\color{DarkRed}`\ ``PARAM`` elements, where :raw-latex:`\color{DarkRed}`\ ``FIELD`` represents the description of an actual table column, while :raw-latex:`\color{DarkRed}`\ ``PARAM`` supplies a value attached to the table, like the :raw-latex:`\color{DarkRed}`\ ``Telescope`` in the example of section :ref:`VOTable:example1`. A :raw-latex:`\color{DarkRed}`\ ``PARAM`` may be viewed as a :raw-latex:`\color{DarkRed}`\ ``FIELD`` which keeps a *constant value* over all the rows of a table, and the only difference in the set of attributes of the two elements is the existence of a :raw-latex:`\color{DarkRed}`\ ``value`` attribute in a :raw-latex:`\color{DarkRed}`\ ``PARAM`` which does not exist in a :raw-latex:`\color{DarkRed}`\ ``FIELD``.
The :raw-latex:`\color{DarkRed}`\ ``FIELD`` elements describe the actual columns of the table; the order in which the :raw-latex:`\color{DarkRed}`\ ``FIELD``s are declared is important, as this order *must* be the same one as the order of the columns in section :ref:`VOTable:sec:data`.
A :raw-latex:`\color{DarkRed}`\ ``FIELD`` or :raw-latex:`\color{DarkRed}`\ ``PARAM`` element may have several sub-elements, including the informational :raw-latex:`\color{DarkRed}`\ ``DESCRIPTION`` and :raw-latex:`\color{DarkRed}`\ ``LINK`` elements (several descriptions and titles are possible, see appendix :ref:`VOTable:sec:addesc`); it may also include a :raw-latex:`\color{DarkRed}`\ ``VALUES`` element that can express limits and ranges of the values that the corresponding cell can contain, such as minimum (:raw-latex:`\color{DarkRed}`\ ``MIN``), maximum (:raw-latex:`\color{DarkRed}`\ ``MAX``), or enumeration of possible values (:raw-latex:`\color{DarkRed}`\ ``OPTION``).
.. _`VOTable:elem:FIELD`:
4.1 Summary of Attributes
-------------------------
:raw-latex:`\label{elem:PARAM}` The valid attributes of a :raw-latex:`\color{DarkRed}`\ ``FIELD`` or :raw-latex:`\color{DarkRed}`\ ``PARAM`` are:
- The :raw-latex:`\color{DarkRed}`\ ``name`` and/or :raw-latex:`\color{DarkRed}`\ ``ID``. The :raw-latex:`\color{DarkRed}`\ ``ID`` attribute is required if the field has to be referenced (see section :ref:`VOTable:sec:name`). It may help to include the ordinal number of the column in the table in the value of the :raw-latex:`\color{DarkRed}`\ ``ID`` attribute as e.g. :raw-latex:`\color{DarkRed}`\ ``ID``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``col3``\ ``"`` when a single table is involved: the connection to the corresponding column would become more obvious, especially in the FITS data serialization which uses the ordinal column number in the keywords containing the metadata related to that column.
- The :raw-latex:`\color{DarkRed}`\ ``datatype``, which expresses the nature of the data that is described as one of the permitted primitives (see Table :ref:`VOTable:primitives` and their exact meaning in section :ref:`VOTable:sec:datatypes`). This attribute determines how data are read and stored internally; it is *required*.
- The :raw-latex:`\color{DarkRed}`\ ``arraysize`` attribute exists when the corresponding table cell contains more than one of the specified datatype, as explained in section :ref:`VOTable:sec:dim`. Note that strings are not a primitive type, and have to be described as an array of characters. The arraysize attribute should be omitted unless the corresponding table cell contents is intended to be understood as an array (see also section :ref:`VOTable:sec:dim`).
- :raw-latex:`\color{black}`The :raw-latex:`\color{DarkRed}`\ ``width`` and :raw-latex:`\color{DarkRed}`\ ``precision`` attributes define the numerical accuracy associated with the data (see section :ref:`VOTable:sec:form`).
- The :raw-latex:`\color{DarkRed}`\ ``xtype`` attribute, added in VOTable 1.2, specifies an *extended* (or *external*) datatype. It is meant to give details about the column contents beyond the primitive :raw-latex:`\color{DarkRed}`\ ``datatype``, like timestamps.
- The :raw-latex:`\color{DarkRed}`\ ``unit`` attribute specifies the units in which the values of the corresponding column are expressed (see section :ref:`VOTable:sec:unit`)
- The :raw-latex:`\color{DarkRed}`\ ``ucd`` attribute supplies a standardized classification of the physical quantity expressed in the column (see section :ref:`VOTable:sec:ucd`).
- The :raw-latex:`\color{DarkRed}`\ ``utype`` attribute, introduced in VOTable 1.1, is meant to express the role of the column in the context of an external data model (see section :ref:`VOTable:sec:utype`).
- The :raw-latex:`\color{DarkRed}`\ ``ref`` attribute is used to quote another element of the document in the definition of a :raw-latex:`\color{DarkRed}`\ ``FIELD`` or :raw-latex:`\color{DarkRed}`\ ``PARAM``. It is used in the example of section :ref:`VOTable:example1` to indicate the coordinate system in which the coordinates are expressed (reference to the :raw-latex:`\color{DarkRed}`\ ``COOSYS`` element which specifies the coordinate frame).
- The :raw-latex:`\color{DarkRed}`\ ``type`` attribute is *not* part of this standard, but is reserved for future extensions (see appendix :ref:`VOTable:LINK`, appendix :ref:`VOTable:query` and appendix :ref:`VOTable:location`).
In addition, in the :raw-latex:`\color{DarkRed}`\ ``PARAM`` element only:
- the :raw-latex:`\color{DarkRed}`\ ``value`` attribute which explicits the :raw-latex:`\color{DarkRed}`\ ``PARAM``eter’s value; :raw-latex:`\color{DarkRed}`\ ``value`` is a required attribute of the :raw-latex:`\color{DarkRed}`\ ``PARAM`` element.
.. _`VOTable:sec:form`:
4.2 Numerical Accuracy
----------------------
The VOTable format is meant for transferring, storing, and processing tabular data, and is not intended for presentation purposes: therefore (in contrast to Astrores) we generally avoid giving rules on presentation, such as formatting. Inevitably however at least some of the data will be presented – either as actual tables, or in forms or graphs, etc. Two attributes were retained for this purpose:
- The :raw-latex:`\color{DarkRed}`\ ``width`` attribute is meant to indicate to the application the number of characters to be used for input or output of the quantity.
- The :raw-latex:`\color{DarkRed}`\ ``precision`` attribute is meant to express the number of significant digits, either as a number of decimal places (e.g. :raw-latex:`\color{DarkRed}`\ ``precision``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``F2``\ ``"`` or equivalently :raw-latex:`\color{DarkRed}`\ ``precision``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``2``\ ``"`` to express 2 significant figures after the decimal point), or as a number of significant figures (e.g. :raw-latex:`\color{DarkRed}`\ ``precision``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``E5``\ ``"`` indicates a relative precision of :math:`10^{-5}`).
The existence and presentation of the special *null* value of a field (when the actual value of the field is unknown) is another aspect of the numerical accuracy, which is part of the :raw-latex:`\color{DarkRed}`\ ``VALUES`` sub-element (see section :ref:`VOTable:sec:values`).
.. _`VOTable:sec:xtype`:
4.3 Extended Datatype :raw-latex:`\color{DarkRed}`\ ``xtype``
-------------------------------------------------------------
The :raw-latex:`\color{DarkRed}`\ ``xtype`` attribute expands the basic datatype primitives (in Table :ref:`VOTable:primitives`) representing the storage units which are valid in any of the VOTable serializations, and corresponds therefore exactly to the *FITS* definitions. It fills the gap between the datatypes known by FITS and those required to express queries (Astronomical Data Query Language or ADQL, :doc:`ADQL <../ADQL/ADQL>`) and their results in tabular form (Table Access Protocol or TAP, :cite:t:`2010ivoa.spec.0327D`).
As an example, setting :raw-latex:`\color{DarkRed}`\ ``xtype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``timestamp``\ ``"`` instructs VOTable parsers to interpret a string as a *timestamp* (an instant in an absolute time frame), materialized by a UTC date/time string following the ISO-8601 standard (``YYYY-MM-DDThh:mm:ss`` eventually followed by a decimal point and fractions of seconds). Supporting parsers might then expose the corresponding values in whatever way appropriate for such timestamps in the host language. VOTables software does not need to interpret xtypes, but it should preserve them when doing round-trips.
The IVOA recommendation Data Access Layer Interface DALI :doc:`ref <../DALI/DALI>` defines the common values of :raw-latex:`\color{DarkRed}`\ ``xtype`` and the literals of conforming column values.
.. _`VOTable:sec:unit`:
4.4 Units
---------
The quantities in a column of the table may be expressed in some physical unit, which is specified by the :raw-latex:`\color{DarkRed}`\ ``unit`` attribute of the :raw-latex:`\color{DarkRed}`\ ``FIELD``. The syntax of the *unit* string SHOULD conform to the VOUnits specification, :cite:t:`2023ivoa.spec.1215G`; this requires a string without blanks or spaces where multiplication is indicated by the symbol “``.``”, division by the symbol “``/``” and exponentiation by the symbol “``*``”. Examples are :raw-latex:`\color{DarkRed}`\ ``unit``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``m**2``\ ``"`` for m\ :math:`^2`, :raw-latex:`\color{DarkRed}`\ ``unit``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``cm**-2.s**-1.keV**-1``\ ``"`` for cm\ :math:`^{-2}`\ s\ :math:`^{-1}`\ keV\ :math:`^{-1}`, or :raw-latex:`\color{DarkRed}`\ ``unit``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``m/s``\ ``"`` for m s\ :math:`^{-1}`.
.. _`VOTable:sec:ucd`:
4.5 Unified Content Descriptors
-------------------------------
The Unified Content Descriptors (UCD) can be viewed as a hierarchical glossary of the scientific meanings of the data contained in the astronomical tables. Two versions of UCDs have been developed: the initial version (UCD1) created at CDS, which uses atomic words separated by underscores (e.g. ``POS_EQ_RA_MAIN``); and a more flexible one, UCD1+ :cite:p:`2023ivoa.spec.0125C`, developed in the frame of the IVOA Semantics Working Group, which uses a reduced vocabulary of dot-separated atoms which can be combined with semi-colons (e.g. ``pos.eq.ra;meta.main``). UCD1+ usage is recommended, but applications using the older vocabulary are still acceptable in this version of VOTable.
:raw-latex:`\noindent `A few typical examples of UCD1+ definitions are:
+-----------------------------------------------------------+-------------------------------+
| ``"``\ :raw-latex:`\color`phot.mag;em.opt.B\ ``"`` | Blue magnitude |
+-----------------------------------------------------------+-------------------------------+
| ``"``\ :raw-latex:`\color`src.orbital.eccentricity\ ``"`` | Orbital eccentricity |
+-----------------------------------------------------------+-------------------------------+
| ``"``\ :raw-latex:`\color`time.period;stat.median\ ``"`` | Median Value of the Period |
+-----------------------------------------------------------+-------------------------------+
| ``"``\ :raw-latex:`\color`instr.det.qe\ ``"`` | Detector’s Quantum Efficiency |
+-----------------------------------------------------------+-------------------------------+
.. _`VOTable:sec:utype`:
4.6 The :raw-latex:`\color{DarkRed}`\ ``utype`` Attribute
---------------------------------------------------------
In many contexts, it is important to specify that :raw-latex:`\color{DarkRed}`\ ``FIELD``s or :raw-latex:`\color{DarkRed}`\ ``PARAM``eters convey the values defined in an external *data model*. For instance, it can be fundamental for an application to be aware that a given :raw-latex:`\color{DarkRed}`\ ``FIELD`` expresses *the* surface brightness measured with a specific filter and within a :math:`12\times6\,\textrm{arcsec}` elliptical aperture. None of the other :raw-latex:`\color{DarkRed}`\ ``name``, :raw-latex:`\color{DarkRed}`\ ``ID`` or :raw-latex:`\color{DarkRed}`\ ``ucd`` attributes can fill this role, and the :raw-latex:`\color{DarkRed}`\ ``utype`` (usage-specific or *unique* type) attribute was introduced in VOTable 1.1 to fill this gap. By extension, most elements may refer to some external data model, and the :raw-latex:`\color{DarkRed}`\ ``utype`` attribute is also legal in :raw-latex:`\color{DarkRed}`\ ``RESOURCE``, :raw-latex:`\color{DarkRed}`\ ``TABLE`` and :raw-latex:`\color{DarkRed}`\ ``GROUP`` elements.
Note that the :raw-latex:`\color{DarkRed}`\ ``utype`` attribute is *not* an XML QName. This means that even when utypes are written with colons (e.g., ``adhoc:service``), whatever is in front of the colon has no relationship to XML namespace URIs. In other words, utypes are opaque strings (except, where defined that way by standards using them, for case-folding).
.. _`VOTable:sec:values`:
4.7 :raw-latex:`\color{DarkRed}`\ ``VALUES`` Element
----------------------------------------------------
The :raw-latex:`\color{DarkRed}`\ ``VALUES`` element of the :raw-latex:`\color{DarkRed}`\ ``FIELD`` is designed to hold subsidiary information about the *domain* of the data. For instance, in the example (section :ref:`VOTable:example1`) we could rewrite the RA field definition as:
.. raw:: latex
\begingroup
.. raw:: latex
\small
::
.. raw:: latex
\endgroup
:raw-latex:`\noindent `The scope of the domain described by the :raw-latex:`\color{DarkRed}`\ ``VALUES`` element (and by its :raw-latex:`\color{DarkRed}`\ ``MIN``, :raw-latex:`\color{DarkRed}`\ ``MAX`` and :raw-latex:`\color{DarkRed}`\ ``OPTION`` sub-elements) can be qualified by :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``actual``\ ``"``, if it is valid only for the data enclosed in the parent :raw-latex:`\color{DarkRed}`\ ``TABLE``; the default :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``legal``\ ``"`` qualification specifies the generic domain of valid values, as in the *RAdomain* in the example above where the interval :math:`[0,360[` is specified.
:raw-latex:`\label{elem:VALUES}` :raw-latex:`\label{elem:MIN}` :raw-latex:`\label{elem:MAX}` :raw-latex:`\label{elem:OPTION}` The :raw-latex:`\color{DarkRed}`\ ``VALUES`` element may contain :raw-latex:`\color{DarkRed}`\ ``MIN`` and :raw-latex:`\color{DarkRed}`\ ``MAX`` elements, and it may contain :raw-latex:`\color{DarkRed}`\ ``OPTION`` elements; the latter may itself contain more :raw-latex:`\color{DarkRed}`\ ``OPTION`` elements, so that a hierarchy of keyword-values pairs can be associated with each field. Note that only a single pair :raw-latex:`\color{DarkRed}`\ ``MIN`` / :raw-latex:`\color{DarkRed}`\ ``MAX`` is possible, whereas many :raw-latex:`\color{DarkRed}`\ ``OPTION`` elements may be used to qualify the domain described by the :raw-latex:`\color{DarkRed}`\ ``VALUES`` element. The domain may therefore be defined as a single interval, or as a set of individual values. Although the schema does not forbid all three :raw-latex:`\color{DarkRed}`\ ``MIN``, :raw-latex:`\color{DarkRed}`\ ``MAX`` and :raw-latex:`\color{DarkRed}`\ ``OPTION`` sub-elements simultanesouly, such usage is considered as bad practice and is discouraged.
All three :raw-latex:`\color{DarkRed}`\ ``MIN``, :raw-latex:`\color{DarkRed}`\ ``MAX`` and :raw-latex:`\color{DarkRed}`\ ``OPTION`` sub-elements store their value corresponding to the minimum, maximum, or “special value” in a :raw-latex:`\color{DarkRed}`\ ``value`` attribute. :raw-latex:`\color{DarkRed}`\ ``MIN`` and :raw-latex:`\color{DarkRed}`\ ``MAX`` elements can have an :raw-latex:`\color{DarkRed}`\ ``inclusive`` attribute to specify whether the :raw-latex:`\color{DarkRed}`\ ``value`` quoted belongs to the domain or not, and the :raw-latex:`\color{DarkRed}`\ ``OPTION`` element can have a :raw-latex:`\color{DarkRed}`\ ``name`` attribute to describe the “special” quoted :raw-latex:`\color{DarkRed}`\ ``value``.
Unless a :raw-latex:`\color{DarkRed}`\ ``FIELD`` has a nonempty :raw-latex:`\color{DarkRed}`\ ``xtype``, the value of the :raw-latex:`\color{DarkRed}`\ ``value`` attribute always is a single TABLEDATA literal of the datatype and gives a global limit for all cells of the array; arrays are conceptually homogeneous in VOTable. When the parent of a :raw-latex:`\color{DarkRed}`\ ``VALUES`` element does have an :raw-latex:`\color{DarkRed}`\ ``xtype``, special rules apply; clients should only try to parse limits of xtyped fields when they know the xtype. For instance, with:
::
:raw-latex:`\noindent `both the single value of *flux* and all items in the *fluxes* array are declared as being between 0 and :math:`10^{-4}`, and clients could, for instance, raise warnings if they are not. In the last example, *CIRCLE*, clients not familiar with :raw-latex:`\color{DarkRed}`\ ``xtype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``circle``\ ``"`` would ignore the MAX declaration. Clients familiar with this xtype’s particular interpretation of MAX would learn about a spatial coverage of a spherical circle with radius two degrees around the point :math:`(312.5^\circ,-41^\circ)`; see the SODA specification :cite:p:`2017ivoa.spec.0517B` for the context of this particular example.
The :raw-latex:`\color{DarkRed}`\ ``VALUES`` element may also have a :raw-latex:`\color{DarkRed}`\ ``null`` attribute to define a non-standard value that is used to specify *“non-existent data”* – for example :raw-latex:`\color{DarkRed}`\ ``null``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``-32768``\ ``"``. When this value is found in the corresponding data, it is assumed that no data exists for that table cell; the parser may also choose to use this when unparsable data is found, and the null value will be substituted instead. The value of the :raw-latex:`\color{DarkRed}`\ ``null`` attribute must follow the same rules as the TABLEDATA serialization for the appropriate datatype described in section :ref:`VOTable:sec:datatypes`, and may never contain an array value. This mechanism is only intended for use with integer types; it should not be used for floating point types, which can use NaN instead.
This mechanism for representing null values is required for integer columns in the :raw-latex:`\color{DarkRed}`\ ``BINARY`` serialization. Since VOTable 1.3 however other mechanisms are available for representing null values in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` and :raw-latex:`\color{DarkRed}`\ ``BINARY2`` serializations. Representation of nulls using the :raw-latex:`\color{DarkRed}`\ ``VALUES`` element and otherwise is discussed further in section :ref:`VOTable:sec:NULL`.
Finally the :raw-latex:`\color{DarkRed}`\ ``ref`` attribute of a :raw-latex:`\color{DarkRed}`\ ``VALUES`` element can be used to avoid a repetition of the domain definition, by referring to a previously defined :raw-latex:`\color{DarkRed}`\ ``VALUES`` element having the referenced :raw-latex:`\color{DarkRed}`\ ``ID`` attribute. When specified, the :raw-latex:`\color{DarkRed}`\ ``ref`` attribute completely defines the domain without any other element or attribute, e.g. :raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``VALUES``\ ````\ :raw-latex:`\color{DarkRed}`\ ``ref``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``RAdomain``\ ``"``:raw-latex:`\color{blue}`\ ``/``:raw-latex:`\color{blue}`\ ``>``.
.. _`VOTable:elem:INFO`:
4.8 :raw-latex:`\color{DarkRed}`\ ``INFO`` Element
--------------------------------------------------
The :raw-latex:`\color{DarkRed}`\ ``INFO`` element is a :raw-latex:`\color{DarkRed}`\ ``PARAM`` element restricted to be of type *string* (i.e. :raw-latex:`\color{DarkRed}`\ ``datatype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``char``\ ``"`` and :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``*``\ ``"`` are *implied*). It *must* also have a :raw-latex:`\color{DarkRed}`\ ``name`` attribute, and *may* have the other attributes allowed in a :raw-latex:`\color{DarkRed}`\ ``PARAM``: :raw-latex:`\color{DarkRed}`\ ``ID``, :raw-latex:`\color{DarkRed}`\ ``ref``, :raw-latex:`\color{DarkRed}`\ ``unit``, :raw-latex:`\color{DarkRed}`\ ``ucd`` and :raw-latex:`\color{DarkRed}`\ ``utype``. But unlike :raw-latex:`\color{DarkRed}`\ ``PARAM``, :raw-latex:`\color{DarkRed}`\ ``INFO`` does not accept sub-elements: only text is acceptable in :raw-latex:`\color{DarkRed}`\ ``INFO``’s body. This limitation ensures full compatibility with the previous versions of VOTable.
:raw-latex:`\color{DarkRed}`\ ``INFO`` is meant to convey informative details about the generation of the VOTABLE document. It may be present at the beginning or end of :raw-latex:`\color{DarkRed}`\ ``VOTABLE`` or :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` elements, or at the end of a :raw-latex:`\color{DarkRed}`\ ``TABLE``. Typical uses of :raw-latex:`\color{DarkRed}`\ ``INFO`` include error reports, or explanations about choices made by the data processing system which generates the VOTable document.
.. _`VOTable:sec:group`:
4.9 :raw-latex:`\color{DarkRed}`\ ``GROUP``ing :raw-latex:`\color{DarkRed}`\ ``FIELD``s and :raw-latex:`\color{DarkRed}`\ ``PARAM``eters
----------------------------------------------------------------------------------------------------------------------------------------
:raw-latex:`\label{elem:GROUP}` :raw-latex:`\label{elem:FIELDref}` :raw-latex:`\label{elem:PARAMref}`
The :raw-latex:`\color{DarkRed}`\ ``GROUP`` element is used to group together a set of :raw-latex:`\color{DarkRed}`\ ``FIELD``s and :raw-latex:`\color{DarkRed}`\ ``PARAM``s which are logically connected, like a value and its error. The :raw-latex:`\color{DarkRed}`\ ``FIELD``s are always defined *outside* any group, and the :raw-latex:`\color{DarkRed}`\ ``GROUP`` designates its member fields via :raw-latex:`\color{DarkRed}`\ ``FIELDref`` elements.
A simple example of a group made of the velocity and its error, based on the example of section :ref:`VOTable:example1`, can be the following:
.. raw:: latex
\begingroup
::
Velocity and its error
.. raw:: latex
\endgroup
The :raw-latex:`\color{DarkRed}`\ ``GROUP`` element can have the :raw-latex:`\color{DarkRed}`\ ``name``, :raw-latex:`\color{DarkRed}`\ ``ID``, :raw-latex:`\color{DarkRed}`\ ``ucd``, :raw-latex:`\color{DarkRed}`\ ``utype`` and :raw-latex:`\color{DarkRed}`\ ``ref`` attributes. It can include a :raw-latex:`\color{DarkRed}`\ ``DESCRIPTION``, and any mixture of :raw-latex:`\color{DarkRed}`\ ``FIELDref``erences, :raw-latex:`\color{DarkRed}`\ ``PARAM``eters, :raw-latex:`\color{DarkRed}`\ ``PARAMref``erences and other :raw-latex:`\color{DarkRed}`\ ``GROUP``s. :raw-latex:`\color{DarkRed}`\ ``PARAMref`` is a *logical* definition of a parameter that refers to a :raw-latex:`\color{DarkRed}`\ ``PARAM`` element defined elsewhere in the parent :raw-latex:`\color{DarkRed}`\ ``TABLE`` or :raw-latex:`\color{DarkRed}`\ ``RESOURCE``; similarly the :raw-latex:`\color{DarkRed}`\ ``FIELDref`` element defined by referring to a :raw-latex:`\color{DarkRed}`\ ``FIELD`` element defined elsewhere in the parent :raw-latex:`\color{DarkRed}`\ ``TABLE``. The recursivity of the :raw-latex:`\color{DarkRed}`\ ``GROUP`` element enables a definition of arbitrarily complex structures.
The possibility of adding :raw-latex:`\color{DarkRed}`\ ``PARAM``eters in groups also introduces a possibility of associating parameter(s) to accurately describe the context of the data stored in the table. For instance, it is possible to associate the actual frequency of a radio survey with a table of flux measurements using the following declaration:
::
Flux measured at 352MHz
Similarly, :raw-latex:`\color{DarkRed}`\ ``GROUP`` can be used to associate several parameters to one or several :raw-latex:`\color{DarkRed}`\ ``FIELD``s. For example, a filter may be characterized by the central wavelength and the FWHM of its transmission curve, or several parameters of an instrument setup may be described.
.. _`VOTable:sec:relation`:
4.10 The Relational Context
---------------------------
With a simple naming convention, the :raw-latex:`\color{DarkRed}`\ ``GROUP`` element may also specify some properties of the tables included in a VOTable document when a :raw-latex:`\color{DarkRed}`\ ``TABLE`` is viewed as a *relation* (part of a a relational database):
- A :raw-latex:`\color{DarkRed}`\ ``GROUP`` element having the :raw-latex:`\color{DarkRed}`\ ``name``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``primaryKey``\ ``"`` attribute defines the *primary key* of the relation by enumerating the ordered list of :raw-latex:`\color{DarkRed}`\ ``FIELDref``s that make up the *primary key* of the table;
- A :raw-latex:`\color{DarkRed}`\ ``GROUP`` element having the :raw-latex:`\color{DarkRed}`\ ``name``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``foreignKey``\ ``"`` attribute, with a :raw-latex:`\color{DarkRed}`\ ``ref``\ ``="``\ :raw-latex:`\color{DarkPurple}{\rm\em table\_reference}`\ ``"`` reference of the table having the associated primary ley, similarly enumerates the :raw-latex:`\color{DarkRed}`\ ``FIELDref``s of the *foreign key*;
- A :raw-latex:`\color{DarkRed}`\ ``GROUP`` element having the :raw-latex:`\color{DarkRed}`\ ``name``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``order``\ ``"`` attribute may specify how the data are ordered.
:raw-latex:`\noindent `Similar conventions could be added for the existence of indexes, unique values, etc.
.. _`VOTable:sec:data`:
5 Data Content
==============
While the bulk of the metadata of a VOTable document is in the :raw-latex:`\color{DarkRed}`\ ``FIELD`` elements, the data content of the table is in a single :raw-latex:`\color{DarkRed}`\ ``DATA`` element. The data is organized in “reading" order, so that the content of each row appears in the same order as the order of the :raw-latex:`\color{DarkRed}`\ ``FIELD`` definitions.
:raw-latex:`\label{Image1}`
.. figure:: serial.png
:alt:
Each :raw-latex:`\color{DarkRed}`\ ``DATA`` part of the VOTable document can be viewed as a stream coming out of a pipeline. The abstract table is first serialized by one of several methods, then it may be encoded for compression or other reasons. The result may be embedded in the XML file (*local* data), or it may be *remote* data.
Figure :ref:`VOTable:fig:serialization` shows how the abstract table is rendered into the VOTable document. First the data is *serialized*, either as XML, a FITS binary table, or the VOTable Binary format. This data stream may then be *encoded*, perhaps for compression or to convert binary to text. Finally, the data stream may be put in a remote file with a URL-type pointer in the VOTable document; or the table data may be embedded in the VOTable.
The serialization elements and their attributes are described in the next sections.
.. _`VOTable:sec:TABLEDATA`:
5.1 :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` Serialization
-------------------------------------------------------------
:raw-latex:`\label{elem:TD}` :raw-latex:`\label{elem:TR}`
The :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` element is a way to build the table in pure XML, and has the advantage that XML tools can manipulate and present the table data directly. The :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` element contains :raw-latex:`\color{DarkRed}`\ ``TR`` elements, which in turn contain :raw-latex:`\color{DarkRed}`\ ``TD`` elements — i.e. the same conventions as in HTML. The number of :raw-latex:`\color{DarkRed}`\ ``TD`` elements in each :raw-latex:`\color{DarkRed}`\ ``TR`` element must be equal to the number of :raw-latex:`\color{DarkRed}`\ ``FIELD`` elements declaring the table. An example is contained in section :ref:`VOTable:example1`, surrounded by the :raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``TABLEDATA``:raw-latex:`\color{blue}`\ ``>`` and :raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}{\color{blue}/}`\ ``TABLEDATA``:raw-latex:`\color{blue}`\ ``>`` delimiters.
Each item in the :raw-latex:`\color{DarkRed}`\ ``TD`` tag contains a value which must be compatible with the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute of the corresponding :raw-latex:`\color{DarkRed}`\ ``FIELD`` definition. If the value is the same as the :raw-latex:`\color{DarkRed}`\ ``null`` value for that field (see section :ref:`VOTable:sec:values`) then the item is assumed to contain no data. Valid representations of values in a cell, depending on their :raw-latex:`\color{DarkRed}`\ ``datatype``, are detailed in section :ref:`VOTable:sec:datatypes`. If the :raw-latex:`\color{DarkRed}`\ ``TD`` element is empty (``
`` or ``
``) the cell is considered to contain no data, i.e. to be null.
If a cell contains an array of numbers or a complex number, it should be encoded as multiple numbers separated by whitespace. However in the case of character and Unicode strings (declared in the corresponding :raw-latex:`\color{DarkRed}`\ ``FIELD`` as an array of *char* or *unicodeChar* datatype), no separator should exist. Here is an example of a two-row table that has arrays in the table cells:
.. raw:: latex
\begingroup
.. raw:: latex
\small
:raw-latex:`\label{example2}`
::
Apple
1 2 4 8 16
1.62 4.56 3.44
Orange
15
23 -11 9
2.33 4.66 9.53
.. raw:: latex
\endgroup
The first entry is a fixed-length array of 10 characters; since the value being presented (``Apple``) has 5 characters, this is padded with trailing blanks. The second cell is a short integer but has a null value, as indicated by the empty :raw-latex:`\color{DarkRed}`\ ``TD`` element. The third cell contains a variable-length array of integers. The last cell contains a fixed-length array of three floats.
A special notice should be mentioned about the significance of *white space* in a table cell (the term *white space* designates the characters *space* [``x20``], *tab* [``x09``], *newline* [``x0a``], *carriage-return* [``x0d``]): while for numeric data types the amount of white spaces does not matter (the elements of an array of numbers may for instance be written on several lines), the white space is significant for ``"``\ :raw-latex:`\color{DarkPurple}`char\ ``"`` or ``"``\ :raw-latex:`\color{DarkPurple}`unicodeChar\ ``"`` datatypes, and for instance :raw-latex:`\color{DarkPurple}`\ ``
Apple
`` and :raw-latex:`\color{DarkPurple}`\ ``
Apple
`` are *not* identical.
.. _`VOTable:sec:FITS`:
5.2 :raw-latex:`\color{DarkRed}`\ ``FITS`` Serialization
--------------------------------------------------------
:raw-latex:`\label{elem:FITS}`
The FITS format for binary tables :cite:p:`std:FITS` is in widespread use in astronomy, and its structure has had a major influence on the VOTable specification. Metadata is stored in a header section, followed by the data. The metadata is essentially equivalent to the metadata of the VOTable format. One important difference is that VOTable does not require specification of the number of rows in the table, an important advantage if the table is being created dynamically from a stream.
The VOTable specification does not define the behavior of parsers with respect to this doubling of the metadata. A parser may ignore the FITS metadata, or it may compare it with the VOTable metadata for consistency, or other possibilities.
The following code shows a fragment that might have been created by a FITS-to-VOTable converter. Each FITS keyword has been converted to a :raw-latex:`\color{DarkRed}`\ ``PARAM``, and the data itself is remotely stored and gzipped at an FTP site:
:raw-latex:`\bgroup `
.. raw:: latex
\small
| :raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``RESOURCE``:raw-latex:`\color{blue}`\ ``>``
| :raw-latex:`\hspace*{0.5em}{\tt\color{blue}<}{\tt{\color{DarkRed}INFO} {\tt{\color{DarkRed}name}="{\color{DarkPurple}HISTORY}"}
{\tt{\color{DarkRed}value}="{\color{DarkPurple}Virtual Telescope observation made in 2002}"}{\color{blue}/}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{0.5em}{\tt\color{blue}<}{\tt{\color{DarkRed}PARAM} {\tt{\color{DarkRed}name}="{\color{DarkPurple}EPOCH}"} {\tt{\color{DarkRed}datatype}="{\color{DarkPurple}float}"}
{\tt{\color{DarkRed}value}="{\color{DarkPurple}1999.987}"}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{1em}{\tt\color{blue}<}{\tt{\color{DarkRed}DESCRIPTION}}{\tt\color{blue}>}` Original Epoch of the coordinates:raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}{\color{blue}/}`\ ``DESCRIPTION``:raw-latex:`\color{blue}`\ ``>``
| :raw-latex:`\hspace*{0.5em}{\tt\color{blue}<}{\tt{\color{DarkRed}{\color{blue}/}PARAM}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{0.5em}{\tt\color{blue}<}{\tt{\color{DarkRed}PARAM} {\tt{\color{DarkRed}name}="{\color{DarkPurple}TELESCOP}"} {\tt{\color{DarkRed}datatype}="{\color{DarkPurple}char}"}
{\tt{\color{DarkRed}arraysize}="{\color{DarkPurple}*}"} {\tt{\color{DarkRed}value}="{\color{DarkPurple}VTel}"} {\color{blue}/}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{0.5em}{\tt\color{blue}<}{\tt{\color{DarkRed}TABLE}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{1.0em}{\tt\color{blue}<}{\tt{\color{DarkRed}FIELD}{\rm\em\quad(insert field metadata here)} {\color{blue}/}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{1.0em}{\tt\color{blue}<}{\tt{\color{DarkRed}DATA}}{\tt\color{blue}>}{\tt\color{blue}<}{\tt{\color{DarkRed}FITS} {\tt{\color{DarkRed}extnum}="{\color{DarkPurple}2}"}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{1.5em}{\tt\color{blue}<}{\tt{\color{DarkRed}STREAM} {\tt{\color{DarkRed}encoding}="{\color{DarkPurple}gzip}"}
{\tt{\color{DarkRed}href}="{\color{DarkPurple}ftp://archive.cacr.caltech.edu/myfile.fit.gz}"}{\color{blue}/}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{1.0em}{\tt\color{blue}<}{\tt{\color{DarkRed}{\color{blue}/}FITS}}{\tt\color{blue}>}{\tt\color{blue}<}{\tt{\color{DarkRed}{\color{blue}/}DATA}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{0.5em}{\tt\color{blue}<}{\tt{\color{DarkRed}{\color{blue}/}TABLE}}{\tt\color{blue}>}`
| :raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}{\color{blue}/}`\ ``RESOURCE``:raw-latex:`\color{blue}`\ ``>``
.. raw:: latex
\egroup
The FITS file may contain many data objects (known as extensions, numbered from 1 up, the main header being numbered 0), and the :raw-latex:`\color{DarkRed}`\ ``extnum`` attribute allows the VOTable to point to one of these.
.. _`VOTable:sec:BIN`:
5.3 :raw-latex:`\color{DarkRed}`\ ``BINARY`` Serialization
----------------------------------------------------------
The binary format is intended to be easy to read by parsers, so that additional libraries are not required. It is just a sequence of bytes with the length of each sequence corresponding to the :raw-latex:`\color{DarkRed}`\ ``datatype`` and :raw-latex:`\color{DarkRed}`\ ``arraysize`` attributes of the :raw-latex:`\color{DarkRed}`\ ``FIELD`` elements in the metadata. The binary format consists of a sequence of records with no header bytes, no alignment considerations, and no block sizes. The order of the bytes in multi-byte primitives (e.g. integers, floating-point numbers) is Most Significant Byte first, i.e., it follows the FITS convention.
Table cells may contain arrays of primitive types, each of which may be of fixed or variable length. In the former case, the number of bytes is the same for each instance of the item, as specified by the :raw-latex:`\color{DarkRed}`\ ``arraysize`` attribute of the :raw-latex:`\color{DarkRed}`\ ``FIELD``. If all the fields have a fixed :raw-latex:`\color{DarkRed}`\ ``arraysize``, then each record of the binary format has the same length (the sum of :raw-latex:`\color{DarkRed}`\ ``arraysize`` times the length in bytes of the corresponding :raw-latex:`\color{DarkRed}`\ ``datatype``).
Variable-length arrays of primitives are preceded by a 4-byte integer containing the number of items of the array. The parser can then compute the number of bytes taken by the variable-length array by multiplying the size and number of the primitives.
The way the stream of bytes is arranged for the data of the example in section :ref:`VOTable:example2` is illustrated in Figure :ref:`VOTable:fig:bin`. In this case the second column must be declared like this:
::
to indicate a magic value representing nulls, since no equivalent of the empty :raw-latex:`\color{DarkRed}`\ ``TD`` element is available for the BINARY serialization (see section :ref:`VOTable:sec:NULL`).
:raw-latex:`\label{Image2}`
.. container:: center
.. figure:: binary.pdf
:alt:
The BINARY serialization has been available in all versions of VOTable. From VOTable 1.3 however, the alternative BINARY2 serialization is an alternative, providing more straightforward null-flagging capabilities. In VOTable 1.3 and above BINARY remains a legal serialization, but for most purposes VOTable producers are advised to use BINARY2 instead.
.. _`VOTable:sec:BIN2`:
5.4 :raw-latex:`\color{DarkRed}`\ ``BINARY2`` Serialization
-----------------------------------------------------------
The BINARY2 format, introduced at VOTable 1.3, is the same as BINARY, but with null entries flagged explicitly rather than identified by their values. The byte stream contains one additional bit for each table cell indicating whether that cell’s value is to be considered null or not.
The byte content for each row consists of zero or more bytes containing a null value flag for each cell in the row, followed by the bytes for the BINARY serialization as described in the previous subsection. The null flags are stored as exactly one bit per table column, and the number of flag bytes is the smallest required for this purpose; the number of flag bytes per row for an :math:`N`-column table will therefore be the integer part of :math:`(N+7)/8`. The most significant bit of the first flag byte corresponds to the first column, the second most significant bit of the first flag byte to the second column, the most significant bit of the second flag byte to the eighth column, and so on. A set (1) bit indicates that the corresponding cell is null, and an unset (0) bit indicates that its value is not null. Unused bits will be at the less-significant end of the final flag byte, and shall be unset (0).
It is recommended, but not required, that a cell value flagged as null is filled with the NaN value for floating point or complex datatypes, and zero-valued bytes for other datatypes. It is particularly recommended that a variable length array cell value flagged as null is represented as 4 zero-valued bytes, indicating a zero-length value.
The way the stream of bytes is arranged for the data of the example in section :ref:`VOTable:example2` is illustrated in Figure :ref:`VOTable:fig:bin2`.
:raw-latex:`\label{Image3}`
.. container:: center
.. figure:: binary2.pdf
:alt:
.. _`VOTable:sec:NULL`:
5.5 Null values
---------------
VOTable provides two approaches to representing null values in data.
The first approach makes use of the :raw-latex:`\color{DarkRed}`\ ``VALUES`` element’s :raw-latex:`\color{DarkRed}`\ ``null`` attribute to indicate that whenever a particular “magic” value is encountered in a column’s data, that entry should be considered as null. This magic value must represent a legal scalar value for the column’s datatype, for instance in the case of :raw-latex:`\color{DarkRed}`\ ``datatype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``unsignedByte``\ ``"`` it must be an integer in the range 0–255. This approach, inherited from FITS, works in the same way for all of the defined VOTable serializations. However it can present difficulties when generating VOTables, since the magic value must be distinct from all actual data values in the column, and must be chosen before the column data has been written, since the :raw-latex:`\color{DarkRed}`\ ``FIELD`` element precedes the :raw-latex:`\color{DarkRed}`\ ``DATA``.
The second approach, introduced at VOTable 1.3, is to mark null values using some mechanism external to the data itself, and it works differently for the different serializations. In the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization an empty :raw-latex:`\color{DarkRed}`\ ``TD`` element signals a null value, and in the :raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization a separate null-ness flag is provided for each cell. The :raw-latex:`\color{DarkRed}`\ ``BINARY`` and :raw-latex:`\color{DarkRed}`\ ``FITS`` serializations do not support this approach at all. It should be noted that when using this approach, unlike with magic values, the different serializations do not have identical capabilities for representing data, so that lossless round-tripping between serializations is not always possible.
Some other subtleties concerning null values should also be mentioned:
- The only way to mark as null individual elements of an array-valued cell is by use of the magic value mechanism, which operates on a per-element basis. Although the magic value approach can mark individual elements of an array as null, it cannot mark a whole multi-element array as null.
- In TABLEDATA array-valued columns, a null value and a zero-length array are not distinguished. Since strings are represented as arrays of characters, this also means that empty and null strings are not distinguished.
- In either approach, floating point values not formally marked as nulls may take the value NaN (not-a-number), represented by the string “NaN” or by a suitable IEEE bit pattern as appropriate. This option is suitable for scalar, complex, and array-valued columns. For most purposes, the distinction between NaN and null is not significant, and VOTable implementations are not required to distinguish these cases. However, the BINARY2 encoding does provide the option to represent them differently for specialised applications where that is desirable.
- The magic value mechanism, as in FITS, is only intended for integer values. Historically it has not been explicitly forbidden for floating point values, but such use is strongly deprecated in favour of the use of NaN.
- Combining the two approaches is not encouraged, and use of the :raw-latex:`\color{DarkRed}`\ ``VALUES`` :raw-latex:`\color{DarkRed}`\ ``null`` attribute is deprecated where it can be avoided (marking null cells in TABLEDATA and BINARY2 serializations in VOTable 1.3 and above). However, if it is present, the :raw-latex:`\color{DarkRed}`\ ``VALUES`` :raw-latex:`\color{DarkRed}`\ ``null`` attribute must always be respected.
- The *boolean* datatype has its own arrangements for representing null which do not require use of either of the special approaches above.
.. _`VOTable:elem:STREAM`:
5.6 Data Encoding
-----------------
As a result of the serialization, the table has been converted to a byte stream, either text or binary. If the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization is used, then the table is represented as XML tags directly embedded in the document, and conventional tools can be used to encode the entire XML document. However, VOTable also provides limited encoding of its own. A VOTable document may point to a remote data resource that is compressed; rather than decompressing before sending on the wire, it can be dynamically decoded by the VOTable reader. We might also use the encoding facilities to convert a binary file to text (through base64 encoding), so that binary data can be used in the XML document.
In this version of VOTable, it is not possible to encode individual columns of the table: the whole table must be encoded in the same way. However, the possibility of encoding selected table cells is being examined for future versions of VOTable (see appendix :ref:`VOTable:sec:b64`).
In order to use an encoding of the data, it must be enclosed in a :raw-latex:`\color{DarkRed}`\ ``STREAM`` element, whose attributes define the nature of the encoding. The :raw-latex:`\color{DarkRed}`\ ``encoding`` attribute is a string that should indicate to the parser how to undo the encoding that has been applied. Parsers should understand and interpret at least the following values:
- :raw-latex:`\color{DarkRed}`\ ``encoding``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``gzip``\ ``"`` [RFC1952] implies that the data following has been compressed with the *gzip* filter, so that *gunzip* or similar should be applied.
- :raw-latex:`\color{DarkRed}`\ ``encoding``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``base64``\ ``"`` [RFC2045] implies that the *base64* filter has been applied, to convert binary to text.
- :raw-latex:`\color{DarkRed}`\ ``encoding``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``dynamic``\ ``"`` implies that the data is in a remote resource (see below), and the encoding will be delivered with the header of the data. This occurs with the http protocol, where the MIME header indicates the type of encoding that has been used.
:raw-latex:`\noindent `The default value of the encoding attribute is the null string, meaning that no encoding has been applied. In future releases, we might allow more complex strings in the encoding attribute, allowing combinations of encoding filters and a way for the parser to find the software needed for the decoding.
Note that for inline streamed data (a :raw-latex:`\color{DarkRed}`\ ``STREAM`` with no :raw-latex:`\color{DarkRed}`\ ``href`` attribute) it is effectively required to use :raw-latex:`\color{DarkRed}`\ ``encoding``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``base64``\ ``"``, since of the available options only base64 will ensure that binary data is encoded as legal XML content.
.. _`VOTable:remote-data`:
5.7 Remote Data
---------------
If the encoding of the data produces text, or if the serialization is naturally text-based, then it can be directly embedded into the XML document: :raw-latex:`\bgroup `
.. raw:: latex
\hspace*{0.5em}{\tt\color{blue}<}{\tt{\color{DarkRed}DATA}}{\tt\color{blue}>}{\tt\color{blue}<}{\tt{\color{DarkRed}BINARY}}{\tt\color{blue}>}
|
| :raw-latex:`\hspace*{1em}{\tt\color{blue}<}{\tt{\color{DarkRed}STREAM} {\tt{\color{DarkRed}encoding}="{\color{DarkPurple}base64}"}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{1.5em}{\tt
\verb+AAAAAj/yVZiDGSSUwFZ6ypR4yGkADwAcQV0euAAIAAJBmMzNwZWZmkGle4tBR3jVQT9ocwAA+
}`
| :raw-latex:`\hspace*{1.5em}` :math:`\cdots\cdots\cdots\cdots\cdots\cdots\cdots\cdots`
| :raw-latex:`\hspace*{1em}{\tt\color{blue}<}{\tt{\color{DarkRed}{\color{blue}/}STREAM}}{\tt\color{blue}>}`
| :raw-latex:`\hspace*{0.5em}{\tt\color{blue}<}{\tt{\color{DarkRed}{\color{blue}/}BINARY}}{\tt\color{blue}>}{\tt\color{blue}<}{\tt{\color{DarkRed}{\color{blue}/}DATA}}{\tt\color{blue}>}`
.. raw:: latex
\egroup
However, if the data stream is very large, it may be preferable to keep the data separate from the metadata. The :raw-latex:`\color{DarkRed}`\ ``href`` attribute of the :raw-latex:`\color{DarkRed}`\ ``STREAM`` element, if present, provides the location of the data in a URL-type syntax, for example:
:raw-latex:`\bgroup `
:raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``STREAM``\ ````\ :raw-latex:`\color{DarkRed}`\ ``href``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``ftp://server.com/mydata.dat``\ ``"``:raw-latex:`\color{blue}`\ ``/``:raw-latex:`\color{blue}`\ ``>``
:raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``STREAM``\ ````\ :raw-latex:`\color{DarkRed}`\ ``href``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``ftp://server.com/mydata.dat``\ ``"``\ ````\ :raw-latex:`\color{DarkRed}`\ ``expires``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``2004-02-29T23:59:59``\ ``"``:raw-latex:`\color{blue}`\ ``/``:raw-latex:`\color{blue}`\ ``>``
:raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``STREAM``\ ````\ :raw-latex:`\color{DarkRed}`\ ``href``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``httpg://server.com/mydata.dat``\ ``"``\ ````\ :raw-latex:`\color{DarkRed}`\ ``actuate``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``onLoad``\ ``"``:raw-latex:`\color{blue}`\ ``/``:raw-latex:`\color{blue}`\ ``>``
:raw-latex:`\color{blue}`\ ``<``:raw-latex:`\color{DarkRed}`\ ``STREAM``\ ````\ :raw-latex:`\color{DarkRed}`\ ``href``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``file:///usr/home/me/mydata.dat``\ ``"``:raw-latex:`\color{blue}`\ ``/``:raw-latex:`\color{blue}`\ ``>``
.. raw:: latex
\egroup
The examples are the well-known anonymous FTP and HTTP protocols. ``"``\ :raw-latex:`\color{DarkPurple}`httpg\ ``"`` is an example of a Grid-based access to data through HTTPG; finally, ``"``\ :raw-latex:`\color{DarkPurple}`file\ ``"`` is a reference to a local file. VOTable parsers are not required to understand arbitrary protocols, but are required to understand the three common protocols ``"``\ :raw-latex:`\color{DarkPurple}`file:\ ``"``, ``"``\ :raw-latex:`\color{DarkPurple}`http:\ ``"`` and ``"``\ :raw-latex:`\color{DarkPurple}`ftp:\ ``"``.
There are further attributes of the :raw-latex:`\color{DarkRed}`\ ``STREAM`` element that may be useful. The :raw-latex:`\color{DarkRed}`\ ``expires`` attribute indicates the expiration time of the data; this is useful when data are dynamically created and stored on some staging disk where files only persist for a specified lifetime and are then automatically deleted. The :raw-latex:`\color{DarkRed}`\ ``expires`` attribute expresses when a remote resource ceases to become valid, and is expressed in Universal Time in the same way as the FITS specification, itself conforming to the ISO 8601 standard.
The :raw-latex:`\color{DarkRed}`\ ``rights`` attribute expresses authentication information that may be necessary to access the remote resource. If the VOTable document is suitably encrypted, this attribute could be used to store a password.
The :raw-latex:`\color{DarkRed}`\ ``actuate`` attribute is borrowed from the XML Xlink specification, expressing when the remote link should be actuated. The default is ``"``\ :raw-latex:`\color{DarkPurple}`onRequest\ ``"``, meaning that the data is only fetched when explicitly requested (like a link on an HTML page), and the ``"``\ :raw-latex:`\color{DarkPurple}`onLoad\ ``"`` value means that data should be fetched as soon as possible (like an embedded image on an HTML page).
.. _`VOTable:sec:datatypes`:
6 Definitions of Primitive Datatypes
====================================
This section describes the primitives summarized in Table :ref:`VOTable:primitives` and their representations in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` and :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serializations (see section :ref:`VOTable:sec:data`). In the following, the term “hexadigit” designates the ASCII numbers ``"``\ :raw-latex:`\color{DarkPurple}`0\ ``"`` to ``"``\ :raw-latex:`\color{DarkPurple}`9\ ``"``, or the ASCII lower- or upper-case letters ``"``\ :raw-latex:`\color{DarkPurple}`a\ ``"`` to ``"``\ :raw-latex:`\color{DarkPurple}`f\ ``"`` (i.e. a digit in a hexadecimal representation of a number).
The representation of null values is discussed in section :ref:`VOTable:sec:NULL`.
- **Logical**\ :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies data type ``"``\ :raw-latex:`\color{DarkPurple}`boolean\ ``"``, the contents of the field shall consist of the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization of ASCII ``"``\ :raw-latex:`\color{DarkPurple}`T\ ``"``, ``"``\ :raw-latex:`\color{DarkPurple}`t\ ``"``, or ``"``\ :raw-latex:`\color{DarkPurple}`1\ ``"`` indicating true, and ASCII ``"``\ :raw-latex:`\color{DarkPurple}`F\ ``"``, ``"``\ :raw-latex:`\color{DarkPurple}`f\ ``"``, or ``"``\ :raw-latex:`\color{DarkPurple}`0\ ``"`` indicating false. The *null* value is indicated by an ascii NULL [0x00], a space [0x20] or a question mark ``"``\ :raw-latex:`\color{DarkPurple}`?\ ``"`` [0x3f]. The acceptable representations in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization also include any capitalisation variation of the strings ``"``\ :raw-latex:`\color{DarkPurple}`true\ ``"`` and ``"``\ :raw-latex:`\color{DarkPurple}`false\ ``"`` (e.g. ``"``\ :raw-latex:`\color{DarkPurple}`tRUe\ ``"`` or ``"``\ :raw-latex:`\color{DarkPurple}`FalsE\ ``"``).
- **Bit Array** :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies data type ``"``\ :raw-latex:`\color{DarkPurple}`bit\ ``"``, the contents of the field in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization shall consist of a sequence of bits starting with the most significant bit; the bits following shall be in order of decreasing significance, ending with the least significant bit. A bit field shall be composed of the smallest number of bytes that can accommodate the number of elements in the field. Padding bits shall be 0. The representation of a bit array in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization is made by a sequence of ASCII ``"``\ :raw-latex:`\color{DarkPurple}`0\ ``"`` and ``"``\ :raw-latex:`\color{DarkPurple}`1\ ``"`` characters.
- **Byte**\ :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies data type ``"``\ :raw-latex:`\color{DarkPurple}`unsignedByte\ ``"``, the field shall contain in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization a byte (8-bits) representing a number in the range 0 to 255. In the case of an array of bytes (:raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``*``\ ``"``), also known as a “blob", the bytes are stored consecutively. The representation of a byte in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization can be its *decimal* representation (a number between ``0`` and ``255``) or its *hexadecimal* representation when starting with ``0x`` and followed by one or two hexadigits, (e.g. ``0xff``), separated by at least one space from the next one in the case of an array of bytes.
- **Character**\ :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies data type ``"``\ :raw-latex:`\color{DarkPurple}`char\ ``"``, the field shall contain in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization an ASCII (7-bit) character. The :raw-latex:`\color{DarkRed}`\ ``arraysize`` attribute indicates a character string composed of ASCII text. The :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization follows the FITS rules for character strings, and a character string may therefore be terminated by an ASCII NULL [0x00] before the length specified in the :raw-latex:`\color{DarkRed}`\ ``arraysize`` attribute. In this case characters after the first ASCII NULL are not defined, and a string having the number of characters identical to the :raw-latex:`\color{DarkRed}`\ ``arraysize`` value is not NULL terminated. Characters should be represented in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization using the normal rules for encoding XML text: the ampersand (&) can be written ``&`` (symbolic representation) or ``&`` (decimal representation) or ``&`` (hexadecimal representation); the less-than (``<``) and greater-than (``>``) symbols should be coded ``<`` and ``>`` or ``<`` and ``>``. Also note also the significance of the *white space* characters in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization (section :ref:`VOTable:elem:TD`)
- **Unicode Character**\ :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies data type ``"``\ :raw-latex:`\color{DarkPurple}`unicodeChar\ ``"``, the field shall contain a Unicode character. The :raw-latex:`\color{DarkRed}`\ ``arraysize`` attribute indicates a string composed of Unicode text, which enables representation of text in many non-Latin alphabets. Each Unicode character is represented in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization by two bytes, using the big-endian UCS-2 encoding (ISO-10646-UCS-2). The representation of a Unicode character in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization follows the XML specifications, and e.g. the Cyrillic uppercase “Ya” can be written ``Я`` in UTF-8. Also note the significance of the *white space* characters in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization (section :ref:`VOTable:elem:TD`)
- **16-Bit Integer**\ :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies datatype ``"``\ :raw-latex:`\color{DarkPurple}`short\ ``"``, the data in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization shall consist of big-endian twos-complement signed 16-bit integers (the most significant byte first). The representation of a Short Integer in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization is either its decimal representation between -32768 and 32767 made of an optional ``-`` or ``+`` sign followed by digits, or its hexadecimal representation when starting with ``0x`` and followed by 1 to 4 hexadigits.
- **32-Bit Integer** :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies datatype ``"``\ :raw-latex:`\color{DarkPurple}`int\ ``"``, the data in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization shall consist of big-endian twos-complement signed 32-bit integer contained in four bytes, with the most significant first, and subsequent bytes in order of decreasing significance. The representation of an Integer in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization is either its decimal representation between -2147483648 and 2147483647 made of an optional ``-`` or ``+`` sign followed by digits, or its hexadecimal representation when starting with ``0x`` and followed by 1 to 8 hexadigits;
- **64-Bit Integer**\ :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies datatype ``"``\ :raw-latex:`\color{DarkPurple}`long\ ``"``, the data in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization shall consist of big-endian twos-complement signed 64-bit integers contained in eight bytes, with the most significant byte first, and subsequent bytes in order of decreasing significance. The representation of a Long Integer in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization is either its decimal representation between -9223372036854775808 and 9223372036854775807 made of an optional ``-`` or ``+`` sign followed by digits, or its hexadecimal representation when starting with ``0x`` and followed by 1 to 16 hexadigits;
- **Single Precision Floating Point**\ :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies datatype ``"``\ :raw-latex:`\color{DarkPurple}`float\ ``"``, the data in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization shall consist of ANSI/IEEE-754 32-bit floating point numbers in big-endian order. All IEEE special values including NaN are recognized. The representation of a Floating Point number in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization is made of an optional ``-`` or ``+``, followed by the ASCII representation of a positive decimal number, and followed eventually by the ASCII letter ``"``\ :raw-latex:`\color{DarkPurple}`E\ ``"`` or ``"``\ :raw-latex:`\color{DarkPurple}`e\ ``"`` introducing the base-10 exponent made of an optional ``-`` or ``+`` followed by 1 or 2 digits. The number must be within the limits of the IEEE floating-point definition (around :math:`\pm3.4\cdot10^{38}`; numbers with absolute value less than about :math:`1.4\cdot10^{-45}` are equated to zero). The special values ``"``\ :raw-latex:`\color{DarkPurple}`+Inf\ ``"``, ``"``\ :raw-latex:`\color{DarkPurple}`-Inf\ ``"``, and ``"``\ :raw-latex:`\color{DarkPurple}`NaN\ ``"`` are accepted.
- **Double Precision Floating Point**\ :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies datatype ``"``\ :raw-latex:`\color{DarkPurple}`double\ ``"``, the data in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization shall consist of ANSI/IEEE-754 64-bit double precision floating point numbers in big-endian order. All IEEE special values including NaN are recognized. The representation of a Double number in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization is made of an optional ``-`` or ``+``, followed by the ASCII representation of a positive decimal number, and followed eventually by the ASCII letter ``"``\ :raw-latex:`\color{DarkPurple}`E\ ``"`` or ``"``\ :raw-latex:`\color{DarkPurple}`e\ ``"`` introducing the base-10 exponent made of an optional ``-`` or ``+`` followed by 1 to 3 digits. The number must be within the limits of the IEEE floating-point definition (around :math:`\pm1.7\cdot10^{308}`; numbers with absolute value less than about :math:`5\cdot10^{-324}` are equated to zero). The special values ``"``\ :raw-latex:`\color{DarkPurple}`+Inf\ ``"``, ``"``\ :raw-latex:`\color{DarkPurple}`-Inf\ ``"``, and ``"``\ :raw-latex:`\color{DarkPurple}`NaN\ ``"`` are accepted.
- **Single Precision Complex**\ :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies datatype ``"``\ :raw-latex:`\color{DarkPurple}`floatComplex\ ``"``, the data in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization shall consist of a sequence of pairs of 32-bit single precision floating point numbers in big-endian order. The first member of each pair shall represent the real part of a complex number and the second member shall represent the imaginary part of that complex number. The representation of a Floating Complex number in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization is made of two representations of a *Single Precision Floating Point* numbers separated by whitespace, representing the real and imaginary part respectively.
- **Double Precision Complex**\ :raw-latex:`\quad `If the value of the :raw-latex:`\color{DarkRed}`\ ``datatype`` attribute specifies datatype ``"``\ :raw-latex:`\color{DarkPurple}`doubleComplex\ ``"``, the data in the :raw-latex:`\color{DarkRed}`\ ``BINARY``/:raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization shall consist of a sequence of pairs of 64-bit double precision floating point numbers in big-endian order. The first member of each pair shall represent the real part of a complex number and the second member of the pair shall represent the imaginary part of that complex number. The representation of a Double Complex number in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization is made of two representations of a *Double Precision Floating Point* numbers separated by whitespace, representing the real and imaginary part respectively.
.. raw:: latex
\clearpage
.. _`VOTable:dtd`:
7 A Simplified View of the VOTable :raw-latex:`\ivoaDocversion{}` Schema
========================================================================
The XML Schema defining a VOTable :raw-latex:`\ivoaDocversion{}` document is available from http://www.ivoa.net/xml/VOTable/votable-1.5.xsd as well as in appendix :ref:`VOTable:XML-schema` of this document. In this section we illustrate this XML Schema by a set of boxes describing the structure of a VOTable, and the list of attributes of each VOTable element.
Note that in case of discrepancies between the XML Schema and these diagrams, the schema is definitive.
.. _`VOTable:element-hierarchy`:
7.1 Element Hierarchy
---------------------
The hierarchy of the elements existing in VOTable :raw-latex:`\ivoaDocversion{}` is illustrated below; it uses the following conventions:
- *italicized* text represents *optional* elements;
- :math:`\oplus` indicates that the order of the elements is mandatory, while
- :raw-latex:`\large `\ :math:`\circ` *(open bullet)* indicates that the corresponding elements may occur in any order;
- :math:`\mapsto` marks a choice between alternatives.
- :math:`\dagger` marks a *deprecated* element.
- :math:`\cdots` (dots) indicate that an element may be repeated.
- *underlined elements* may contain sub-elements, and are therefore explained in a dedicated box of the figure.
.. raw:: latex
\bigskip
..
.. raw:: latex
\small
.. raw:: latex
\input{VOTable.elem.tex}
.. raw:: latex
\clearpage
.. _`VOTable:attribute-summary`:
7.2 Attribute Summary
---------------------
The list of the attributes is summarized in the table below, with the following conventions:
- Attributes written in bold are **:raw-latex:`\color{DarkBlue}`\ ``required attributes``**
- Attributes written in a fixed font are :raw-latex:`\color{DarkRed}`\ ``optional``.
- Attributes written in *italics* are not part of VOTable :raw-latex:`\ivoaDocversion{}`, but are *reserved* for possible extensions (mentioned in an Appendix).
.. raw:: latex
\bigskip
..
.. raw:: latex
\small
.. raw:: latex
\input{VOTable.attr.tex}
.. raw:: latex
\clearpage
.. _`VOTable:sec:mime`:
8 MIME Type
===========
A VOTable document should be introduced by a Multipurpose Internet Mail Extensions media type, or MIME type. MIME type syntax is described in RFC 2045 section 5.1, and its semantics in RFC 2046. Associating a MIME type to a document enables the *data consumer* (an application or a web browser) to launch the desired application (*e.g.* a visualisation tool).
In the HTTP protocol (RFC 2616), the MIME type is the value specified by the Content-Type: header. The recommended MIME type describing a VOTable document is ``"``\ :raw-latex:`\color{DarkPurple}`application/x-votable+xml\ ``"``: a VOTable document is ``"``\ :raw-latex:`\color{DarkPurple}`application/x-votable+xml\ ``"``: the **x-** prefix indicates an experimental type, and is required for non-registered media types; and the **+xml** suffix (defined by RFC 3023 section 7) indicates that the type describes a specialization of XML. This type may be accompanied by an optional parameter ``"``\ :raw-latex:`\color{DarkPurple}`serialization\ ``"`` with a value specifying the serialization type used for table data within the document, one of TABLEDATA, FITS, BINARY or BINARY2, interpreted case-insensitively. In the absence of this parameter, any of the serializations may be encountered. If multiple different serializations are used in the same document, this parameter must not be used.
Alternatively the ``"``\ :raw-latex:`\color{DarkPurple}`text/xml\ ``"`` MIME type is acceptable for services delivering data which are expected to be visualized by humans in a browser; this MIME type would preferably be associated with an XSL style sheet, for a presentation of well-formatted tables. It is expected that a few typical XSL style sheets will be accessible from the IVOA site. Note that use of the *text* top-level media type means that line breaks must be represented as a CRLF sequence (RFC 2046, section 4.1.1).
For both of these MIME types, RFC 3023 also defines the optional parameter ``"``\ :raw-latex:`\color{DarkPurple}`charset\ ``"``. If this parameter is not supplied, US-ASCII is assumed.
Any of the following Content-Type header values may therefore be used by a service producing VOTables with the TABLEDATA serialization:
- text/xml
- text/xml; charset="iso-8859-1"
- application/x-votable+xml
- application/x-votable+xml; serialization=tabledata
- application/x-votable+xml; serialization=TABLEDATA; charset=iso-8859-1
.. _`VOTable:diff`:
9 Version History
=================
.. _`VOTable:diff1.1-1.2`:
9.1 Differences Between Versions 1.1 and 1.2
--------------------------------------------
The differences between version 1.2 of VOTable and the preceding version 1.1 are:
- :raw-latex:`\color{DarkRed}`\ ``COOSYS`` is deprecated, in favor of a reference to the *Space-Time Coordinate* (STC) data model (see section :ref:`VOTable:sec:utype` and the IVOA note `Referencing STC in VOTable `__)
- :raw-latex:`\color{DarkRed}`\ ``GROUP`` may appear as a direct child of :raw-latex:`\color{DarkRed}`\ ``VOTABLE`` and :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` (where *COOSYS* was acceptable)
- The usage of UCD1+ is recommended (section :ref:`VOTable:sec:ucd`)
- The :raw-latex:`\color{DarkRed}`\ ``xtype`` attribute was added (see section :ref:`VOTable:sec:xtype`)
- The :raw-latex:`\color{DarkRed}`\ ``INFO`` element (section :ref:`VOTable:elem:INFO`) is made more similar to the :raw-latex:`\color{DarkRed}`\ ``PARAM`` element, but with :raw-latex:`\color{DarkRed}`\ ``datatype``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``char``\ ``"`` and :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``*``\ ``"`` (i.e. is a *String*); it may have attributes :raw-latex:`\color{DarkRed}`\ ``utype``, :raw-latex:`\color{DarkRed}`\ ``ucd``, :raw-latex:`\color{DarkRed}`\ ``ref``, :raw-latex:`\color{DarkRed}`\ ``unit``
- The :raw-latex:`\color{DarkRed}`\ ``INFO`` element may occur before the closing tags :raw-latex:`\color{DarkRed}`\ ``/TABLE`` and :raw-latex:`\color{DarkRed}`\ ``/RESOURCE`` and :raw-latex:`\color{DarkRed}`\ ``/VOTABLE`` (enables *post-operational diagnostics*)
- The :raw-latex:`\color{DarkRed}`\ ``FIELDref`` and :raw-latex:`\color{DarkRed}`\ ``PARAMref`` elements may have a :raw-latex:`\color{DarkRed}`\ ``utype`` and :raw-latex:`\color{DarkRed}`\ ``ucd`` attribute.
- Naming conventions of :raw-latex:`\color{DarkRed}`\ ``GROUP`` elements which specify some properties of a relational schema (see section :ref:`VOTable:sec:relation`).
- The recommended and acceptable mime types have been made explicit (section :ref:`VOTable:sec:mime`)
- The representation of arrays in cells has been made explicit (section :ref:`VOTable:sec:dim`)
- Detailed and clarified the conventions and recommendations concerning :raw-latex:`\color{DarkRed}`\ ``name``, :raw-latex:`\color{DarkRed}`\ ``ID`` and :raw-latex:`\color{DarkRed}`\ ``ref`` attributes
- Appendix A7 was a proposition for additional :raw-latex:`\color{DarkRed}`\ ``utype`` attributes in groups and tables; it is now included in VOTable 1.2. appendix :ref:`VOTable:sec:addesc` now contains a new proposal (May/June 2009) for multiple descriptions and titles.
.. _`VOTable:diff1.2-1.3`:
9.2 Differences Between Versions 1.2 and 1.3
--------------------------------------------
The differences between version 1.3 of VOTable and the preceding version 1.2 are:
- The :raw-latex:`\color{DarkRed}`\ ``BINARY2`` serialization has been introduced (section :ref:`VOTable:sec:BIN2`). :raw-latex:`\color{DarkRed}`\ ``BINARY`` is mildly deprecated.
- The usage and semantics of an empty :raw-latex:`\color{DarkRed}`\ ``TD`` element in the :raw-latex:`\color{DarkRed}`\ ``TABLEDATA`` serialization have changed. In VOTable 1.3, an empty :raw-latex:`\color{DarkRed}`\ ``TD`` element is legal for any datatype (previously it was illegal for integer types) and it always denotes a null value (previously it indicated NaN for floating point types). This change means that the different serializations no longer have exactly the same capabilities for data representation.
- A new section :ref:`VOTable:sec:NULL` has been added to clarify usage and encoding for null values.
- In view of the new options for flagging null values introduced by the BINARY2 and TABLEDATA changes above, use of the :raw-latex:`\color{DarkRed}`\ ``VALUES`` :raw-latex:`\color{DarkRed}`\ ``null`` attribute is now deprecated in most cases. It is in any case explicitly deprecated for floating point values, in favour of NaN.
- The description of the :raw-latex:`\color{DarkRed}`\ ``LINK`` element (section :ref:`VOTable:sec:link`) has been clarified, and a new :raw-latex:`\color{DarkRed}`\ ``content-role``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``type``\ ``"`` example added, with discussion of its application to SKOS concepts.
- The schema datatype declaration of the :raw-latex:`\color{DarkRed}`\ ``LINK`` :raw-latex:`\color{DarkRed}`\ ``content-type`` attribute has been changed from ``NMTOKEN`` to ``token``. The ``NMTOKEN`` datatype in VOTable 1.2 was a mistake, since it would not have permitted the MIME type example in the text.
- The MIME type section (now section :ref:`VOTable:sec:mime`) now describes the new ``serialization`` parameter that can be used to specify serialization type.
- The representation of STC information in section :ref:`VOTable:example1` and section :ref:`VOTable:query` has been modified to reflect the recommended usage from the *STC in VOTable* Note. This usage is recommended even for VOTable 1.2, so this change to the VOTable document represents an update of advice rather than a change to the normative part of the VOTable standard. Additionally, text has been added encouraging declaration of the STC metadata where possible.
- A new section :ref:`VOTable:sec:voarch` has been added explaining the place of VOTable in the IVOA Architecture.
.. _`VOTable:diff1.3-1.4`:
9.3 Differences Between Versions 1.3 and 1.4
--------------------------------------------
The differences between version 1.4 of VOTable and the preceding version 1.3 are:
- Applying erratum VOTable 1.3-1, un-deprecating COOSYS.
- Applying erratum VOTable 1.3-2, permitting ``F0`` in :raw-latex:`\color{DarkRed}`\ ``precision``.
- Applying erratum VOTable 1.3-3, clarifying the meaning of :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``1``\ ``"``.
- Add a new TIMESYS element as a simple means for supplying metadata for time values in the VOTable.
.. _`VOTable:diff1.4-1.5`:
9.4 Differences Between Versions 1.4 and 1.5
--------------------------------------------
The differences between version 1.5 of VOTable and the preceding version 1.4 are:
- COOSYS now has a :raw-latex:`\color{DarkRed}`\ ``refposition`` attribute analogous to TIMESYS.
- The frame identifiers (:raw-latex:`\color{DarkRed}`\ ``system`` attribute) in COOSYS are now taken from the refframe IVOA vocabulary.
- Clarifications and rewording on:
- the meaning of :raw-latex:`\color{DarkRed}`\ ``MIN`` and :raw-latex:`\color{DarkRed}`\ ``MAX`` :raw-latex:`\color{DarkRed}`\ ``value`` attributes for array types.
- removing the recommendation to use xmlns to do utype prefix binding.
- timescales for calendar epochs.
- positioning advice for :raw-latex:`\color{DarkRed}`\ ``ID`` and corresponding references.
- noting that :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` elements can contain :raw-latex:`\color{DarkRed}`\ ``MIVOT`` blocks.
- :raw-latex:`\color{DarkRed}`\ ``unit`` attribute SHOULD conform to VOUnits, and correct examples accordingly.
.. raw:: latex
\clearpage
Appendices
==========
:raw-latex:`\noindent {\bf\LARGE Appendices}`
.. raw:: latex
\bigskip
.. _`VOTable:possible-votable-extensions`:
A Possible VOTable extensions
=============================
The definitions enclosed in this appendix are **not** part of the VOTable standard, but are considered as candidates for VOTable improvements.
.. _`VOTable:LINK`:
A.1 VOTable LINK substitutions
------------------------------
*:raw-latex:`\color{DarkBlue}` The :raw-latex:`\color{DarkRed}`\ ``LINK`` element in Astrores :cite:p:`astrores` contains a mechanism for string substitution, which is a powerful way of defining a link to external data which adapts to each record contained in the table :raw-latex:`\color{DarkRed}`\ ``DATA``.*
When a :raw-latex:`\color{DarkRed}`\ ``LINK`` element appears within a :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` or a :raw-latex:`\color{DarkRed}`\ ``TABLE`` element, extra functionality is implied: the :raw-latex:`\color{DarkRed}`\ ``href`` attribute may not be a simple link, but instead a template for a link. If, in the example of section :ref:`VOTable:example1`, we add the link
::
:raw-latex:`\noindent `a substitution filter is applied in the context of a particular row. For the first row of the table, the substitution would result in the URL
::
http://ivoa.net/lookup?Galaxy=N%20224&RA=010.68&DE=%2b41.27
Whenever the pattern ``${...}`` is found in the original link, the part in the braces is compared with the set of :raw-latex:`\color{DarkRed}`\ ``ID`` (preferably) or :raw-latex:`\color{DarkRed}`\ ``name`` attributes of the fields of the table. If a match is found, then the value from that field of the selected row is used in place of the ``${...}``. If no match is found, no substitution is made. Thus the parser makes available to the calling application a value of the :raw-latex:`\color{DarkRed}`\ ``href`` attribute that depends on which row of the table has been selected. Another way to think of it is that there is not a single link associated with the table, but rather an implicitly defined new column of the table. This mechanism can be used to connect each row of the table to further information resources.
The purpose of the link is defined by the :raw-latex:`\color{DarkRed}`\ ``content-role`` attribute. The allowed values are ``"``\ :raw-latex:`\color{DarkPurple}`query\ ``"`` (see section :ref:`VOTable:query`), ``"``\ :raw-latex:`\color{DarkPurple}`hints\ ``"`` for information for use by the application, and ``"``\ :raw-latex:`\color{DarkPurple}`doc\ ``"`` for human-readable documentation.
The column names invoked in the pattern of the :raw-latex:`\color{DarkRed}`\ ``href`` attribute of the :raw-latex:`\color{DarkRed}`\ ``LINK`` element should exist in the document to generate meaningful links. In the common case where the VOTable was generated from a query of a database and contains only some of the columns in that database, it might be necessary to include columns additional to those requested in order to ensure that the LINKS in the VOTable are operational. Such a :raw-latex:`\color{DarkRed}`\ ``FIELD`` included “by necessity” is marked with the attribute :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``hidden``\ ``"``. The primary key of a relational table is a typical example of a :raw-latex:`\color{DarkRed}`\ ``FIELD`` which would carry the :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``hidden``\ ``"`` attribute.
.. _`VOTable:query`:
A.2 VOTable Query Extension
---------------------------
*:raw-latex:`\color{DarkBlue}` The metadata part included in a :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` contains all the details necessary to create a *form* for querying the resource. The addition of a link having the :raw-latex:`\color{DarkRed}`\ ``action`` attribute can turn VOTable into a powerful query interface.*
:raw-latex:`\noindent `In Astrores :cite:p:`astrores`, the details on the input parameters available in queries are described by the :raw-latex:`\color{DarkRed}`\ ``PARAM`` and :raw-latex:`\color{DarkRed}`\ ``FIELD`` elements, and the syntax used to generate the actual query is described in the ASU procotol :cite:p:`asu`: the :raw-latex:`\color{DarkRed}`\ ``FIELD`` or :raw-latex:`\color{DarkRed}`\ ``PARAM`` elements are paired in the form *name*\ ``=``\ *value*, where *name* is the contents of the :raw-latex:`\color{DarkRed}`\ ``name`` attribute of a :raw-latex:`\color{DarkRed}`\ ``FIELD`` or :raw-latex:`\color{DarkRed}`\ ``PARAM``, and *value* represents a constraint written with the ASU conventions (e.g. ``"``\ :raw-latex:`\color{DarkPurple}`<8\ ``"`` or ``"``\ :raw-latex:`\color{DarkPurple}`12.0..12.5\ ``"`` which denotes a range of values). Such pairs are appended to the :raw-latex:`\color{DarkRed}`\ ``action`` specified in the :raw-latex:`\color{DarkRed}`\ ``LINK`` element contained in the :raw-latex:`\color{DarkRed}`\ ``RESOURCE``, separated by the ampersand (&) symbol – in a way quite similar to the HTML syntax used to describe a :raw-latex:`\color{DarkRed}`\ ``FORM``.
A special :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``no_query``\ ``"`` attribute of the :raw-latex:`\color{DarkRed}`\ ``PARAM`` or :raw-latex:`\color{DarkRed}`\ ``FIELD`` elements marks the fields which are *not* part of the form, i.e. are ignored in the collection of *name*\ ``=``\ *value* pairs.
The following is an example of a transformation of the VOTable in section :ref:`VOTable:example1` into a form interface: :raw-latex:`\label{form1}` :raw-latex:`\small` :raw-latex:`\verbatiminput{stc_example2.vot}`
:raw-latex:`\noindent `Note that the :raw-latex:`\color{DarkRed}`\ ``RESOURCE`` displaying the parameters accessible for a query has the :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``meta``\ ``"`` attribute; it is also assumed that only one :raw-latex:`\color{DarkRed}`\ ``LINK`` having the :raw-latex:`\color{DarkRed}`\ ``content-role``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``query``\ ``"`` attribute together with an :raw-latex:`\color{DarkRed}`\ ``action`` attribute exists within the current :raw-latex:`\color{DarkRed}`\ ``RESOURCE``. The :raw-latex:`\color{DarkRed}`\ ``PARAM`` with :raw-latex:`\color{DarkRed}`\ ``name``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``-out.max``\ ``"`` has been added in this example to control the size of the result.
A valid query generated by this VOTable could be:
::
myQuery?-source=myGalaxies&-out.max=50&R=10..100
.. _`VOTable:sec:arraystring`:
A.3 Arrays of Variable-Length Strings
-------------------------------------
Following the FITS conventions, strings are defined as arrays of characters. This definition raises problems for the definition of arrays of strings, which have then to be defined as 2D-arrays of characters – but in this case only the slowest-varying dimension (i.e. the number of strings) can be variable. This limitation becomes severe when a table column contains a set of remarks, each being made of a variable number of characters as occurs in practice.
FITS invented the *Substring Array* convention (defined in an appendix, i.e. not officially approved) which defines a *separator* character used to denote the end of a string and the beginning of the next one. In this convention (:math:`r`\ ``A:SSTR``\ :math:`w`/:math:`ccc`) the total size of the character array is specified by :math:`r`, :math:`w` defines the maximum length of one string, and :math:`ccc` defines the separator character as its ASCII equivalent value. The possible values for the separator includes the space and any printable character, but excludes the control characters.
Such arrays of variable-length strings are frequently useful e.g. to enumerate a list of properties of an observed source, each property being represented by a variable-length string. A convention similar to the FITS one could be introduced in VOTable in the :raw-latex:`\color{DarkRed}`\ ``arraysize`` attribute, using the **s** followed by the separator character; an example can be :raw-latex:`\color{DarkRed}`\ ``arraysize``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``100s,``\ ``"`` indicating a string made of up to 100 characters, where the comma is used to separate the elements of the array.
.. _`VOTable:location`:
A.4 FIELDs as Data Pointers
---------------------------
Rather than requiring that all data described in the set of :raw-latex:`\color{DarkRed}`\ ``FIELD``s are contained in a single stream which follows the metadata part, it would be possible to let the :raw-latex:`\color{DarkRed}`\ ``FIELD`` act as a *pointer* to the actual data, either in the form of a URI or of a reference to a component of a multipart document.
Each component of the data described by a :raw-latex:`\color{DarkRed}`\ ``FIELD`` may effectively have different requirements: while text data or small lists of numbers are quite efficiently represented in pure XML, long lists like spectra or images generate poor performances if these are converted to XML. The method available to gain efficiency is to use a binary representation of the *whole data stream* by means of the :raw-latex:`\color{DarkRed}`\ ``STREAM`` element – at the price of delivering data in a totally non-human readable format.
The following options would allow more flexibility in the way the various :raw-latex:`\color{DarkRed}`\ ``FIELD``s can be accessed:
- a :raw-latex:`\color{DarkRed}`\ ``FIELD`` can be declared as being a *pointer* with the addition of a :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``location``\ ``"`` value, meaning that the field contains a way to access the data, and not the actual data;
- a :raw-latex:`\color{DarkRed}`\ ``FIELD`` can contain a :raw-latex:`\color{DarkRed}`\ ``LINK`` element marked :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``location``\ ``"`` which contains in its :raw-latex:`\color{DarkRed}`\ ``href`` attribute the partial URI to which the contents of the column cell is appended in order to generate a fully qualified URI.
Note that the :raw-latex:`\color{DarkRed}`\ ``LINK`` is not required – a :raw-latex:`\color{DarkRed}`\ ``FIELD`` declared with :raw-latex:`\color{DarkRed}`\ ``type``\ ``="``\ :raw-latex:`\color{DarkPurple}`\ ``location``\ ``"`` and containing no :raw-latex:`\color{DarkRed}`\ ``LINK`` element is assumed to contain URIs.
An example of a table describing a set of spectra could look like the following:
.. raw:: latex
\small
::
Spectrum absolutely calibrated
NGC6543
SWS06
2028
01301903
NGC6543
SWS07
2544
01302004
.. raw:: latex
\normalsize
:raw-latex:`\noindent` The reading program has therefore to retrieve the data for this first row by resolving the URI :raw-latex:`\bgroup `
``http://ivoa.spectr/server?obsno=01301903``
.. raw:: latex
\egroup
:raw-latex:`\noindent` The same method could also be immediately applicable to *Content-ID*\ s which designate elements of a multipart message, using the protocol prefix ``cid:`` [RFC2111]
Note that the *VOTable LINK substitution* proposed in section :ref:`VOTable:LINK` fills a similar functionality: generate a pointer which can incorporate in its address components from the :raw-latex:`\color{DarkRed}`\ ``DATA`` part for the VOTable.
.. _`VOTable:sec:b64`:
A.5 Encoding Individual Table Cells
-----------------------------------
Accessing binary data improves quite significantly the efficiency both in storage and CPU usage, especially when one compares with the XML-encoded data stream. But binary data cannot be included in the same stream as the metadata description, unless a dedicated coding filter is applied which converts the binary data into an ASCII representation. The base64 is the most commonly used filter for this conversion, where 3 bytes of data are coded as 4 ASCII characters, which implies an overhead of 33% in storage, and some (small) computing time necessary for the reverse transformation.
In order to keep the full VOTable document in a unique stream, VOTable 1.0 introduced the :raw-latex:`\color{DarkRed}`\ ``encoding`` attribute in the :raw-latex:`\color{DarkRed}`\ ``STREAM`` element, meaning that the data, stored as binary records, are converted into some ASCII representation compatible with the XML definitions. One drawback of this method is that the entire data contents become non human-readable.
The addition of the :raw-latex:`\color{DarkRed}`\ ``encoding`` attribute in the :raw-latex:`\color{DarkRed}`\ ``TD`` element allows the data server to decide, at the cell level, whether it is more efficient to distribute the data as binary-encoded or as edited values. The result may look like the following:
::
:raw-latex:`\noindent` When decoded, the contents of the last column is the binary representation of the spectrum, as defined in section :ref:`VOTable:sec:BIN`; no length prefix is required here, the total length of the array being implicitly defined by the length of the encoded text.
.. _`VOTable:very-large-arrays`:
A.6 Very Large Arrays
---------------------
The :raw-latex:`\color{DarkRed}`\ ``BINARY`` and :raw-latex:`\color{DarkRed}`\ ``BINARY2`` serializations of variable-length arrays (section :ref:`VOTable:sec:BIN`, section :ref:`VOTable:sec:BIN2`) uses a 4-byte prefix containg the number of items of the array. This convention imposes an absolute maximal number of :math:`2^{31}-1` elements. This limit could be releaved with a new :raw-latex:`\color{DarkRed}`\ ``arrayprefix`` attribute.
.. _`VOTable:sec:addesc`:
A.7 Additional Descriptions and Titles
--------------------------------------
The same table may be used in several contexts, and it was for instance expressed a wish to include in :raw-latex:`\color{DarkRed}`\ ``TABLE`` and :raw-latex:`\color{DarkRed}`\ ``FIELD`` descriptions and titles (captions) in a form suitable for a publication (latex) in addition to the ascii-only descriptions currently acceptable. The following example is an illustration of this extension:
::
Star luminosities in Model A$L(T_{eff})$ in Model {\bf A}Effective temperature$T_{eff}$Corresponding luminosity in Model A$L(T_{eff})$$L/L_\odot$
In practice this extension would mean that, wherever a :raw-latex:`\color{DarkRed}`\ ``DESCRIPTION`` element is currently acceptable, a set of :raw-latex:`\color{DarkRed}`\ ``DESCRIPTION`` and :raw-latex:`\color{DarkRed}`\ ``TITLE`` elements would become acceptable, each with an optional :raw-latex:`\color{DarkRed}`\ ``context`` additional attribute. The new :raw-latex:`\color{DarkRed}`\ ``TITLE`` element would have the role of expliciting the *column header* in a field or parameter, or to supply a *caption* of a table or a set of tables (resource) in addition to its description.
Providing descriptions in several languages would be another obvious advantage of this extension.
.. _`VOTable:a-new-xmldata-serialization`:
A.8 A New ``XMLDATA`` Serialization
-----------------------------------
In order to facilitate the use of standard XML query tools which usually require each parameter to have its own individual tag, the :raw-latex:`\color{DarkRed}`\ ``XMLDATA`` serialization introduces the designation of each :raw-latex:`\color{DarkRed}`\ ``FIELD`` by a dedicated tag. An example could look like the following:
::
Messier NumberCommon name used to designate the Messier objectClassification (galaxy, glubular cluster, etc)
3205.5+28.4Globular Cluster
31010.7+41.3Andromeda GalaxyGalaxy
:raw-latex:`\noindent `The full document would need an XML-Schema definition of the tags :raw-latex:`\color{DarkRed}`\ ``M``, :raw-latex:`\color{DarkRed}`\ ``RA``, :raw-latex:`\color{DarkRed}`\ ``DE``, :raw-latex:`\color{DarkRed}`\ ``N`` and :raw-latex:`\color{DarkRed}`\ ``T``; these being derived directly from the :raw-latex:`\color{DarkRed}`\ ``ID`` attribute of the :raw-latex:`\color{DarkRed}`\ ``FIELD`` element, their definition can be generated automatically from the set of :raw-latex:`\color{DarkRed}`\ ``FIELD`` definitions.
.. _`VOTable:XML-schema`:
B The VOTable version :raw-latex:`\ivoaDocversion{}` XML Schema
===============================================================
The XML Schema of VOTable :raw-latex:`\ivoaDocversion{}` is included here as a reference. This schema includes a couple of extra optional attributes which are not part of VOTable-:raw-latex:`\ivoaDocversion{}` (*ID* in TR and *encoding* in TD), but proved to be useful to fix some problems encountered in the usage of some code generators. :raw-latex:`\bigskip` :raw-latex:`\small` :raw-latex:`\verbatiminput{VOTable.xsd}` :raw-latex:`\normalsize`
.. [1]
http://fits.gsfc.nasa.gov/fits_registry.html
.. |image1| image:: role_diagram.pdf
:width: 90.0%