The Object Query Language

EYEDB provides a query language based on the ODMG OQL.
Although EYEDB OQL is not an OML (i.e. an Object Manipulation Language), most of the common language operations can be performed (arithmetic and logical operations, string manipulation, flow control, function definition) as well as query constructs.

EYEDB OQL adds a few features from the ODMG OQL such as flow control (if else, for, while), function definition, an assignement operator, and regular expression operators.

For instance the following examples are EYEDB OQL legal constructs:
function max(x, y) {return (x > y ? x : y);};

function fib(n) {
  if (n < 2)
    return n;
  return fib(n-1) + fib(n-2);
};

for (x in list(1, 2, 3, 4))
  fib(x);

for (x := 0; x < 10; x++)
  fib(x);
Note that the previous code does not perform any query.

The following code perform queries:
select Person;          // returns the OIDs of all Person instances

select x from Person;   // idem

select Person.name =  "john"; // returns the Person whose name is "john"

select Person.name ~ "^a.*b"; // returns the instances whose name matches
                              // the regular expression

select Person.name !~~ "ja" // returns the Person whose name does
                            // not matches the regular expression in a case
                            // insensitive way.

select x from Person x where x.age > 2 && // returns Person  whose age is between
                       x.age < 10;        // 2 and 10.

select Person.name;     // returns all Person names

select x.name from Person x;  // idem

for (x in (select Person)) // for each Person
 if (x.name ~ "^j")        // whose name matches
   x.name := \"_\" +       // the regular expression
       x.name;;            // "j", adds a "_" before
                           // the name.

// set the age of the Person whose name
// is "john" to 20:
(select Person.name = "john").age := 20;


EyeDB manual