Sample Map

This code shows the complete sample data map for the scott database.

server scott;

#mode readonly;
#mode readwrite;
mode extend;
#mode migrate

#### physical tables
#column type [primary]
#join table,table,table...
#where ...

table DEPT {
  DEPTNO int primary;
  DNAME string;
  LOC string;
}

table SALGRADE {
  GRADE int primary;
  LOSAL real;
  HISAL real;
}

table EMP {
  EMPNO int primary;
  ENAME string;
  JOB string;
  MGR int;
  HIREDATE date;
  SAL real;
  COMM real;
  DEPTNO int;
}

table EMPGRADE {
  join EMP,SALGRADE;
  where "EMP.SAL >= SALGRADE.LOSAL and EMP.SAL <= SALGRADE.HISAL";
}

#### ENOVIA types
#id TABLE(COLUMN)
#type TABLE(COLUMN) [using TABLE(COLUMN)] [alias name]
#name TABLE(COLUMN) [using TABLE(COLUMN)]
#revision TABLE(COLUMN) [using TABLE(COLUMN)]
#description TABLE(COLUMN) [using TABLE(COLUMN)]
#icon TABLE(COLUMN) [using TABLE(COLUMN)]
#owner TABLE(COLUMN) [using TABLE(COLUMN)]
#locker TABLE(COLUMN) [using TABLE(COLUMN)]
#created TABLE(COLUMN) [using TABLE(COLUMN)]
#modified TABLE(COLUMN) [using TABLE(COLUMN)]
#policy TABLE(COLUMN) [using TABLE(COLUMN)]
#state TABLE(COLUMN) [using TABLE(COLUMN)]
#attribute name TABLE(COLUMN) [using TABLE(COLUMN)]
#default policy name
#default owner name

type Department {
  id DEPT(DEPTNO);
  next "max(DEPTNO)+10";
  name DNAME;
  attribute "Department Number" DEPTNO;
  attribute Location LOC;
  default policy Departments;
  default owner scott;
}

type "Salary Grade" {
  id SALGRADE(GRADE);
  next "max(GRADE)+1";
  name GRADE;
  attribute "Low Salary" LOSAL;
  attribute "High Salary" HISAL;
  default policy "Salary Grades";
  default owner scott;
}

type Employee {
  id EMP(EMPNO);
  next "max(EMPNO)+1";
  name ENAME;
  attribute "Employee Number" EMPNO;
  attribute Name ENAME;
  attribute "Hire Date" HIREDATE;
  attribute Salary SAL;
  default policy Employees;
  default owner scott;
}

type Manager {
  derive Employee;
  type JOB alias "MANAGER";
}

type Clerk {
  derive Employee;
  type JOB alias "CLERK";
}

type Analyst {
  derive Employee;
  type JOB alias "ANALYST";
}

type President {
  derive Employee;
  type JOB alias "PRESIDENT";
}

type Salesman {
  derive Employee;
  type JOB alias "SALESMAN";
  attribute Commission COMM;
}

#### ENOVIA relationships

relationship Manager {
  from Employee in EMP(MGR);
  to Employee;
}

relationship Department {
  from Department in EMP(DEPTNO);
  to Employee;
}

relationship "Salary Grade" {
  from "Salary Grade" in EMPGRADE(SALGRADE.GRADE);
  to Employee in EMPGRADE(EMP.EMPNO);
}