============================================================================
Help Pages
============================================================================
EXIT              - Halt program
LIST              - Display the relations loaded.
SOURCES           - Display the sources files available.
PRINT r           - Display the contents of relation r.
DELETE r          - Delete the relation r from the disk.
PROMPT s          - Specify s as the command prompt within LEAP.
USE               - List available databases
USE dbname        - Change to database dbname
@ sourcefile      - Use sourcefile as command file.
+
Algebraic Operators
-------------------
UNION             - Type HELP UNION for syntax and usage.
INTERSECT         - Type HELP INTERSECT for syntax and usage.
DIFFERENCE        - Type HELP DIFFERENCE for syntax and usage.
PRODUCT           - Type HELP PRODUCT for syntax and usage.
PROJECT           - Type HELP PROJECT for syntax and usage.
JOIN              - Type HELP JOIN for syntax and usage.
SELECT            - Type HELP SELECT for syntax and usage.
ASSIGNMENT        - Type HELP ASSIGNMENT.
DISPLAY           - Type HELP DISPLAY for syntax and usage.
+
Miscellaneous Operations
------------------------
CREATE relation r a1 dt1 a2 dt2 ..an dtn 
                  - Create a relation r, with attributes a1, type
                    dt1, a2 type dt2 - Where data type is a string
                    or a number (see DATA TYPES)`s
CHANGE r          - Change the temporary status of relation r.
DESCRIBE r        - Display the fields associated with relation r.
MEM               - Display the amount of free memory.

NORMAL            - Return the screen mode to 'normal' 80x25 Colour mode.
HIGH              - Set the screen mode to high resolution, 43/50 lines.

STATUS            - Report the status information of LEAP.
DEBUG             - Change the debug setting of LEAP.
INFIX             - Change the evaluation methodology.
TIMING            - Change the timer setting.
USTIME            - Set time format to US/European

HELP [topic]      - Display help page for [topic]
HELP index        - Display a list of available help topics.
INFO              - Display warranty and conditions of use.
+
===============================================================================
This program, and all associated files/documentation are
copyright (C) 1996 Richard Leyton.
+
=
# HELP
Help is context sensitive. To bring up help on a particular item type

HELP <item>

For example, to bring up help on the SELECT operator, type:

HELP SELECT

Help also contains cross-references to other help topics, and you can bring
up help on these by typing HELP <topic> - Watch out for spelling mistakes
though!

There is an INDEX of help topics, which you can bring up with HELP INDEX

+
# PROMPT
Usage: prompt s
Operation: Specifies the string s as the prompt to be used within LEAP. All
           prompts are appended with the '>' symbol.
Example:

>prompt LEAP
LEAP>prompt Test Prompt
Test Prompt>prompt
>

Note that prompt entered on its own returns the prompt to the default '>'
prompt.

+
# ATTRIBUTE
An attribute is analogous to a "field" in popular relational
database management systems. An attribute is the vertical
column of data, for example in a RELATION of pupils, an attribute
would be, say, age, out of name, address, age, sex etc.
# PROJECT
Usage: project (rel) (f1,f2,...,fn)
Operation: Projects the specified ATTRIBUTEs from the specified expression.
Result: PROJECT reduces the result of the specified expression to
        contain only the ATTRIBUTEs specified. In the process, all duplicate
        tuples that may occur are removed.
Examples:

rel=project (a) (status,city)

+
# ALGEBRA
The relational algebra is the manipulative part of the relational model.
In order for a relational database management system to be termed relational
complete, it must support the relational structures, and provide at least
the functionality of the relational algebra. LEAP can be termed relationally
complete. To be truly relationally, an RDBMS must also ensure that
entity integrity and referential integrity is maintained. 

The relational algebra consists of nine operations: UNION, DIFFERENCE,
INTERSECTION, PRODUCT, PROJECT, RESTRICT, SELECT, JOIN and Divide.

RESTRICT and SELECT are one and the same within LEAP. Divide has not been
implemented at this stage, as it is possible to create it using the other
operators.

+
# ASSIGNMENT
The result of an EXPRESSION may be assigned to a RELATION name, 
enabling it to be used in other EXPRESSIONs.

r1=project (book) (author)
print r1

Assignment is often used in place of NESTING an expression, as it
enables queries to be broken into logical sections that are 
more manageable.
+
# RESTRICT
See the SELECT operator. RESTRICT and SELECT have been combined in LEAP.

+
# SELECT
Usage: select (rel) ((condition) bool (condition))
Operation: Produces a relation which contains all TUPLEs within the
           source relation matching the given CONDITION.
Examples:

rel=select (names) (address='oxford')
rl2=select (names) ( (address='oxford') and (name='richard leyton'))

NB. RESTRICT and SELECT have been combined in LEAP, such that the following
are equally valid:

rel=select (rel) (fielda = fieldb)
rel=restrict (rel) (fielda = fieldb)

+
# CONDITION
Within the SELECT and JOIN operator, a condition may be specified. The 
condition is compared against each tuple, and if the tuple satisfies the 
condition, some action is performed. It takes the form:

<qualification> ::= (<condition> [{andor} <condition>]* ) 
<condition> ::= <attribute-name> <comparator> {attribute-namevalue}
<comparator> ::= { <  >  <=  >=  =  <> }

A value is a text string surrounded by quotes, and an attribute name, is,
well, the name of an attribute.

Some examples:

(name='Richard Leyton')
( (name='Richard Leyton') or (name='Robert England') )
(first_name=second_name)

Note that each individual condition must be surrounded in brackets, and the
entire expression must be surrounded in brackets. Up to ten conditions can be
specified in one qualification.

+
# JOIN
Usage: join (rel1) (rel2) ((condition) bool (condition))
Operation: Produces a relation which contains the attributes of 
           the source relations, and reduces the tuples to those
           matching the given CONDITION.
Result: Conceptually the same as a PRODUCT followed by a SELECT.
Examples:

s1=select (subject) (class_name='non-fiction')
s2=join (s1) (index) (s1.class=index.class)
s3=project (s2) (author,title,shelf)
print s3

+
# UNION
Usage: (rel1) union (rel2)
Operation: Performs the UNION of the two specified relations, which
           must be UNION COMPATIBLE (see UNION COMPATIBILITY)
Examples:

rel=(a) union (b)

+
# UNION COMPATIBILITY
Two relations are said to be UNION COMPATIBLE if they share the
same attributes, each of which is drawn from the same domain as
the corresponding attribute in the other relation.

+
# DISPLAY
Usage: display(expression)
Operation: Displays the content of the relation or expression, and
           returns the expression. This enables display to be nested
           within an expression if necessary.
Examples:

display( (a) union (b) )
rel=project (display(a)) (status,city)

+
# INTERSECT
Usage: (rel1) intersect (rel2)
Operation: Calculates the INTERSECTION of the two specified relations/
           expressions, which must be Union compatible (see UNION
           COMPATIBILITY)
Result: The resulting relation contains all tuples of (rel1) that are
          ALSO in (rel2).
Examples:

rel=(a) intersect (b)

+
# MINUS
See the DIFFERENCE operator for information. MINUS is defined as an
alias of DIFFERENCE.

+
# DIFFERENCE
Usage: (rel1) difference (rel2)
   or: (rel1) minus (rel2)
Operation: Calculates the difference of the two specified relations/
           expressions, which must be Union compatible (see UNION
           COMPATIBILITY). 
Result: The resulting relation contains all tuples of (rel1) that
        are NOT help in (rel2).
Examples:

rel=(a) minus (b)
rel=(a) difference (b)

rel=(b) minus (a)
rel=(b) difference (a)

Note the difference when the relations are reversed, as above.

+
# PRODUCT
Usage: (rel1) product (rel2)
Operation: Calculates the PRODUCT of the two specified relations/
           expressions.
Result: The resulting relation contains the cartesian PRODUCT of the
        two relations. This relation has all of the attributes of the
        source relations, and the tuples consist of all possible
        combinations of the tuples.
Examples:

rel=(a) product (b)

+
# LIST
Lists all of the relations that exist within LEAP, along with their
temporary status.

+
# SOURCES
Lists all of the source files that exist within LEAP. Source
files may be displayed with the L command. Source files may
be executed with the @ command.

There are two important source files - STARTUP.SRC and
SHUTDOWN.SRC - Which are executed at startup and shutdown.
Place special options in the startup file, but do not
remove the load command.

+
# L
Usage: L sourcefile
Prints out the contents of the specified source file.

Example:

>l startup
Listing C:\LEAP\DATABASE\MASTER\SOURCE\STARTUP.SRC
--------------------------------------------------
high
@


+
# @
Usage: @ sourcefile
Executes a source file, taking commands from the file as opposed
to the keyboard.

Example:

>@ iex45

>>>s1=select relation (subject) where (class_name='non-fiction')
S1 Returned.

>>>s2=(s1) join with (index) where (s1.class=index.class)
S2 Returned.

>>>s3=project (s2) with (author,title,shelf)
S3 Returned.

>>>print s3
Relation: S3
AUTHOR                    TITLE                     SHELF
---------------------------------------------------------------------------
KING                      STRENGTH TO LOVE          24
HEMINGWAY                 DEATH IN THE AFTERNOON    22

>>>@

+
# PRINT

Usage: PRINT relation

Displays the specified relation on the screen. See DISPLAY.

+
# DELETE

Usage: DELETE relation

Removes the specified relation from the database. The relation is
only removed from disk if it is TEMPORARY - See CHANGE to change
the temporary status of a relation.

+
# TEMPORARY

Relations can either be permanent or temporary. Permanent relations 
remain on the disk between runs, whereas temporary relations
are removed after a DELETE command, or after LEAP is shutdown.

The status of a relation can be displayed with the LIST command,
and changed with the CHANGE command.

+
# PERMANENT

See TEMPORARY for more information.

+
# CHANGE

Usage: CHANGE relation

Reverses the temporary status of the specified relation. TEMPORARY
relations are removed from disk when DELETEd or LEAP is shutdown.
PERMANENT relations remain on disk despite a DELETE, but are no
longer available in the current run of LEAP.

+
# DESCRIBE

Usage: DESCRIBE relation

Displays the attributes present in the specified relation, and
the data type of each attribute.

+
# DATA TYPE
LEAP supports two types of data types, strings and numbers. 

When creating a relation, attributes must be specified with a
data type, eg.

create relation abc attribute1 string attribute2 number


+
# MEM

Displays the amount of free memory remaining that is available to
LEAP. Normally this is the remaining about of conventional
memory. All used memory is released on termination.

+
# NORMAL

Sets the display to the 'normal' 80 x 25 colour mode which is 
standard in MS-DOS.

See HIGH to display more information on screen.

+
# HIGH

Sets the display to the higher resolution 80 x 43/50 EGA/VGA resolution,
which is useful for viewing larger relations.

See NORMAL for returning the display to a lower resolution,

+
# STATUS

Displays the current status of settings within LEAP. See
COMMAND LINE for default values and settings.

+
# NESTING
Expressions may be nested, such that in place of a relation name,
a further expression is specified:

r2=(project(subject)(class)) minus (project (index)(class))
print r2

Note that each expression is contained within the brackets that a relation
name is normally surrounded by.

+
# INFIX
Usage: infix [y|n]

LEAP 0.9 allows expressions to be expressed in an infix fashion,
whereas previous versions required expressions to be expressed
in a prefix fashion.

By default, infix expressions are turned off, to turn infix
evaluation on type:

infix y

Infix expression evaluation can be set at the COMMAND LINE.

Examples:

INFIX Form:
r1=(project(subject)(class)) minus (project (index)(class))

PREFIX Form:
r1=minus((project((subject)(class)))(project((index)(class))))

+
# PREFIX
See INFIX for examples of INFIX and PREFIX form EXPRESSIONs.

+
# EXPRESSION
An expression is a valid algebraic query that will result in 
a relation. Such an expression may then be assigned to a 
relation, or combined within another expression. For example:

r2=(project(subject)(class)) minus (project (index)(class))

The expression project(subject)(class) is combined into a
larger expression, which is in turn assigned to a new
relation.

+
# INFO
Displays information about the warranty/conditions of LEAP. You
are required to have read and accepted these conditions to continue
using LEAP.

+
# QUIT
Shuts down LEAP. Relations are automatically stored if they are
PERMANENT, and deleted if they are TEMPORARY. You are returned
to the DOS prompt following the shutdown procedure.

+
# DEBUG
Usage: DEBUG [YN]
Debug information showing the progress of expression evaluation
can be written to the REPORT FILE. Type STATUS to display the current
setting. By default, debug information is set off.

Debugging can be set at the COMMAND LINE.

+
# TIMING
Usage: TIMING [YN]
The evaluation of expressions can be timed. Type STATUS to display
the current setting. By default, expression timing is off.

Timing can be set at the COMMAND LINE.

+
# COMMAND LINE
A number of LEAP settings can be specified at the command line:

#-------------------#-----------#-------------------#--------------#
 Setting            Parameter   Required Value      Default    
#-------------------#-----------#-------------------#--------------#
 Data directory     DIR        Absolute DOS path    C:\LEAP    
 Timing             TIMING            Y  N             N      
 Infix expressions  INFIX             Y  N             Y      
 Debug output       DEBUG             Y  N             N      
 Output copy        COPY              Y  N             Y      
 Colour (*)         COLOUR            Y  N             Y      
 Trace              TRACE             Y  N             N      
 Cache              DEBUG             Y  N             N      
 Case               CASE              Y  N             Y      
 Additional IO On   IO_ON             Y  N             N      
 Iterative Parser   ITERATIVE         Y  N             Y      
 Display Parse Tree PARSE             Y  N             N      
#-------------------#-----------#-------------------#--------------#

Example:

LEAP DIR=c:\db\leap TIMING=Y INFIX=Y DEBUG=Y

You may specify as many or as few of the settings as needed.

* Color can also be specified instead of colour.
+
# CREATE
Usage: create [database name description | relation name a1 t1 a2 t3] 

Create a relation or a new database

Database
--------
create database example This is an example database creation

A new database is created with the name specified. Any remaining text is
placed in the info.txt file in the new relations directory.

Relation
--------
create relation arelation attribute1 string attribute2 number

Creates a new relation with the specified name (arelation), with two
attributes, the first as a string, and the second as a number. 

+
# COPY

LEAP by default creates a file in your temporary directory containing
a copy of the output sent to the screen. If this is not required, specify
the COPY parameter at the COMMAND LINE, e.g.:

LEAP copy=n

By default the file is created, and overwrites any information that
is contained within it from previous runs.

+
# COLOUR
LEAP has a small amount of colour. If you would prefer purely grey
output, specify COLOUR=N on the command line. Note that you can also
spell colour as color.

Oh the things I do to keep you happy... ;o) 

+
# COLOR
Please see COLOUR

# USTIME
LEAP allows dates to be output in the US Date format, ie. mm/dd/yyyy
as opposed to the European dd/mm/yyyy which is the default - Specify 
USTIME=Y at the command line, or enter USTIME at the LEAP prompt to 
change within the program.

+
# CACHE
Usage: cache [y|n]

LEAP B0.10 features a small internal tuple cache, but it should be 
stressed that the feature is buggy, and only works for relations
with a cardinality of 20 or less. Above this, problems can and will
occur!

Default is off. Should only be enabled if you are certain, and are
not expecting reliable results! 

This feature will be more fully supported in a later release.
+
# INDICIES
LEAP supports indicies using B-Trees. However at this release, B-Trees have
not been incorporated extensively into LEAP. A number of commands exist to
demonstrate its operation:

SPECIDX r p1 p2   - Specify an index to be created on relation r
                    with attributes p1 and p2
IDXPRINT r p1 p2  - Print the index for relation r, with attributes
                    p1 and p2
IDXSTORE          - Store the indicies to disk.
+
# USE
Usage: use [database]

LEAP B10 supports multiple databases. This allows information to
be broken down into more logical chunks. Previously (B9 and before)
all relations and source was held within one logical chunk.

Now, relations in the distribution are grouped according to the
source from which the data and scripts come from, namely the author
from who's book they are taken.

One database is "special", this is the 'master' database. The master
database contains the DATA DICTIONARY, a set of relations which contain
information about the database. LEAP uses these tables to determine 
where to find information etc.

In future revisions of LEAP, the DATA DICTIONARY will become more
central to the operation of LEAP.
+
# DATA DICTIONARY
A data dictionary is a set of relations which contains "meta data",
data about data.

Within LEAP, the 'master' database contains the data dictionary, and
is consulted to determine whether, for example, a specified database
actually exists, and which directory it may be found in.
+
# RENAME
Usage: rename (relation) (newname)
       rename (relation.attribute) (relation.newattribute)	

Rename can be used to rename the old relation or attribute to a 
new value. For example to rename a relation called "companies" to
"company":

rename (companies) (company)

Or to rename an attribute, say "companies.id" to reference":

rename (companies.id) (reference)

Rename returns the resultant relation, so the result can be nested.
The Old relation is no longer valid at higher levels.

+
# DUPLICATE
Usage: duplicate (rel)
Operation: Produces an identical copy of the specified relation/expression.
Result: Identical Relation, with a different name

Examples:

rel=duplicate(a)
duplicate(b)

+
# ITERATIVE
Usage: iterative [ y | n ]

Changes the query parser to use. If the two-stage iterative parser
is used, a query tree is built which is then evaluated.

If the recursive parser is used, no query tree is built. This requires
far more memory, and is not available in the Windows version.

The system default is to use the iterative parser.

+
# PARSE
Usage: parse [y|n]

Determines whether the parse tree is displayed. The parse tree
is the order by which the expression is evaluated. 

There is quite a bit of output!

The default is off.
+
# TRACE
Usage: trace [y|n]

Determines whether trace information is displayed to the screen
or not. Trace information is primarily a development debugging 
feature, and provides very extensive information on what is currently
occuring. Information isn't always provided, so there is no
guarantee that information will always appear.

The default is off.
+
# COMPATIBILITY
This latest version of LEAP has been developed using a machine (a
Dell Latitude XP DX4100 if you're THAT interested), running Windows
95, under Borland Pascal 7.0 - It runs just fine on my machine, so
I presume it works just fine elsewhere!

A 'C' port is underway using Linux as the host OS, developed using
GNU C - Whether anything will come of it is yet to be determined. I'm
optimistic and hopeful. I want to get LEAP v1.00 finished before any
SERIOUS work really gets going.

My hope is that once I've converted it to 'C', it'll be so generic
based, that ports will be possible onto other OS's which support an
ANSI 'C' compiler. MS-DOS/Windows included (of course).
+
# ABOUT
About LEAP...

LEAP is a relationally complete relational database management system.

LEAP has a relational algebra based command interpreter, support for
relational structures, indexing using b-trees, hashing tables and 
extensive documentation. A source code level framework for enhancement 
is incorporated for interested programmers. Contact the author for
more information.

LEAP has been successfully used as a teaching aid in a course in
Databases at Oxford Brookes University, England. Students have been 
encouraged to use the system to experiment with the relational algebra,
and this has proved very successful and enjoyable.

In addition, there has been a warm reception to LEAP on the Internet, 
leading to a number of sites using LEAP as a teaching tool.

LEAP is copyright Richard Leyton, 1995, 1996. Type INFO for more information 
on warranty and conditions.

+
# BOOKS
A large number of books exist on the subject of Databases and
Database systems. Of particular merit (with my comments) are:

* "Theory and Practice of Relational Databases", by Stefan
  Stanczyk, published by Pitman, 1990. ISBN 0-273-03049-3
  - The majority of examples contained within LEAP are taken
    from this book, and it provides a sound introduction to
    the field of relational databases. 
  (See the STANCZYK database)

* "An introduction to database systems - Volume 1", 5th Edition,
  by C.J. Date, published by Addison-Wesley, 1990. 
  - This book is regarded by many as the best book in the field,
    it certainly covers more or less everything. To me, an
    unbeatable reference book.
  (See the DATE database)

* "An introduction to database systems", by B.C.Desai, published
  by West Publishing, 1990.
  - More mathematical than Date's, but covers everything.

+
# CONTACTS
Contact: Richard Leyton
Address: No.3.Pelting Drove, Priddy, WELLS, Somerset, BA5 3BA. England
E-Mail : richard_leyton@mail.amsinc.com
       : e0190404@brookes.ac.uk
Home Page: http://www.brookes.ac.uk/~e0190404/leap.html

+
# LEAP VERSION NUMBERS
LEAP's version number consists of three numbers and a single character:

major     -     Major version
minor     -     Minor version
revision  -     Revision
character -     Internal revision

For example, 0.10.0b is Major Version 0 (Beta)
                        Minor Version 10
                        Revision 0
                        Internal Revision b

Which means its not yet bug free (Beta), version 10 of the major
version, revision 0. That goes to say, I've not yet finished all that
I'd like to before I release what I'll call version 1. Once I do, I'll
feel confident it can stay as it is in that form for a while. In the 
meantime, the minor versions will tick up. Internal revision is my own
version, to let me know how far I'm progressing! The higher the character
the better the system.

+
# HELP VERSION HISTORY
Version         Date            Author          Description
--------------------------------------------------------------------------
1.0             22/01/1996      R.Leyton        First Version
1.1             22/02/1996      R.Leyton        Revised for B0.10 specifics
1.2             22/02/1996      R.Leyton        Minor changes.
+