The metadata regarding the translation of OPM schemas into DBMS specifications is contained in three files:
Additional metadata is contained in the data dictionary of the underlying DBMS.
The files containing the OPM and abstract relational schemas have been described in the previous sections. The file containing the mapping information is described below.
The information regarding the mapping of an OPM schema into an abstract relational schema is recorded in a file that is assigned a name consisting of the name of the file containing the input OPM schema, followed by ``.MAP''. The BNF syntax for this file is given below.
<MAP mapping> ::= DATABASE_NAME <database name>
<OPM-REL mapping>
| <OPM-REL mapping>
;
<OPM-REL mapping> ::= <mapping statement>
| <OPM-REL mapping> <mapping statement>
;
<mapping statement> ::= <OPM named primitive value class mapping>
| <OPM controlled value class mapping>
| <OPM object/protocol class mapping>
;
<OPM named primitive value class mapping> ::= NAMED PRIMITIVE VALUE CLASS
<OPM class name>
MAPS_TO <REL domain name>
;
<OPM controlled value class mapping> ::= CONTROLLED VALUE CLASS
<OPM class name>
MAPS_TO <relation or rule>
;
<relation or rule> ::= RELATION <REL relation name>
| DOMAIN <REL domain name> WITH RULE <REL rule name>
| DOMAIN <REL domain name> WITH RULE <REL rule name>
DATATYPE <data type>
;
<OPM object/protocol class mapping> ::= <OPM class type> <OPM class name>
MAPS_TO RELATION <REL relation name>
<OPM attribute mappings or null>
| <OPM class type> <OPM class name>
MAPS_TO RELATIONS <REL relation name>
',' <REL relation name>
<OPM attribute mappings or null>
| DERIVED OBJECT CLASS <OPM class name>
MAPS_TO VIEW <REL view name>
<OPM attribute mappings or null>
;
<OPM class type> ::= OBJECT CLASS
| PROTOCOL CLASS
| SYSTEM_CLASS
;
<OPM attribute mappings or null> ::= <null>
| <OPM attribute mappings>
;
<OPM attribute mappings> ::= <OPM attribute mapping>
| <OPM attribute mappings> <OPM attribute mapping>
;
<OPM attribute mapping> ::= <OPM simple attribute mapping>
| <OPM composite attribute mapping>
| <OPM system attribute mapping>
;
<OPM simple attribute mapping> ::= SIMPLE ATTRIBUTE <OPM attribute name>
MAPS_TO <REL element>
WITH ID <REL attribute name>
| SIMPLE ATTRIBUTE <OPM attribute name>
RETRIEVAL_METHOD <SQL queries>
;
<OPM composite attribute mapping> ::= TUPLE ATTRIBUTE <comp name>
<OPM component attribute mappings>
;
<OPM component attribute mappings> ::= <OPM component attribute mapping>
| <OPM component attribute mappings>
<OPM component attribute mapping>
;
<OPM component attribute mapping> ::= COMPONENT ATTRIBUTE <OPM attribute name>
| COMPONENT ATTRIBUTE <OPM attribute name>
MAPS_TO <REL element>
WITH ID <REL attribute name>
| COMPONENT ATTRIBUTE <OPM attribute name>
RETRIEVAL_METHOD <SQL queries>
;
<OPM system attribute mapping> ::= SYSTEM ATTRIBUTE <OPM attribute name>
DATATYPE <data type>
MAPS_TO <REL element>
WITH ID <REL attribute name>
| SYSTEM ATTRIBUTE <OPM attribute name>
DATATYPE <data type>
RETRIEVAL_METHOD <SQL queries>
;
<REL element> ::= ATTRIBUTE <REL attribute name> OF <REL relation name>
| ATTRIBUTES '(' <REL attribute name> ','
<REL attribute name> ')' OF <REL relation name>
;
<OPM class name> ::= /* an OPM class name */
;
<OPM attribute name> ::= /* an OPM attribute or system attribute name */
;
<comp name> ::= /* an OPM composite attribute name or an integer */
;
<REL relation name> ::= /* a relation name */
;
<REL view name> ::= /* a view name */
;
<REL rule name> ::= /* a relational rule name */
;
<REL domain name> ::= /* a relational domain name */
;
<REL attribute name> ::= /* a relational attribute name */
;
<data type> ::= /* relational primitive data type or identity type _id */
;
<integer> ::= /* a non-negative integer */
;
<number> ::= /* a number */
;
<SQL queries> ::= <SQL query> ';'
| <SQL queries> union <SQL query> ';'
;
<SQL query> ::= select <output attribute list>
from <relation name list>
<where statement>
<group by statement>
;
<output attribute list> ::= <output attribute>
| <output attribute list> ',' <output attribute>
;
<output attribute> ::= <output name> <relational attribute name>
| <output name> <arithmetic expression>
| <output name> <aggregate function>
;
/** note: "<REL attribute name>" is covered by <arithmetic expression> **/
<output name> ::= <null>
| <REL attribute name> '='
;
<arithmetic expression> ::= <REL attribute name>
| '(' <arithmetic expression> ')'
| <arithmetic expression> '+' <arithmetic expression>
| <arithmetic expression> '-' <arithmetic expression>
| <arithmetic expression> '*' <arithmetic expression>
| <arithmetic expression> '/' <arithmetic expression>
;
<aggregate function> ::= sum '(' <REL attribute name> ')'
| min '(' <REL attribute name> ')'
| max '(' <REL attribute name> ')'
| avg '(' <REL attribute name> ')'
| count '(' <REL attribute name> ')'
;
<relation name list> ::= <REL relation name>
| <REL relation name> <alias>
| <relation name list> ',' <REL relation name>
| <relation name list> ',' <REL relation name> <alias>
;
<where statement> ::= <null>
| where <conditions>
;
<conditions> ::= <condition>
| <conditions> and <condition>
;
<condition> ::= <relational attribute name> '=' <relational attribute name>
| <relational attribute name> '*' '=' <relational attribute name>
| <relational attribute name> '=' <parameter>
;
<relational attribute name> ::= <REL relational name> '.' <REL attribute name>
| <alias> '.' <REL attribute name>
| <REL attribute name>
;
<group by statement> ::= <null>
| group by <group by list>
;
<group by list> ::= <relational attribute name>
| <parameter>
| <group by list> ',' <relational attribute name>
| <group by list> ',' <parameter>
;
<parameter> ::= /* a parameter name starting with @ */
;
<alias> ::= /* character string */
;
For example, when the translator takes as input the OPM schema shown in section 3, it generates the following OPM to abstract relational mapping information:
DATABASE_NAME test
CONTROLLED VALUE CLASS DepartmentNames
MAPS_TO RELATION DepartmentNames
SYSTEM ATTRIBUTE _code
DATATYPE int
MAPS_TO ATTRIBUTE _code OF DepartmentNames
WITH ID _code
SYSTEM ATTRIBUTE _defn
DATATYPE varchar(255)
MAPS_TO ATTRIBUTE _defn OF DepartmentNames
WITH ID _code
SYSTEM ATTRIBUTE _value
DATATYPE varchar(255)
MAPS_TO ATTRIBUTE _value OF DepartmentNames
WITH ID _code
CONTROLLED VALUE CLASS Rank
MAPS_TO DOMAIN Rank WITH RULE Rank_rule
DATATYPE varchar(255)
CONTROLLED VALUE CLASS Salary
MAPS_TO DOMAIN Salary WITH RULE Salary_rule
DATATYPE int
OBJECT CLASS PERSON
MAPS_TO RELATION PERSON
SIMPLE ATTRIBUTE ssn
MAPS_TO ATTRIBUTE ssn OF PERSON
WITH ID _oid
SIMPLE ATTRIBUTE name
MAPS_TO ATTRIBUTE name OF PERSON
WITH ID _oid
SYSTEM ATTRIBUTE _oid
DATATYPE _id
MAPS_TO ATTRIBUTE _oid OF PERSON
WITH ID _oid
OBJECT CLASS FACULTY
MAPS_TO RELATIONS FACULTY, _vFACULTY
isa* PERSON
TUPLE ATTRIBUTE teaches
COMPONENT ATTRIBUTE course
COMPONENT ATTRIBUTE inDepartment
SIMPLE ATTRIBUTE department
MAPS_TO ATTRIBUTE department OF FACULTY
WITH ID _oid
SIMPLE ATTRIBUTE rank
MAPS_TO ATTRIBUTE rank OF FACULTY
WITH ID _oid
SIMPLE ATTRIBUTE salary
MAPS_TO ATTRIBUTE salary OF _vFACULTY
WITH ID _oid
SYSTEM ATTRIBUTE _defaultVersion
DATATYPE int
MAPS_TO ATTRIBUTE _defaultVersion OF FACULTY
WITH ID _oid
SYSTEM ATTRIBUTE _nextVersion
DATATYPE int
MAPS_TO ATTRIBUTE _nextVersion OF FACULTY
WITH ID _oid
SYSTEM ATTRIBUTE _version
DATATYPE int
MAPS_TO ATTRIBUTE _version OF _vFACULTY
WITH ID _oid
SYSTEM ATTRIBUTE _preVersion
DATATYPE int
MAPS_TO ATTRIBUTE _preVersion OF _vFACULTY
WITH ID _oid
SYSTEM ATTRIBUTE _fromDate
DATATYPE datetime
MAPS_TO ATTRIBUTE _fromDate OF _vFACULTY
WITH ID _oid
SYSTEM ATTRIBUTE _deleteDate
DATATYPE datetime
MAPS_TO ATTRIBUTE _deleteDate OF _vFACULTY
WITH ID _oid
SYSTEM ATTRIBUTE _oid
DATATYPE _id
MAPS_TO ATTRIBUTE _oid OF FACULTY
WITH ID _oid
DERIVED OBJECT CLASS PROFESSOR
MAPS_TO VIEW PROFESSOR
SYSTEM ATTRIBUTE _oid
DATATYPE _id
MAPS_TO ATTRIBUTE _oid OF PROFESSOR
WITH ID _oid
OBJECT CLASS STUDENT
MAPS_TO RELATIONS STUDENT, _vSTUDENT
isa* PERSON
TUPLE ATTRIBUTE attends
COMPONENT ATTRIBUTE course
MAPS_TO ATTRIBUTES (course,_vcourse) OF STUDENT_attends
WITH ID _oid
COMPONENT ATTRIBUTE inDepartment
MAPS_TO ATTRIBUTE inDepartment OF STUDENT_attends
WITH ID _oid
SYSTEM ATTRIBUTE _defaultVersion
DATATYPE int
MAPS_TO ATTRIBUTE _defaultVersion OF STUDENT
WITH ID _oid
SYSTEM ATTRIBUTE _nextVersion
DATATYPE int
MAPS_TO ATTRIBUTE _nextVersion OF STUDENT
WITH ID _oid
SYSTEM ATTRIBUTE _version
DATATYPE int
MAPS_TO ATTRIBUTE _version OF _vSTUDENT
WITH ID _oid
SYSTEM ATTRIBUTE _preVersion
DATATYPE int
MAPS_TO ATTRIBUTE _preVersion OF _vSTUDENT
WITH ID _oid
SYSTEM ATTRIBUTE _fromDate
DATATYPE datetime
MAPS_TO ATTRIBUTE _fromDate OF _vSTUDENT
WITH ID _oid
SYSTEM ATTRIBUTE _deleteDate
DATATYPE datetime
MAPS_TO ATTRIBUTE _deleteDate OF _vSTUDENT
WITH ID _oid
SYSTEM ATTRIBUTE _oid
DATATYPE _id
MAPS_TO ATTRIBUTE _oid OF STUDENT
WITH ID _oid
OBJECT CLASS COURSE
MAPS_TO RELATIONS COURSE, _vCOURSE
SIMPLE ATTRIBUTE courseNumber
MAPS_TO ATTRIBUTE courseNumber OF COURSE
WITH ID _oid
SIMPLE ATTRIBUTE name
MAPS_TO ATTRIBUTE name OF COURSE
WITH ID _oid
SIMPLE ATTRIBUTE taughtBy
SIMPLE ATTRIBUTE references
MAPS_TO ATTRIBUTE references OF COURSE_references
WITH ID _oid
SYSTEM ATTRIBUTE _defaultVersion
DATATYPE int
MAPS_TO ATTRIBUTE _defaultVersion OF COURSE
WITH ID _oid
SYSTEM ATTRIBUTE _nextVersion
DATATYPE int
MAPS_TO ATTRIBUTE _nextVersion OF COURSE
WITH ID _oid
SYSTEM ATTRIBUTE _version
DATATYPE int
MAPS_TO ATTRIBUTE _version OF _vCOURSE
WITH ID _oid
SYSTEM ATTRIBUTE _preVersion
DATATYPE int
MAPS_TO ATTRIBUTE _preVersion OF _vCOURSE
WITH ID _oid
SYSTEM ATTRIBUTE _fromDate
DATATYPE datetime
MAPS_TO ATTRIBUTE _fromDate OF _vCOURSE
WITH ID _oid
SYSTEM ATTRIBUTE _deleteDate
DATATYPE datetime
MAPS_TO ATTRIBUTE _deleteDate OF _vCOURSE
WITH ID _oid
SYSTEM ATTRIBUTE _oid
DATATYPE _id
MAPS_TO ATTRIBUTE _oid OF COURSE
WITH ID _oid
OBJECT CLASS DEPARTMENT
MAPS_TO RELATION DEPARTMENT
SIMPLE ATTRIBUTE name
MAPS_TO ATTRIBUTE name OF DEPARTMENT
WITH ID _oid
SIMPLE ATTRIBUTE faculty
MAPS_TO ATTRIBUTE _oid OF FACULTY REMOTE
WITH ID department
SYSTEM ATTRIBUTE _oid
DATATYPE _id
MAPS_TO ATTRIBUTE _oid OF DEPARTMENT
WITH ID _oid
FOREIGN OBJECT CLASS REFERENCE
MAPS_TO RELATION REFERENCE
SIMPLE ATTRIBUTE _foreignOid
MAPS_TO ATTRIBUTE _foreignOid OF REFERENCE
WITH ID _oid
SYSTEM ATTRIBUTE _oid
DATATYPE _id
MAPS_TO ATTRIBUTE _oid OF REFERENCE
WITH ID _oid
SYSTEM_CLASS DATABASES
MAPS_TO RELATION DATABASES
SYSTEM ATTRIBUTE _dbid
DATATYPE int
MAPS_TO ATTRIBUTE _dbid OF DATABASES
WITH ID _dbid
SYSTEM ATTRIBUTE _dbDescr
DATATYPE varchar(255)
MAPS_TO ATTRIBUTE _dbDescr OF DATABASES
WITH ID _dbid
SYSTEM ATTRIBUTE _dbName
DATATYPE varchar(80)
MAPS_TO ATTRIBUTE _dbName OF DATABASES
WITH ID _dbid
SYSTEM_CLASS CLASSES
MAPS_TO RELATION CLASSES
SYSTEM ATTRIBUTE _cid
DATATYPE int
MAPS_TO ATTRIBUTE _cid OF CLASSES
WITH ID _cid
SYSTEM ATTRIBUTE _dbid
DATATYPE int
MAPS_TO ATTRIBUTE _dbid OF CLASSES
WITH ID _cid
SYSTEM ATTRIBUTE _alias
DATATYPE varchar(80)
MAPS_TO ATTRIBUTE _alias OF CLASSES
WITH ID _cid
SYSTEM ATTRIBUTE _classDescr
DATATYPE varchar(255)
MAPS_TO ATTRIBUTE _classDescr OF CLASSES
WITH ID _cid
SYSTEM ATTRIBUTE _className
DATATYPE varchar(32)
MAPS_TO ATTRIBUTE _className OF CLASSES
WITH ID _cid
SYSTEM ATTRIBUTE _type
DATATYPE varchar(20)
MAPS_TO ATTRIBUTE _type OF CLASSES
WITH ID _cid
SYSTEM_CLASS SCLASSES
MAPS_TO RELATION SCLASSES
SYSTEM ATTRIBUTE _class
DATATYPE int
MAPS_TO ATTRIBUTE _class OF SCLASSES
WITH ID _class
SYSTEM ATTRIBUTE _subclass
DATATYPE int
MAPS_TO ATTRIBUTE _subclass OF SCLASSES
WITH ID _class
SYSTEM_CLASS OBJECTS
MAPS_TO RELATION OBJECTS
SYSTEM ATTRIBUTE _oid
DATATYPE _id
MAPS_TO ATTRIBUTE _oid OF OBJECTS
WITH ID _oid