features - a quick over view of starbase features.

This package is mostly compatible with the /rdb system described in the book Unix Relational Database Management by Manis, Schaffer and Jorgensen. In addition major extensions are included to support scientific and astronomical datasets.

This document gives a quick overview of the features that are extensions of those provided by the comercial /rdb package. These features were implimented at the Smithsonian Astrophysical Observatory in original source or by modifying sources available under the terms of the GNU software license agreement (Copyleft). This package also includes sources from the Star Link Project .

Table headers

A table may begin with a free text header. The data portion of the table begins with the Head/Dash line pair. The free text header may contain ascii description text and header values.

Header values are header lines containing a keyword followed by a series of tab separated values. Header values are accessed by name in user expressions and statments (row/select/compute/validate/table). The first index of a header value array is 1 and the number of values in the header value is accessed as N_value.

Example

	------------------------cut here----------------------------------------
	Table1

	This table is named Table1

	This is a text comment in the header of a table.  This portion may 
	ramble on and on but should not contain any line with ONLY dash (-)
	and tab characters.  The dash line is the indication that the data
	table is about to begin.

	Key	1
	Keys	1	2	3

	There are two header values above.  Key is a scalar value, Keys is an 
	array.

	RA	Dec
	--	---
	0:0:0	0:0:0
	^L
	Table2

	This is another table it is in the same file as Table1 and is delimited
	from the first by a ^L (form feed) character.  A tables name is given 
	by the first  line in the table.  This table is named Table2.


	RA	Dec	Comment
	--	---	-------
	1:0:0	2:0:0	This as an RA DEC pair in sexadecimal format.
	------------------------cut here----------------------------------------
The header values Key and Keys may be used in a row expression.
		row 'RA < 1 + Key'

or

		row 'RA < 1 + Keys[1] + Keys[2]'

Sexadecimal number notation

Astronimical or sexadecimal ascii number format is supported. A value that is read in sexadecimal format will be output in the same format.

Several formats are recognized and maintained.

		ddd:mm:ss.sss
		 hh:mm:ss.sss

		DDDdMMmSS.SSS
		 HHhMMmSS.SSS

		    hh:mm.mmm
		    MMmSS.SSS

The units of the value are not changed, the ascii format value is simply read in to an internal representation.

Sorting

The package includes the sort and join programs from the GNU textutils package. These programs have been modified to support the sexadecimal number notation and to have a friendlier sort order.

The sorting order for numeric formats (-n and -h) has been modified from the normal unix sort. When a field is empty or contains leading text that field sorts as greater than any number. Unix will usually sort blank fields as zero and text as last.

Features added to the awk language

Programs which use the awk langauge to evaluate expressions and execute statements may use the extended features of tawk a modified version of the mawk program by Mike Brennan distributed with the package.

Included functions

Programs which use the awk langauge to evaluate expressions and execute statements (row/select/compute/trim/validate/table) may have functions automatically included in the text of thier programs.

The environment variable TABLEFUNCTIONS names a path which is searched for undefined functions. If a function is mentioned in a row/select/compute/validate program but not defined, a file found in the TABLEFUNCTIONS path with the name of the undefined function will be included in the program. This feature allows a library of usefull functions to be built and accessed easily.

There is a set of functions included in the distribution in the tablefun directory.

Star Link Astrometry Library

Several of functions from the Star Link library are available with the slalink.4 extensions implimented in this package. These functions make the ascii tab tables particularly freindly for use as astrononical catalogs. Only a few functions have been included at this time. Requests for specific additional functions may be honored.

Multiple function value return

To help support inclusion of external functions and make writing included functions simpler the awk language syntax has been extended to allow functions to return multiple values. A function may be written.
		function squares(x, y) {
			return [ x * x, y * y ]
		}

The bracket notation in the return statement allows a list of expressions to be returned from the function. When the function is called it should be called from an assignment list statment.

		[ xsq, ysq ] = squares(x, y)

Here the bracket notation to the left of an assignment allows the multiple values returning from the function to be assigned to variables.

Several example programs have been written using the sla library and show multiple values being returned (fk45, fk54, preces, radecbox , radeccirc).

search/index

Search range

A range of values in the key column can be searched for using the search fast access methods sequential/binary/index/row. This is especially useful with numeric columns and makes the /rdb concepts applicable to real data world (as opposed to business data).

Search locations

The search locations feature allows the results of multiple fast access searchs to be combined quickly.

Several programs have been written using the search program, the best example of which is radecbox.

tablex

Handle multiple tables in a data file

Tblx is the "table exchanger" program it can extract, insert and process tables in multi-table files.