\chapter{The \lang\ description language}
\label{odli3}

We present here the BNF description of \lang ~language. We
illustrate only the syntactic elements that differ from the
original ODL grammar defined in ODMG-93 standard.

\begin{tabular}{lcl}

$\langle$interface\_dcl$\rangle$

& \bnf & $\langle$interface\_header$\rangle$\\

&&{\bf \{}[$\langle$ interface\_body$\rangle$]\textbf{\}}; \\

&& [{\bf union} $\langle$identifier$\rangle$ \textbf{\{
  }$\langle$interface\_body$\rangle$ {\bf \};}] \\

$\langle$interface\_header$\rangle$

& \bnf & {\bf interface} $\langle$identifier$\rangle$ \\

& & [$\langle$inheritance\_spec$\rangle$] \\

& & [$\langle$type\_property\_list$\rangle$] \\

$\langle$inheritance\_spec$\rangle$

& \bnf & : $\langle$scoped\_name$\rangle$\\

&&[,$\langle$inheritance\_spec$\rangle$]

\end{tabular}



\clearpage \noindent Definition of local schema model: wrappers
have to be able to specify source's type and name for each model.
\\
\begin{tabular}[h]{lcl}

$\langle$type\_property\_list$\rangle$

& \bnf & {\bf (} [$\langle$source\_spec$\rangle$]\\

&& [$\langle$extent\_spec$\rangle$]\\
&& [$\langle$key\_spec$\rangle$]

[$\langle$f\_key\_spec$\rangle$] [$\langle$c\_key\_spec$\rangle$]
{\bf )} \\


$\langle$source\_spec$\rangle$

& \bnf & {\bf source} $\langle$source\_type$\rangle$\\

&& $\langle$source\_name$\rangle$ \\

$\langle$source\_type$\rangle$


& \bnf & {\bf relational} $\mid$ {\bf nfrelational}\\

&& $\mid$ {\bf object} $\mid$ {\bf file}\\

&& $\mid$ {\bf semistructured}\\

$\langle$source\_name$\rangle$

& \bnf & $\langle$identifier$\rangle$ \\


$\langle$extent\_spec$\rangle$


& \bnf & {\bf extent} $\langle$extent\_list$\rangle$ \\

$\langle$extent\_list$\rangle$


& \bnf & $\langle$string$\rangle$ $\mid$

$\langle$string$\rangle$,$\langle$extent\_list$\rangle$\\


$\langle$key\_spec$\rangle$


& \bnf & {\bf key}[{\bf s}] $\langle$key\_list$\rangle$ \\


$\langle$f\_key\_spec$\rangle$


& \bnf & {\bf foreign\_key} $(\langle$f\_key\_list$\rangle )$\\

&& references $\langle$key\_list\\
&&$\rangle$ [$\langle$f\_key\_spec$\rangle$]\\

$\langle$c\_key\_spec$\rangle$
& \bnf & {\bf candidate\_key} $\langle$identifier$\rangle $\\
&& $\textbf{(}\langle$key\_list$\rangle \textbf{)}$
\end{tabular}


\clearpage \noindent Definition of mapping rules between global
attributes and corresponding local attributes of local sources.
\\
\begin{tabular}[h]{lcl}

$\langle$attr\_dcl$\rangle$

& \bnf & {\bf [readonly] attribute} \\

& & [$\langle$domain\_type$\rangle$]\\

&& $\langle$attribute\_name$\rangle$ {\bf [*]} \\

& & [$\langle$fixed\_array\_size$\rangle$]\\

&&[$\langle$mapping\_rule\_dcl$\rangle$] \\

$\langle$mapping\_rule\_dcl$\rangle$


& \bnf & {\bf mapping\_rule} $\langle$rule\_list$\rangle$ \\

$\langle$rule\_list$\rangle$


& \bnf & $\langle$rule$\rangle$ $\mid$


$\langle$rule$\rangle${\bf ,}$\langle$rule\_list$\rangle$ \\

$\langle$rule$\rangle$


& \bnf & $\langle$local\_attr\_name$\rangle$ $\mid$\\


&&{\bf `}$\langle$identifier$\rangle${\bf '}\\


& & $\langle$and\_expression$\rangle$ $\mid$\\

&&$\langle$union\_expression$\rangle$\\

$\langle$and\_expression$\rangle$

& \bnf & {\bf (} $\langle$local\_attr\_name$\rangle$ {\bf and}\\


&&$\langle$and\_list$\rangle$ {\bf )}\\


$\langle$and\_list$\rangle$


& \bnf & $\langle$local\_attr\_name$\rangle$\\


&&$\mid$ $\langle$local\_attr\_name$\rangle$ {\bf and}\\

&&$\langle$and\_list$\rangle$\\

$\langle$union\_expression$\rangle$
& \bnf & {\bf (} $\langle$local\_attr\_name$\rangle$ {\bf union}\\

&&$\langle$union\_list$\rangle$ {\bf on } $\langle$identifier$\rangle$ {\bf )}\\

$\langle$union\_list$\rangle$


& \bnf & $\langle$local\_attr\_name$\rangle$\\


&&$\mid$ $\langle$local\_attr\_name$\rangle$ {\bf union}\\

&&$\langle$union\_list$\rangle$\\

$\langle$local\_attr\_name$\rangle$

& \bnf & $\langle$source\_name$\rangle${\bf

.}$\langle$class\_name$\rangle${\bf.}\\

&&$\langle$attribute\_name$\rangle$\\

\dots

\end{tabular}


\vspace{0.4cm} \noindent Terms relationships inserted in the
Common Thesaurus. \\ \\
\begin{tabular}[h]{lcl}

% modifica 2 : relationships declaration

$\langle$relationships\_list$\rangle$

& \bnf & $\langle$relationship\_dcl$\rangle${\bf ;} $\mid$ \\

&&$\langle$relationship\_dcl$\rangle${\bf ;}\\

&&$\langle$relationships\_list$\rangle$\\

$\langle$relationships\_dcl$\rangle$

& \bnf & $\langle$local\_name$\rangle$\\

&&$\langle$relationship\_type$\rangle$\\

&&$\langle$local\_name$\rangle$\\

$\langle$local\_name$\rangle$

& \bnf & $\langle$source\_name$\rangle${\bf .}\\

&&$\langle$local\_class\_name$\rangle$\\

&&[{\bf .}$\langle$local\_attr\_name$\rangle$]\\

$\langle$relationship\_type$\rangle$

& \bnf & {\bf SYN} $\mid$ {\bf BT} $\mid$ {\bf NT} $\mid$ {\bf
RT} \\

\dots

\end{tabular}

\clearpage \noindent Definition of \ocdl ~integrity constraints:
rule declarations (using \textit{if then} definition) valid for
each data instance; mapping rule declarations (specification of
\textit{or}, \textit{and} rules).
\\
\\
\begin{tabular}[h]{lcl}

% Modifica 3 : rule declaration

$\langle$rule\_list$\rangle$ & \bnf &
$\langle$rule\_dcl$\rangle${\bf ;} $\mid$
$\langle$rule\_dcl$\rangle${\bf ;}
$\langle$rule\_list$\rangle$\\


$\langle$rule\_dcl$\rangle$ & \bnf & {\bf rule}
$\langle$identifier$\rangle$
$\langle$rule\_spec$\rangle$\\

$\langle$rule\_spec$\rangle$ & \bnf & $\langle$rule\_pre$\rangle$
{\bf then}
$\langle$rule\_post$\rangle$ $\mid$\\
&&{\bf \{} $\langle$case\_dcl$\rangle$  {\bf \}}\\

$\langle$rule\_pre$\rangle$ & \bnf & $\langle$forall$\rangle$
$\langle$identifier$\rangle$ {\bf in} $\langle$identifier$\rangle$
{\bf :}\\
&&$\langle$rule\_body\_list$\rangle$\\

$\langle$rule\_post$\rangle$
& \bnf & $\langle$rule\_body\_list$\rangle$\\

$\langle$case\_dcl$\rangle$ & \bnf & {\bf case of}
$\langle$identifier$\rangle$  {\bf :}
$\langle$case\_list$\rangle$\\

$\langle$case\_list$\rangle$ & \bnf & $\langle$case\_spec$\rangle$
$\mid$
$\langle$case\_spec$\rangle$ $\langle$case\_list$\rangle$\\

$\langle$case\_spec$\rangle$ & \bnf & $\langle$identifier$\rangle$
{\bf :}
$\langle$identifier$\rangle$  {\bf ;}\\

\end{tabular}

\begin{tabular}{lcl}

$\langle$rule\_body\_list$\rangle$

& \bnf & {\bf (} $\langle$rule\_body\_list$\rangle$ {\bf )} $\mid$\\

&&$\langle$rule\_body$\rangle$ $\mid$\\

& & $\langle$rule\_body\_list$\rangle$ {\bf and}\\

&&$\langle$rule\_body$\rangle$ $\mid$\\

& & $\langle$rule\_body\_list$\rangle$ {\bf and}\\

&&{\bf (} $\langle$rule\_body\_list$\rangle$ {\bf )}\\

$\langle$rule\_body$\rangle$

& \bnf & $\langle$dotted\_name$\rangle$\\

&&$\langle$rule\_const\_op$\rangle$\\
&&$\langle$literal\_value$\rangle$ $\mid$\\

& & $\langle$dotted\_name$\rangle$\\
&&$\langle$rule\_const\_op$\rangle$\\

&&$\langle$rule\_cast$\rangle$ $\langle$literal\_value$\rangle$

$\mid$\\

& & $\langle$dotted\_name$\rangle$ {\bf in}\\

&&$\langle$dotted\_name$\rangle$ $\mid$\\

& & $\langle$forall$\rangle$

$\langle$identifier$\rangle$ {\bf in}\\
&&$\langle$dotted\_name$\rangle$ {\bf :}\\

&&$\langle$rule\_body\_list$\rangle$ $\mid$\\

& & {\bf exists}

$\langle$identifier$\rangle$ {\bf in}\\
&&$\langle$dotted\_name$\rangle$ {\bf :}\\

&&$\langle$rule\_body\_list$\rangle$\\

$\langle$rule\_const\_op$\rangle$

& \bnf & = $\mid$ $\ge$ $\mid$ $\le$ $\mid$ $>$ $\mid$ $<$\\

$\langle$rule\_cast$\rangle$

& \bnf & {\bf (}$\langle$simple\_type\_spec$\rangle${\bf )} \\


$\langle$dotted\_name$\rangle$


& \bnf & $\langle$identifier$\rangle$ $\mid$

$\langle$identifier$\rangle${\bf .}\\
&&$\langle$dotted\_name$\rangle$\\

$\langle$forall$\rangle$

& \bnf & {\bf for all} $\mid$ {\bf forall} \\
\end{tabular}
