OSI/ODL Element definition
OSI/ODL elements are the essential parts defined in an OSI or ODL script. Mainly, elements define types and members. Members are properties and behavior in type definitions. The OSI/ODL Element BNF provides the entry points type and OSI and ODL element definitions.
// The OSI Member BNF provides entry points type and member definitions
OSIMember := '$@' // defined for providing the bnf class name
osi_definition |= type_dcl | view_dcl | osi_class_dcl | expr_def | templ_def | xml_def
odl_definition |= type_dcl | view_dcl | interface_dcl | class_dcl | const_dcl | extent_dcl
extensions_dcl := _extensions extensions_def ';'
extensions_def := '{' [ext_exports(*)] '}'
ext_exports := [ comment_block(*) ] ext_export_dcl
ext_export_dcl |= attr_dcl | ref_dcl | rel_dcl
// type_dcl
//type_dcl := type_def | struct_dcl | union_dcl | enum_dcl
type_dcl := type_def | struct_dcl | enum_dcl
type_def := [update_option] _typedef type_spec [ declarators ] ';'
// structure
struct_dcl := [update_option] struct_type ';'
struct_type := _struct syn_ident [persistent] [struct_def] // ODABA allows forward declarations and references for structures
struct_def := '{' member(*) '}'
// union
//union_dcl := [update_option] union_type ';'
//union_type := _union identifier _switch '(' switch_type_spec ')' '{' case_def(*) '}'
//switch_type_spec := base_int | char_types | boolean_type | enum_type | scoped_name
//case_def := case_label(*) element_spec ';'
//case_label := case_inst | default_def
//case_inst := _case operand ':'
//default_def := _default ':'
//element_spec := type_spec declarator
// enumeration
enum_dcl := [update_option] enum_type ';'
enum_type := _enum identifier [base_class] [enum_def] // ODABA allows forward declarations for enumerations
base_class := '(' scoped_name ')' // base class for discriminators, ODABA extension
enum_def := '{' enumerator(*) '}'
enumerator |= identifier [ref_type] [ enum_value ] [enum_def] [',']
ref_type := '(' scoped_name ')' // type for discriminators, ODABA extension
enum_value := '=' number [enum_condition] // ODABA extension
enum_condition := '(' operand ')'
// const_dcl
const_dcl := _const const_type identifier assigned_value ';'
const_type := base_int | char_types | boolean_type | string_type | scoped_name
// osi_class_dcl - ODABA specific
osi_class_dcl := [update_option] class_header [ osi_class_def ] ';'
osi_class_def := '{' osi_exports(*) '}'
osi_exports := [ comment_block(*) ] osi_export_dcl
osi_export_dcl |= attr_dcl | ref_dcl | rel_dcl | expr_def
// interface
interface_dcl := [update_option] interface_header [ interface_spec ] ';'
interface_spec := '{' [exports(*)] '}'
interface_header := _interface syn_ident [ inheritance_spec ]
// class_dcl : in contrast to ODL ODABA supports multiple class inheritance via EXTENDS relationship
class_dcl := [update_option] class_header [ class_def ] ';'
class_def := '{' [exports(*)] '}'
class_header := _class syn_ident [persistent] [extends_spec] [inheritance_spec] [type_property_list]
persistent := _persistent [type_option(*)]
type_option := guid | type_id | version
type_id := _type_id '=' number
type_property_list := '(' type_property(*) ')'
type_property := key_spec | extent_spec | alignment_spec | context_class
alignment_spec := _alignment '=' number ';'
exports := [ comment_block(*) ] export_dcl
export_dcl |= type_dcl | const_dcl | attr_dcl | ref_dcl | rel_dcl | except_dcl | method
// view_dcl is an ODABA specific extension, which combines ODL and OQL elements
view_dcl := [update_option] view_header [ view_def ] ';'
view_def := '{' view_member(*) '}'
view_member |= attr_dcl | ref_dcl | rel_dcl | method
view_header := _view identifier view_spec [inheritance_spec] [type_property_list]
// except_dcl
except_dcl := _exception exceptions_def
exceptions_def := exception_def | exception_specs
exception_specs := '{' sexception_spec(*) '}'
sexception_spec := exception_def ';'
exception_def := identifier '{' [member(*)] '}'
// inheritance_spec and extends_spec, which include some important ODABA extensions (multiple class inheritance,
// set based relationships)
inheritance_spec := ':' base_types
extends_spec := extends base_types // handled as based_on inheritance in ODABA
base_types := base_type [base_type_suc(*)]
base_type_suc := ',' base_type
base_type := [base_option(*)] extended_type_spec [rel_option(*)] [base_declarator]
base_option := _virtual | priv_option | _transient
base_declarator := syn_ident [col_ext_rel(*)] [context_class]
// extent_spec, which includes substantial extension for ODABA (multiple extents)
extent_dcl := [update_option] extent type_name extent_def ';' // ODABA supports global extents
type_name := identifier
extent_spec := extent extents_def ';' // ODABA requires a semicolon, here
extents_def := extent_def | extent_specs
extent_specs := '{' sextent_spec(*) '}'
sextent_spec := extent_def ';'
extent_def := [_transient] [rel_option(*)] syn_ident [extent_option(*)]
extent_option := col_ext_ref | super_sets | sub_sets
sub_sets := subset [subset_options(*)] extent_names
subset_options := distinct | complete
super_sets := superset [intersect] extent_names
extent_names := '(' extent_name [extent_names_suc(*)] ')'
extent_names_suc := ',' extent_name
//************************************
// key_spec
key_spec := key keys_def ';' // ODABA requires a semicolon, here, instead of comma
keys_def := key_def | key_specs
key_specs := '{' skey_spec(*) '}'
skey_spec := key_def ';'
key_def := [ident_key] identifier [key_components_ext]
key_components_ext := key_components | key_components_odmg
key_components_odmg := '(' key_components ')'
key_components := key_component [key_component_suc(*)]
key_component_suc := ',' key_component
key_component := key_path [component_option(*)]
key_path := identifier [property_extension(*)]
component_option := ignore_case | descending
// attribute(s), which include specific ODABA extensions
attr_dcl := attribute attr_def ';'
attr_def := attr_spec | attr_specs
attr_specs := '{' sattr_spec(*) '}'
sattr_spec := attr_spec ';'
attr_spec := type_ref declarators
// reference(s)
ref_dcl := reference refs_def ';'
refs_def := ref_def | ref_specs
ref_specs := '{' sref_spec(*) '}'
sref_spec := ref_def ';'
ref_def := type_ref [ ref_option(*) ] references
ref_option := guid | weak_typed | owner | update | unique | multiple_key | delete_empty | no_create
references := ref_declarator [references_suc(*)]
references_suc := ',' ref_declarator
ref_declarator := collection [col_ext_ref(*)]
// relationship(s)
rel_dcl := relationship rels_def ';'
rels_def := rel_def | rel_specs
rel_specs := '{' srel_spec(*) '}'
srel_spec := rel_def ';'
rel_def := type_ref [ rel_option(*) ] relationships
rel_option := ref_option | dependent | secondary | auto_delete
relationships := rel_declarator [relationships_suc(*)]
relationships_suc := ',' rel_declarator
rel_declarator := collection [col_ext_rel(*)] // in ODABA optional, but always sugested
// collections
collection := syn_ident [collection_size] [assigned_value]
collection_size := '[' [ number ] ']' // ODABA extension
col_ext_rel := inverse_spec | base_collection | col_ext_ref
inverse_spec := inverse inverse_traversal_path
inverse_traversal_path:= scoped_name
base_collection := based_on base_path
base_path := member_path | '*'
member_path := extent_name | property_extension(*)
extent_name := scoped_name | any_type
property_extension := '.' identifier
col_ext_ref := order_keys | attr_ext_decl
attr_ext_decl := sources | constraint | version | context_class | copy_level | check_level
constraint := _constraint '(' operand ')'
sources := _source operand_list
version := _version '=' number
order_keys := ordered_by '(' [index_specs] ')' // ODABA extension
index_specs := index_spec [index_spec_suc(*)]
index_spec_suc := ',' index_spec
index_spec := [key_name] [index_option(*)]
key_name := identifier
index_option := unique | not_empty | temporary | main_order | large
context_class := _context_class '=' scoped_name
copy_level := _copy_level '=' copy_level_name
copy_level_name := 'all' | 'default' | 'link' | 'instance' | 'local' | 'model' | 'none'
check_level := _check_level '=' check_level_name
check_level_name := 'automatic' | 'mandatory' | 'optional' | 'suggested' | 'valid' | 'mandatory_valid'
// meth_dcl - Method declaration
mtype_ref := [type_ref_options(*)] [_const] simple_type_spec
meth_dcl := [oneway] [mtype_ref] [ref_symbol(*)] meth_ident parameter_dcls [_const] [raises_expr] [context_expr]
meth_ident := [identifier] [scope(*)] midentifier_ [ impl_ident ]
scope := sidentifier scope_op
sidentifier := identifier | any_type
midentifier_ := op_rator | midentifier
op_rator := _operator cun_op
midentifier := ['~'] identifier
impl_ident := '.' identifier
parameter_dcls := '(' [params_dcl] ')'
raises_expr := raises '(' scoped_name ')' // not supported
context_expr := context '(' string_literals ')' // not supported
string_literals := string_literal [string_literal_suc(*)]
string_literal_suc := ',' string_literal
string_literal := string
// parameter declarations, parameters, categories, declarators
params_dcl := param_dcl [param_dcl_suc(*)]
param_dcl_suc := ',' param_dcl_
param_dcl_ := param_dcl | '...'
param_dcl := [param_attribute] [_const] simple_type_spec [declarator]
param_attribute := in | out | inout
parm_list := opt_parameter [parm_ext(*)]
parm_ext := ',' opt_parameter
opt_parameter := [parm_options(*)] parameter
parameter := parm_spec | operand | '*'
parm_spec := simple_type_spec [ref_symbol(*)] identifier [fixed_array_size(*)] [assigned_value]
parm_options := ignore_case | descending | not_empty | unique | _static
assigned_value := assign_op exp_oper
exp_oper := operand | expr_code | OIFInit
// members, categories, declarators
member |= imember
imember := [type_ref_options(*)] type_spec declarators ';'
declarators := declarator [declarator_suc(*)]
declarator_suc := ',' declarator
declarator := [ref_symbol(*)] syn_ident [fixed_array_size(*)] [ operand_list ] [assigned_value] [attr_ext_decls]
attr_ext_decls := attr_ext_decl(*)
ref_symbol := '*' | '&'
fixed_array_size := '[' size_spec ']'
size_spec := size [ dimension ]
size := number
dimension := ',' number
syn_ident := identifier [alias]
alias := _alias '(' name_list ')'
name_list := identifier [name_successor(*)]
name_successor := ',' identifier
// type_ref, which includes ODMG 3.0 as subset (common definition)
type_ref := [type_ref_options(*)] domain_type // ODABA extension
type_ref_options := priv_option | prop_option
prop_option := _static | _collection | _transient | _virtual | not_empty | _generic | _global | _const // ODABA extension
priv_option := _private | _public | _protected // ODABA extension
domain_type := simple_type_spec | struct_type | enum_type
// type_spec
type_spec := simple_type_spec | constr_type_spec
//constr_type_spec := struct_type | union_type | enum_type
constr_type_spec := struct_type | enum_type
simple_type_spec := base_type_spec | extended_type_spec
base_type_spec := floating_pt_type | integer_type | char_len_types | boolean_type | octet_type | date_type | time_type | _timestamp | bit_type | binary_type | any_type
extended_type_spec := scoped_name | generic_type | coll_type | array_type | interval_type
//extended_type_spec := array_type | gstring_type | coll_type | interval_type | generic_type | scoped_name
array_type := array_spec '<' simple_type_spec [array_dim] '>'
array_spec := array | sequence
array_dim := [','] number
// gstring_type := string_type string_size
// string_size := '<' number '>'
coll_type := dict_coll | coll_coll
coll_coll := coll_spec '<' simple_type_spec '>'
coll_spec := set | list | bag
dict_coll := _dictionary '<' simple_type_spec ',' simple_type_spec '>'
interval_type := interval '<' simple_type_spec '>'
generic_type := identifier gentype_parm // ODABA extension
gentype_parm := gentype_parm_new | gentype_parm_old // ODABA extension
gentype_parm_new := '<' simple_type_spec '>' // ODABA extension
gentype_parm_old := '(' simple_type_spec ')' // ODABA extension
// basic types
date_type := _date [ len_spec ]
time_type := _time [ len_spec ]
char_len_types := char_types [ len_spec ]
len_spec := '(' size ')' // ODABA extension
char_types := string_type | local_type | ascii_type | latin1_type | utf8_type | utf16_type | utf32_type | char_type | coded_type
integer_type := [_unsigned] int_types
int_types := base_int | int_spec
base_int := short_int | long_int | long_long_int | big_int
long_long_int := long_int long_int
int_spec := int_type [int_size] // ODABA extension
int_size := '(' size [','] [precision_val] ')' // ODABA extension
precision_val := number // ODABA extension
// base types
_date := 'date' | __date_type
__date_type :: 'DATE'
_time := 'time' | __time_type
__time_type :: 'TIME'
_timestamp := 'timestamp' | 'datetime' | __timestamp_type
__timestamp_type :: 'TIMESTAMP' | 'DATETIME'
coded_type := 'coded' | __coded_type // ODABA extension
__coded_type :: 'CODED' | 'CCHAR'
string_type := 'string' | __string_type // ODABA extension
__string_type :: 'STRING'
ascii_type := 'ascii' | __ascii_type // ODABA extension
__ascii_type :: 'ASCII'
latin1_type := 'latin1' | __latin1_type // ODABA extension
__latin1_type :: 'LATIN1'
local_type := 'local' | __local_type // ODABA extension
__local_type :: 'LOCAL'
utf8_type := 'utf8' | __utf8_type // ODABA extension
__utf8_type :: 'UTF8'
utf16_type := 'utf16' | __utf16_type // ODABA extension
__utf16_type :: 'UTF16'
utf32_type := 'utf32' | __utf32_type // ODABA extension
__utf32_type :: 'UTF32'
char_type :: 'char' | 'CHAR' | 'int8'
floating_pt_type :: 'double' | 'float' | 'real' | 'REAL'
boolean_type :: 'boolean' | 'bool' | 'BOOL' | 'logical' | 'LOGICAL'
bit_type :: 'bit' | 'BIT' // ODABA extension
short_int :: 'int16' | 'SHORT' | 'short' | 'uint16'
long_int :: 'int32' | 'LONG' | 'long' | 'uint32'
big_int :: 'int64' | 'uint64'
int_type :: 'int' | 'INT' | 'DEC' // ODABA extension
_unsigned :: 'unsigned' | 'UNSIGNED'
octet_type :: 'octet' //not supported in ODABA
binary_type :: 'binary' | 'BINARY' | 'BLOB' // ODABA extension
// standard key words
_operator := 'operator' | __operator
__operator :: 'OPERATOR'
context := 'context' | __context
__context :: 'CONTEXT'
raises := 'raises' | __raises
__raises :: 'RAISES'
in := 'in' | _in
_in :: 'IN'
out := 'out' | _out
_out :: 'OUT'
inout := 'inout' | _inout
_inout :: 'INOUT'
oneway := 'oneway' | __oneway // not supported in ODABA
__oneway :: 'ONEWAY'
_exception := 'exception' | __exception
__exception :: 'EXCEPTION'
_extensions := 'extensions' | __extensions
__extensions :: 'EXTENSIONS'
_private := 'private' | __private
__private :: 'PRIVATE'
_protected := 'protected' | __protected
__protected :: 'PROTECTED'
_public := 'public' | __public
__public :: 'PUBLIC'
_static := 'static' | __static
__static :: 'STATIC' | '__cdecl'
_virtual := 'virtual' | __virtual
__virtual :: 'VIRTUAL'
_transient := 'transient' | __transient
__transient :: 'TRANSIENT'
_typedef :: 'typedef' | 'TYPEDEF'
_enum :: 'enum' | 'ENUM'
_struct :: 'struct' | 'STRUCT'
//_union :: 'union' | 'UNION'
_interface := 'interface' | _interface_
_interface_ :: 'INTERFACE'
_view := 'view' | __view
__view :: 'VIEW'
_const :: 'const' | 'CONST'
_class :: 'class' | 'CLASS'
extends := 'extends' | __extends
__extends :: 'EXTENDS'
array := 'array' | __array
__array :: 'ARRAY'
sequence := 'sequence' | __sequence
__sequence :: 'SEQUENCE'
set := 'set' | __set
__set :: 'SET'
list := 'list' | __list
__list :: 'LIST'
bag := 'bag' | __bag
__bag :: 'BAG'
attribute := 'attribute' | ___attribute
___attribute :: 'ATTRIBUTE'
relationship := 'relationship' | __relationship
__relationship :: 'RELATIONSHIP'
reference := 'reference' | __reference
__reference :: 'REFERENCE'
_collection := 'collection' | __collection
__collection :: 'COLLECTION'
inverse := 'inverse' | __inverse
__inverse :: 'INVERSE'
extent := 'extent' | __extent
__extent :: 'EXTENT'
key := 'key' | 'keys' | __key
__key :: 'KEY' | 'KEYS'
// ODABA keyword extensions
_global := 'global' | __global
__global :: 'GLOBAL' | 'extern' | 'EXTERN'
multiple_key := 'multiple_key' | __multiple_key
__multiple_key :: 'MULTIPLE_KEY'
no_create := 'no_create' | __no_create
__no_create :: 'NO_CREATE'
ordered_by := 'ordered_by' | __ordered_by
__ordered_by :: 'ORDERED_BY'
unique := 'unique' | __unique
__unique :: 'UNIQUE'
not_empty := 'not_empty' | __not_empty
__not_empty :: 'NOT_EMPTY'
_generic := 'generic' | __generic
__generic :: 'GENERIC'
temporary := 'temporary' | __temporary
__temporary :: 'TEMPORARY'
main_order := 'main_order' | __main_order
__main_order :: 'MAIN_ORDER'
large := 'large' | __large
__large :: 'LARGE'
_persistent := 'persistent' | __persistent
__persistent :: 'PERSISTENT'
guid := 'guid' | __guid
__guid :: 'GUID'
weak_typed := 'weak_typed' | __weak_typed
__weak_typed :: 'WEAK_TYPED'
owner := 'owner' | __owner
__owner :: 'OWNER'
dependent := 'dependent' | __dependent
__dependent :: 'DEPENDENT'
secondary := 'secondary' | __secondary
__secondary :: 'SECONDARY'
auto_delete := 'auto_delete' | __auto_delete
__auto_delete :: 'AUTO_DELETE'
based_on := 'based_on' | __based_on
__based_on :: 'BASED_ON'
subset := 'subset' | __subset
__subset :: 'SUBSET'
superset := 'superset' | __superset
__superset :: 'SUPERSET'
ident_key := 'ident_key' | __ident_key
__ident_key :: 'IDENT_KEY'
complete := 'complete' | __complete
__complete :: 'COMPLETE'
distinct := 'distinct' | __distinct
__distinct :: 'DISTINCT'
intersect := 'intersection' | __intersect
__intersect :: 'INTERSECTION'
ignore_case := 'ignore_case' | __ignore_case
__ignore_case :: 'IGNORE_CASE' | 'IC'
descending := 'descending' | __descending
__descending :: 'DESCENDING' | 'DESC'
interval := 'interval' | __interval
__interval :: 'INTERVAL'
_constraint := 'constraint' | __constraint
__constraint :: 'CONSTRAINT'
_alignment := 'alignment' | __alignment
__alignment :: 'ALIGNMENT'
delete_empty := 'delete_empty' | __delete_empty
__delete_empty :: 'DELETE_EMPTY'
_source := 'source' | __source
__source :: 'SOURCE'
_type_id := 'type_id' | __type_id
__type_id :: 'TYPE_ID'
_version := 'version' | __version
__version :: 'VERSION'
_alias := 'alias' | __alias
__alias :: 'ALIAS'
_context_class := 'ContextClass' | __context_class
__context_class :: 'CONTEXTCLASS'
_copy_level := 'copy_level' | __copy_level
__copy_level :: 'COPY_LEVEL'
_check_level := 'check_level' | __check_level
__check_level :: 'CHECK_LEVEL'
cun_op := '++' | '--' | '!' | '()' | '[]' | bin_op
// comment line characters
CC := '//'
// bnf references
std_symbols ::= class(BNFStandardSymbols)
number ::= ref(std_integer)
string ::= ref(std_string)
common_symbols ::= class(OSICommon)
identifier ::= ref(identifier)
comment_block ::= ref(comment_block)
scope_op ::= ref(scope_op)
scoped_name ::= ref(scoped_name)
any_type ::= ref(any_type)
_switch ::= ref(_switch)
_case ::= ref(_case)
_default ::= ref(_default)
_dictionary ::= ref(_dictionary)
update_option ::= ref(update_option)
update ::= ref(update)
oper_symbols ::= class(OSIOperand)
operand ::= ref(operand)
operand_list ::= ref(operand_list)
view_spec ::= ref(view_spec)
assign_op ::= ref(assign_op)
bin_op ::= ref(bin_op)
method_symbols ::= class(OSIMethod)
method ::= ref(method)
expr_def ::= ref(expr_def)
templ_def ::= ref(templ_def)
xml_def ::= ref(xml_def)
expr_code ::= ref(expr_code)
oif_symbols ::= class(OIF)
OIFInit ::= ref(OIFInit)