OPM is described in [1]. The BNF syntax for OPM schemas is given below.
<OPM schema> ::= <OPM schema description>
<foreign database information>
<OPM classes>
;
<OPM schema description> ::= <null>
| SCHEMA <schema name>
<schema version>
<database name>
<schema description>
<permissions>
;
<schema name> ::= <null>
| <string>
;
<schema version> ::= <null>
| VERSION ':' <string>
;
<database name> ::= <null>
| DATABASE ':' <string>
;
<schema description> ::= <null>
| DESCRIPTION ':' <text>
;
<permissions> ::= <null>
| PERMISSIONS <owner attribute> <status attribute>
;
<owner attribute> ::= OWNER <simple attribute name> ':'
<abstract class list>
<attribute description>
<attribute example>
<domain-specific properties>
;
<status attribute> ::= STATUS <simple attribute name> ':'
<status value class>
<simple default>
<attribute description>
<attribute example>
<domain-specific properties>
;
<status value class> ::= <controlled value class name>
| <primitive value class>
| <named primitive value class>
;
<foreign database information> ::= <foreign databases>
| <null>
;
<foreign databases> ::= FOREIGN_DATABASES: { }
| FOREIGN_DATABASES: { <foreign dbs> }
;
<foreign dbs> ::= ( <foreign database name> , <foreign description> )
| <foreign dbs> , ( <foreign database name> , <foreign description> )
;
<foreign description> ::= <text>
| <null>
;
<foreign database name> ::= <text>
;
<OPM classes> ::= <OPM class>
| <OPM classes> <OPM class>
;
<OPM class> ::= <controlled value class>
| <named primitive value class>
| <object class> <versioned attributes>
| <object class> <object attributes> <versioned attributes>
| <protocol class> <protocol attributes>
<versioned protocol attributes>
| <OPM derived class>
;
<object class> ::= <is foreign> OBJECT CLASS <object class name>
<isa list or null>
<class description>
<class example>
<domain-specific properties>
<object identifier>
<represented by>
<object class delete rules>
<foreign info>
;
<is foreign> ::= FOREIGN
| <null>
;
<isa list or null> ::= <generic object classes>
| <null>
;
<object identifier> ::= ID : <attribute list>
| ID : ( <comp attribute list > )
| <null>
;
<controlled value class> ::= <controlled value class name> { <enum-constant> }
<class default> <code type>
<class description>
<class example>
<domain-specific properties>
| <controlled value class name> { <ranges> }
<class default> <code type>
<class description>
<class example>
<domain-specific properties>
;
<controlled value class name> ::= CONTROLLED VALUE CLASS <class name>
;
<enum-constant> ::= <constant_code_desc>
| <enum-constant> , <constant_code_desc>
;
<constant_code_desc> ::= <constant>
| ( <constant> , <code> )
| ( <constant> , <value description> )
| ( <constant> , <code> , <value description> )
;
<value description> ::= <text>
;
<ranges> ::= <range_desc>
| <ranges> , <range_desc>
;
<range_desc> ::= <range>
| ( <range> , <value description> )
;
<range> ::= <number>
| ( - <number> )
| <number> - <number>
| ( - <number> ) - <number>
| ( - <number> ) - ( - <number> )
;
<code type> ::= <null>
| CODE_TYPE ':' <code data type>
;
<code data type> ::= CHAR '(' <integer> ')'
| VARCHAR '(' <integer> ')'
| INTEGER
| SMALLINT
| TINYINT
| REAL
| FLOAT | FLOAT ( <integer> )
| DECIMAL | DECIMAL '(' <integer> ')'
| DECIMAL '(' ( <integer> ',' <integer> ')'
| NUMERIC | NUMERIC '(' <integer> ')'
| NUMERIC '(' ( <integer> ',' <integer> ')'
;
<named primitive value class> ::= NAMED PRIMITIVE VALUE CLASS <class name> :
<primitive value class>
<class default>
<class description>
<domain-specific properties>
;
<class default> ::= DEFAULT : <default value>
| <null>
;
<object attributes> ::= <object attribute>
| <object attributes> <object attribute>
;
<protocol attributes> ::= <protocol attribute>
| <protocol attributes> <protocol attribute>
;
<object attribute> ::= <simple attribute>
| <tuple attribute>
| <derived attribute>
;
<protocol attribute> ::= <simple attribute>
| <tuple attribute>
| <derived attribute>
| <input or output attribute>
;
<simple attribute> ::= ATTRIBUTE <simple attribute name> :
<single or set or list>
<cardinality> <value class>
<simple default>
<inverse constraint>
<simple order by>
<attribute delete rule>
<attribute description>
<attribute example>
<domain-specific properties>
;
<simple attribute name> ::= <attribute name>
;
<tuple attribute> ::= ATTRIBUTE <tuple attribute name>
( <comp attribute list> ) :
<single or set or list> <cardinality>
( <comp value classes> )
<tuple default>
<comp null rule>
<component inverse constraints>
<tuple order by>
<attribute delete rule>
<attribute description>
<domain-specific properties>
;
<tuple attribute name> ::= <attribute name>
| <null>
;
<comp attribute list> ::= <comp attribute name>
| <comp attribute list> , <comp attribute name>
;
<comp attribute name> ::= <attribute name>
;
<comp value classes> ::= <value class>
| <comp value classes> , <value class>
;
<single or set or list> ::= set-of
| list-of
| <null>
;
<cardinality> ::= [ <min> , <max> ]
| [ <min> , ]
| <null>
;
<simple default> ::= DEFAULT : <default value>
;
<default value> ::= <text> | <number>
;
<tuple default> ::= DEFAULT : ( <comp defaults> )
| <null>
;
<comp defaults> ::= <default value>
| <null>
| <comp defaults> , <default value>
| <comp defaults> , <null>
;
<comp null rule> ::= not null : <comp attribute list>
| <null>
;
<attribute description> ::= DESCRIPTION : <text>
| <null>
;
<attribute example> ::= EXAMPLE : <text>
| <null>
;
<inverse constraint> ::= inverse of <class name> . <simple attribute name>
| <null>
;
<component inverse constraints> ::= <comp inverse constraint>
| <null>
;
<comp inverse constraint> ::= <comp attribute name> inverse of
<class name> . <simple attribute name>
| <comp inverse constraint> ,
<comp attribute name> inverse of
<class name> . <simple attribute name>
;
<simple order by> ::= ORDER BY <attribute name> <ascending_descending>
| ORDER BY <attribute name> . <attribute name>
<ascending_descending>
| ORDER BY <attribute name> [ <class name> ]
<attribute name> <ascending_descending>
| <null>
;
<tuple order by> ::= ORDER BY <orderby attribute list>
| <null>
;
<orderby attribute list> ::= <component order by>
| <orderby attribute list> , <component order by>
;
<component order by> ::= <comp attribute name> <ascending_descending>
| <comp attribute name> . <attribute name>
<ascending_descending>
| <comp attribute name> [ <class name> ]
<attribute name> <ascending_descending>
;
<value class> ::= <controlled value class name>
| <primitive value class>
| <named primitive value class>
| <abstract class list>
| CLASSES
;
<primitive value class> ::= BOOLEAN
| BINARY '(' <integer> ')'
| VARBINARY '(' <integer> ')'
| CHAR '(' <integer> ')'
| VARCHAR '(' <integer> ')'
| INTEGER
| SMALLINT
| TINYINT
| REAL
| FLOAT | FLOAT ( <integer> )
| DECIMAL | DECIMAL '(' <integer> ')'
| DECIMAL '(' ( <integer> ',' <integer> ')'
| NUMERIC | NUMERIC '(' <integer> ')'
| NUMERIC '(' ( <integer> ',' <integer> ')'
| DATETIME
| SMALLDATETIME
| TIMESTAMP
| MONEY
| TEXT
| IMAGE
;
<abstract class list> ::= <class name list>
| specific <class name list>
;
<class name list> ::= <class name>
| <class name list> or <class name>
;
<system metaclass> ::= DATABASES
| CLASSES
| SCLASSES
| SPROTOCOLS
;
<object class name> ::= <class name>
;
<class description> ::= DESCRIPTION : <text>
| <null>
;
<class example> ::= EXAMPLE : <text>
| <null>
;
<identifier> ::= <attribute list>
| ( <comp attribute list> )
;
<attribute list> ::= <attribute name>
| <attribute list> , <attribute name>
;
<represented by> ::= <null>
| REP : <attribute list>
;
<generic object classes> ::= <isa> <object class name>
| <generic object classes>, <isa> <object class name>
;
<isa> ::= isa | isa*
;
<foreign info> ::= <foreign db name or null> <foreign class name>
;
<foreign db name or null> ::= DATABASE: <foreign database name>
| <null>
;
<foreign class name> ::= ALIAS: <text>
| <null>
;
<protocol class> ::= PROTOCOL CLASS <protocol class name>
<class description>
<class example>
<domain-specific properties>
<protocol specification>
<protocol class delete rules>
<foreign info>
;
<protocol class name> ::= <class name>
;
<protocol specification> ::= <protocol identifier>
<represented by>
| <protocol identifier>
<represented by>
<protocol expansion>
;
<protocol identifier> ::= ID : <attribute list>
| ID : ( <comp attribute list > )
| <null>
;
<protocol expansion> ::= EXPANSION : <expansion>
;
<expansion> ::= <protocol class name>
| ( <expansion> )
| [ <expansion> ]
| <expansion> , <expansion>
| <expansion> or <expansion>
;
<input or output attribute> ::= ATTRIBUTE <simple attribute name> :
<single or set or list>
<cardinality> <value class>
<simple default>
<inverse constraint>
<input or output statement>
<simple ordered by>
<attribute delete rule>
<attribute description>
<attribute example>
<domain-specific properties>
;
<input or output statement> ::= input <input statement>
| output <output statement>
;
<input statement> ::= isa <protocol_attribute>
| from <from statement>
| isa <protocol_attribute> or from <from statement>
| <null>
;
<output statement> ::= isa <protocol_attribute>
| <null>
;
<protocol_attribute> ::= <protocol class name> . <simple attribute name>
;
<from statement> ::= <protocol class name> via <via statement>
| <from statement> or
<protocol class name> via <via statement>
;
<via statement> ::= <attribute name>
| <via statement> , <attribute name>
;
<derived attribute> ::= ATTRIBUTE <simple attribute name>
DERIVATION : <simple attribute derivation>
<attribute description>
<attribute example>
<domain-specific properties>
| ATTRIBUTE <tuple attribute name>
( <comp attribute list> )
DERIVATION : userspecified
<attribute description>
<attribute example>
<domain-specific properties>
;
<simple attribute derivation> ::= = <arithmetic expression>
| <aggregate expression>
| <attribute composition>
| userspecified
;
<arithmetic expression> ::= <constant>
| <attribute name>
| ( <arithmetic expression> )
| <arithmetic expression> <op> <arithmetic expression>
;
<op> ::= + | - | * | /
;
<aggregate expression> ::= <aggregate function> of <attribute name>
;
<aggregate function> ::= count | sum | avg | max | min
;
<attribute composition> ::= <composition path>
| <attribute composition> or <composition path>
;
<composition path> ::= <composition element> [ <class name> ]
| <attribute name> '.'
| <composition path> <composition element> [ <class name> \
]
| <composition path> <attribute name>
;
<composition element> ::= <attribute name>
| ! <attribute name>
;
<object class delete rules> ::= <input_for delete rule>
<output_of delete rule>
;
<input_for delete rule> ::= INPUT_FOR DELETE NULLIFIES
| <null>
;
<output_of delete rule> ::= OUTPUT_OF DELETE <cascades or nullifies>
| <null>
;
<protocol class delete rules> ::= <generic_protocol delete rule>
<subprotocols delete rule>
<predecessor_protocols delete rule>
<successor_protocols delete rule>
;
<generic_protocol delete rule> ::= GENERIC_PROTOCOL DELETE
<cascades or nullifies or restricted>
| <null>
;
<subprotocols delete rule> ::= SUBPROTOCOLS DELETE
<cascades or nullifies or restricted>
| <null>
;
<predecessor_protocols delete rule> ::= PREDECESSOR_PROTOCOLS DELETE
<cascades or nullifies or restricted>
| <null>
;
<successor_protocols delete rule> ::= SUCCESSOR_PROTOCOLS DELETE
<cascades or nullifies or restricted>
| <null>
;
<attribute delete rule> ::= DELETE <cascades or nullifies or restricted>
| <null>
;
<cascades or nullifies or restricted> ::= RESTRICTED
| <cascades or nullifies>
;
<cascades or nullifies> ::= CASCADES
| NULLIFIES
;
<versioned attributes> ::= <null>
| VERSIONED <object attributes>
;
<versioned protocol attributes> ::= <null>
| VERSIONED <protocol attributes>
;
<domain-specific properties> ::= PROPERTIES : <prop list>
| <null>
;
<prop list> ::= <text> <text>
| <prop list> , <text> <text>
;
<OPM derived class> ::= <specialization derived class>
| <generalization derived class>
;
<specialization derived class> ::= DERIVED OBJECT CLASS <class name>
<class description>
<class example>
<specialization derivation>
<conditions or null>
<derived view attributes or null>
;
<specialization derivation> ::= DERIVATION ':' subclass of <class name list>
;
<class name list> ::= <class name>
| <class name list> ',' <class name>
;
<conditions or null> ::= <null>
| CONDITION ':' <conditions>
;
<derived view attributes or null> ::= <null>
| <derived view attributes>
;
<conditions> ::= <condition>
| <conditions> AND <conditions>
;
<condition> ::= NOT IN <class name>
| <class attribute name> IS NULL
| <class attribute name> IS NOT NULL
| <class attribute name> <comp op> <a primitive value>
| <class attribute name> <comp op> <set of values>
| <class attribute name> <comp op> <class attribute name>
| <class attribute name> <match op> <string>
| <class attribute name> <in op> <set of values>
| <class attribute name> <in op> <class attribute name>
;
<class attribute name> ::= '[' <class name> ']' <attribute name>
;
<comp op> ::= '=' <any all> | '!=' <any all> | '>' <any all>
| '>=' <any all> | '<' <any all> | '<=' <any all>
;
<any all> ::= <null> | ANY | ALL
;
<match op> ::= MATCH | NOT MATCH
;
<in op> ::= IN | NOT IN
;
<set of values> ::= '{' <set of numbers> '}'
| '{' <set of strings> '}'
;
<set of numbers> ::= <number>
| <set of numbers> ',' <number>
;
<set of strings> ::= <string>
| <set of strings> ',' <string>
;
<generalization derived class> ::= DERIVED OBJECT CLASS <class name>
<class description>
<class example>
<generalization derivation>
<derived view attributes>
;
<generalization derivation> ::= DERIVATION ':' <generalization class list>
;
<generalization class list> ::= <class name>
| <generalization class list> or <class name>
;
<derived view attribute> ::= ATTRIBUTE <simple attribute name>
DERIVATION ':' <view simple attribute derivation>
<attribute description>
<attribute example>
<domain-specific properties>
;
<view simple attribute derivation> ::= <extended attribute composition>
| userspecified
;
<extended attribute composition> ::= <extended composition path>
| <extended attribute composition> or
<extended composition path>
;
<extended composition path> ::= '[' <class name> ']' <compoaition element>
| <extended composition path>
'[' <class name> ']' <composition element>
;
<composition element> ::= <attribute name>
| '!' <attribute name>
;
<attribute name> ::= /* string */ ;
<class name> ::= /* string */ ;
<database name> ::= /* string */
<integer> ::= /* positive integer */ ;
<constant> ::= /* string with double quotes */ ;
<number> ::= /* positive number or zero */ ;
<text> ::= /* double quoted text */ ;
<code> ::= /* alphanumeric characters or special symbols : + - * / \ ! = . */ ;
<string> ::= /* character string */ ;
<min> ::= /* a positive integer or zero */ ;
<max> ::= /* a positive integer */ ;