EMA-XPS Online


Babylon Query Language (BQL)

The following pages concentrate on a babylon3
extension to GMD's hybrid shell Babylon2, the
Babylon Query Language (BQL). It is intended to
offer access to facts via queries in a way
database applications use.

EMA-XPS offers a complete emulation of the BQL.
See the introducing pages on KNOWLEDGE-HANDLING
and SETs.

The organisation of this capter is close to
chapter 2 of the babylon3 documentation.   

The rest of this page introduces the notation
of the BQL:


Syntax: <bql-expression> ::=
               {<ask-expression> | 
                <tell-expression> |
                <untell-expression> |

ASK, TELL, UNTELL and RETELL are bql-expressions, with 
which you can question or change the knowledge base.


Syntax: [<framename> {instance | <bql-variable>]
        [<relation-name> {instance | <bql-variable>}
            {value | <bql-variable>}]

A simple predication can be a one-argument-predication
or a two-argument-predication. A one-argument predica-
tion describes a frame-instance relation. A two-argu-
ment predication describes an instance-value relation.
It is insignificant, if a part- or a characteristic-
relation between the instance and the values exists.
The two-argument-predication is used in connection
with TELL, UNTELL and RETELL. In connection with
ASK, the predication can be a one-argument- or
a two-argument-predication.

The expressions in the predication will be worked
out from the left to the right, but should be regarded
as quasi-parallel.


Compound-predications are predications that
are bound with AND, OR or NOT ([and... ; 
[or... ; [not...).
they may only be used in bql-expressions or
with rules. Warning: do not use '(and...' for


Syntax: <bql-variable> ::= <lisp-type: symbol>

A bql-variable is a variable with an under-
line, that can be used in every bql-expression.
It will sequentially be bound to the values
which are found in the knowledge base.

Example: >(ask [computer _x]
            (kb-format "~% the base of 
            knowledge contains the following
            computer: ~% ~A" (name-of _x)))
         the base of knowledge contains the
                  following computer:
         the base of knowledge contains the
                  following computer:


Syntax: <babylon-variable>

A babylon-variable is a variable without an
underline and is used as a placeholder.

Example: >(define-behavior equipment
           :primary ((a-computer computer)
                     (an-option options))
           :documentation " "
           :explanation nil
           (kb-confirm "Would you like to
             have ~: (~A~) in your computer?"
             (name-of an-option)))
         #<Behavior-Method EQUIPMENT
                          (COMPUTER OPTIONS)>

In this example a-computer and an-option are
babylon variables.


Syntax: <lisp-type: T>

This can be any lisp-expression or babylon-
expression, that has the same behaviour like
a lisp-expression and returns a defined value.
A lisp-expression can be: a number, a string,
a symbol, a list or a functioncall.


Syntax: <bql-continuation> ::= 
             {<lisp-type::=T> ...}

The continuation can only be used together
with the ASK-expression similarly the THEN-part
of a rule. It consists of babylon-expressions,
which may contain logical variables sofar these
are used in the corresponding predication.
The continuation will be repeated until no
further bindings of logical variables may be


Syntax: <bql-anonymus> ::= _

The anonymus variable is only characterized by
an underline and can be used together with
the functions RETELL and UNTELL. This variable
can be used instead of a value. It can 
represent a quantity of values too. The
anonymus variable has no content.

Example: >(untell [options computer _])
brings the relation options for the
instance computer in the condition "indefinite".

EMA-XPS Online