E-ADTs : TODO

This page is still under construction.
[ Basic Types | Complex Number | Counter | Date | ByteArray | Document | Raster | Point | Polygon | Audio | Image ]

Basic Types

[ Instantiation | Insertion ]
There are three types which are special cased in PREDATOR code: int (32-bit signed integer), double (64-bit signed floating precision number), and string (variable length). They are special cased to avoid the extra layers of function calls necessary to implement more complex ADTs. No methods are available on these types. They are the only types on which a B+ tree index may be built.

Instantiation

Basic types are instantiated with no meta-info supplied, as in the example below:
CREATE TABLE Grades (name string, id int, gpa double) KEY (id);

Insertion

Insertion also requires no special syntax, with the exception that double-precision numbers which have a mantissa less than 1 supply the leading zero, e.g.,
INSERT INTO Grades VALUES ("Mark Paskin", 49, 0.45);

Complex Number

[ Instantiation | Insertion | Methods]
The complex number data type is a simple example of an ADT with a few methods and no large data to manage. It consists of two integers, the real and imaginary components of a number in Z2.

Instantiation

The complex number data type has no meta info, so it can be instantiated just like the basic types:
CREATE TABLE compl_data (id int, number complex) KEY (id);

Insertion

The syntax for a complex object is (real, imag).
INSERT INTO compl_data VALUES (1, [complex]"(3, 5)");

Methods

Return TypeNameParameter TypesDescription
intrealnoneReturns the real part of the complex number
intimagnoneReturns the imaginary part of the complex number
complexpluscomplexReturns the sum of the two complex numbers
complexminuscomplexReturns the difference of the two complex numbers
complexinvertnoneReturns the complex number obtained by exchanging the real and imaginary parts
complexcsum (Aggregate)noneReturns the sum of all aggregated complex numbers

Counter

[ Instantiation | Insertion ]
The counter data type is a unique application of meta-info. It assigns a unique integer value to every instance associated with a common meta (or catalog) info object. So for instance, if a table is instantiated with a counter attribute, each relational tuple will be given a unique ID number. The starting value can be specified, if desired, with zero as a default value. Counter values can be cast into integer values to populate indices, if desired.

Instantiation

The counter is instantiated with an (optionally) blank meta-info string, e.g., counter (""). Alternatively, the first-assigned value can be supplied in the string, as in counter ("100"). So to create a table of counters which start with the value 4, type
CREATE TABLE ids (ctr counter ("4"));

Insertion

Since the counter automatically generates its own value, none need be supplied. When loading a table from a file, the counter field can be ommitted, provided the file is tab-delimited and the delimited flag has been set. Otherwise, and when inserting one tuple, the syntax is (counter)"", as in
INSERT INTO ids VALUES ([counter]"");
Three such insertions will result in the relation: [4, 5, 6].

Date

[ Instantiation | Insertion | Methods]
The date data type manages dates as a collection of month, day, century, and year. It uses meta-information to determine input and output formats. Dates are ordered, so they may be compared using the <, >, and = operators.

Instantiation

Meta-information should be specified when creating a table with dates. It is the in the form of a string <format_string>.
CREATE TABLE date_data (val date("<format_string>"));
where <format_string> may be a string of the following characters

CharacterMeaningDefault Value
CCentury (must precede Y)19
YYear00
MMonth01
DDay01

Each character may appear at most once. If a character is omitted, the default value will be used. Whitespaces between characters may also be used. A whitespace can be just about any character: / , - , <space> , w , <tab> , t , etc. <format_string> must be terminated by "e" and be no longer than 19 characters with the "e" included. It should not begin with "n"

Here are some examples of <format_string>:

"M/D/CYe" for 05/22/1970
"CwY-M-De"for 19 70-05-22
"" for 05/22/1970 ("M/D/CYe" is the default format)

Insertion

To insert a date, you must typecast a string into a date. A date format corresponding to the input string may be included with the typecast. Otherwise the meta-info associated with the table schema is used. Note that the date format used in a typecast can be different from that of the table schema. The following inserts the date "7/29/1900" into a table.
INSERT INTO date_data VALUES ([date("M/De")]"7/29"); INSERT INTO date_data VALUES ([date]"7/29/1900");
The current date may be inserted by specifying "now" as the input string.
INSERT INTO date_data VALUES ([date]"now");

Methods

Return TypeNameParameter TypesDescription
intmonthnoneReturns the month
intdaynoneReturns the day
intyearnoneReturns the year (includes century if "CY" was specified during table creation)
intcentnoneReturns the century
intcentyearnoneReturns the full year (century & year)

Bytearray

[ Instantiation | Insertion | Methods]
The bytearray data type ... more to come

Instantiation

CREATE TABLE bite (bytearray("<size>"));
CREATE TABLE ...

Insertion

INSERT INTO bite VALUES ([bytearray]"<file_name>");
INSERT INTO ...
<file_name> may be a URL

Methods

Return TypeNameParameter TypesDescription
n/an/an/aNo methods supported

Document

[ Instantiation | Insertion | Methods]
The document data type ... more to come

Instantiation

The document data type ...
CREATE TABLE doc_data (document("<doc_format>));
CREATE TABLE ...
where <doc_format> can be ascii, msword, html, ps

Insertion

INSERT INTO ...

Methods

Return TypeNameParameter TypesDescription
intprintnonePrints a document & return 1 on success
intemailnoneEmails a document

Raster

[ Instantiation | Insertion | Methods]
The raster data type is a 2 dimensional array of values.

Instantiation

The raster data type ...
CREATE TABLE raster_data (image raster("<format> , <size>"))
where <format> is a meta-information format (currently only only "AVHRR" is supported) and <size> is an estimation of the average raster sizes in bytes (e.g. 10000).

Insertion

INSERT INTO raster_data VALUES ([raster]"<freq> <numLines> <numSamples> <xLow> <yLow> <xHigh> <yHigh> <filename>");

Methods

Return TypeNameParameter TypesDescription
rasterclipboxClips the raster to be within a specific bounding box
rasterderesintDecreases the resolution of the raster
rasterravg (aggregate)noneReturns an average of multiple rasters
rasterrany (aggregate)noneReturns a randomly chosen raster

Point

[ Instantiation | Insertion | Methods]
The point data type is defined by two fields of type double (x and y). In addition to methods which return these two components, the data type also offers methods which create geometric entities from points as well as comparison of points for equality.

Instantiation

The point data type has no meta-information.
CREATE TABLE point_data (val point);

Insertion

The syntax for a point is
INSERT INTO point_data VALUES ([point]"<x> <y>");
where <x> <y> are the coordinates of a point (do not include the "<" and ">").

Methods

Return TypeNameParameter TypesDescription
doublexnoneReturns the x coordinate of the point
doubleynoneReturns the y coordinate of the point
boxmake_boxdoubleReturns a square of specific length centered at the point
circlemake_circledoubleReturns a circle of specific radius centerd at the point
intinsideboxReturns 1 iff the point is [inclusively] inside a box, otherwise returns 0
intinsidepolygonReturns 1 iff the point is [inclusively] inside a polygon, otherwise returns 0
intoutsideboxReturns 1 iff the point is [inclusively] outside a box, otherwise returns 0
intoutsidepolygonReturns 1 iff the point is [inclusively] outside a polygon, otherwise returns 0
intequalspointReturns 1 iff the point is the same as another point, otherwise returns 0

Polygon

[ Instantiation | Insertion | Methods]
The polygon data type ...

Instantiation

The polygon data type ...
CREATE TABLE ...

Insertion

INSERT INTO ...

Methods

Return TypeNameParameter TypesDescription
intrealnoneReturns the real part of the complex number

Audio

[ Instantiation | Insertion | Methods]
The audio data type ...

Instantiation

The audio data type ...
CREATE TABLE ...

Insertion

INSERT INTO ...

Methods

Return TypeNameParameter TypesDescription
intrealnoneReturns the real part of the complex number

Image

[ Instantiation | Insertion | Methods]
The image data type ...

Instantiation

The image data type ...
CREATE TABLE ...

Insertion

INSERT INTO ...

Methods

Return TypeNameParameter TypesDescription
intrealnoneReturns the real part of the complex number

Mail user support:
predator-support@cs.cornell.edu .... Back to PREDATOR Home Page