Expression Statements

An expression statement is an expression following by a semicolon. Expressions are built from typed operands composed recursively by operators.

The syntax of an expression statement is as follows:
expr ;
where expr denotes any expression.

There are three main kinds of expressions: atomic expressions, unary expressions and binary expressions. Atomic expressions are composed of one terminal atom and no operators, unary expressions are composed of one operand and one operator, binary expressions are composed of two operands and one operator.

We divide the OQL expression family into several semantical sub-families according to their operators as follows:

- atomic expressions,
- arithmetic expressions,
- assignment expressions,
- auto increment & decrement expressions,
- comparison expressions,
- logical expressions,
- conditional lists,
- expression sequences,
- array deferencing,
- identifier expressions,
- path expressions,
- function call,
- method invocation,
- eval/unval operators,
- set expressions,
- object creation,
- object deletion,
- collection expressions,
- exception expressions,
- function definition expressions,
- conversion expressions,
- type information expressions
- query expressions,
- miscellenaous expressions

In the following sub-sections, we introduce all the OQL expression types using the following template presentation:
  1. we present first, in an unformal way, the syntax and the semantics of the operators,
  2. general formal information is presented in a first table:
    - operator(s)
    - type
    - syntax
    - operand types
    - functions
  3. in an optionnal second table, we present all the valid operand combination and their result type. A comment about the function performed is added if necessary. This table is skipped in case of the operand type combination is unique or trivial.
  4. in a last table, we introduce a few examples. The examples manipulating database objects use the schema that can be found in the directory
    $EYEDBROOT/examples/common:
    // person.odl
    
    enum CivilState {
      Lady = 0x10,
      Sir  = 0x20,
      Miss = 0x40
    };
    
    class Address {
      attribute string street;
      attribute string<32> town;
      attribute string country;
    };
    
    class Person {
      attribute string name;
      attribute int age;
      attribute Address addr;
      attribute Address other_addrs[];
      attribute CivilState cstate;
      attribute Person * spouse inverse Person::spouse;
      attribute set<Car *> cars inverse owner;
      attribute array<Person *> children;
    
      int change_address(in string street, in string town,
                         out string oldstreet, out string oldtown);
    
      static int getPersonCount();
      index on name;
    };
    
    class Car {
      attribute string brand;
      attribute int num;
      Person *owner inverse cars;
    };
    
    class Employee extends Person {
      attribute long salary;
    };
    
Expression types are gathered so to minimize the number of tables in this document.
EyeDB manual