What? |
Documented where? |
Examples |
Starting Amos II top loop from console with
empty database |
Getting started | amos2 |
Saving the database on disk |
Saving and quitting |
save 'mydb.dmp'; |
Leaving Amos II top loop | Saving
and quitting |
quit; |
Starting Amos II with saved database |
Getting
started |
amos2 mydb.dmp |
Starting Amos II from console with Java |
Java
interface |
javaamos |
Reading AmosQL statements from a file |
Redirect
statement |
< 'myscript.amosql'; |
What? |
Documented where? |
Examples |
Defining types | Types |
create type Person; create type Department; create type Course; |
Defining subtype |
Types |
create type Student under Person; |
Defining atomic property |
Stored
functions |
create function name(Person
p) -> Charstring nm as stored; |
Defining unique property |
Cardinality
constraints |
create function ssn(Person p) -> Number no
key as stored; |
Defining bag valued property |
Stored
functions |
create function phones(Person p) -> Bag of Number no as stored; |
Defining many-one relationship between types |
Cardinality
constraints |
create function dept(Person
p) -> Department d
as stored; |
Defining many-many relationships between types |
Cardinality constraints |
create function teaches(Person
p) -> Bag of Course c as stored; |
Defining one-one relationship between types |
Cardinality constraints |
create function spouse(Person
p) -> Person q key as stored; |
What? |
Documented where? |
Examples |
Creating a new object bound to a temporary variable | Create objects Interface variables |
create Person instances :tore; |
Setting properties |
Updates |
set name(:tore) = "Tore"; set phone(:tore) = 12345; |
Adding a property |
Updates |
add phone(:tore) = 6789; |
Updating sets of values |
Updates |
add friends(:tore) = p from Person p where "Ulla" in name(parents(p)); |
Creating objects and setting properties |
Create objects |
create Person(name,ssn,phones) instances ("Ulla",58102534,321456),("Kalle",65734828,bag(987654,567890)); |
What? |
Documented where? |
Examples |
Finding an object |
Select statement |
select p into :kalle from Person p where
name(p)="Kalle"; |
Accessing properties |
Function call |
phones(:kalle); select phones(p) from Person p where name(p)="Tore"; |
String matching |
String functions |
select name(p) from Person p where
like(name(p),"*ll*"); |
What? |
Documented where? |
Examples |
Defining an inverse of
another function |
Derived functions |
create function personNamed(Charstring
nm) -> Bag of Person p as select p where name(p)=nm; |
Updating inverse functions |
Updates |
create Person instances :ville; add personNamed("Ville") = :ville; |
What? |
Documented where? |
Examples |
Function documentation | Searching source code |
apropos("qrt"); doc("qrt"); sourcecode("sqrt"); doc(apropos("nearest")); sourcecode(apropos("qrt")); |
Functions whose source code match pattern |
Searching source code |
select source_text(f) from Function f , where
like(source_text(f),"*sqrt(*"); |
Command line help |
Getting started |
amos2 -h javaamos -h |
Current file folder |
Accessing data in files |
pwd(); cd(".."); |
Files in current file folder (matching pattern) |
Accessing data in files |
dir("."); dir(".","*.txt"); |