company logo

OSI operands

OSI operands are, usually part of a statement and may act as operands in an operation or as parameters in a function call. Usually, operands appear as

  • operand
  • operation path (access_path)
  • select statement (OQLSelect)

// The OSI Operand BNF provides definitions for

//    operand

//    access_path

//    OQLSelect

// for being used in an OSI script file

OSIOperand            := '$@'                    // defined for providing the bnf class name

// OSI SELECT statement

OQLSelect             := sel_spec from_spec [sel_extensions(*)] [output_spec]

inline_expr           := operand | expr_code    // entry point for inline expressions

sel_spec              := _select operand_list

sel_extensions        := where_spec | having_spec | group_spec | order_spec

view_spec             := from_spec [where_spec] [group_spec] [having_spec] [order_spec]  // referred to in OSIMember

from_spec             := _from operand_list

where_spec            := _where '(' operand ')'

having_spec           := _having '(' operand ')'

order_spec            := _order_by operand_list

group_spec            := _group_by operand_list   // automatically generates attributes and partition properties in the structure

output_spec           :=  to_file | to_database

to_file               := _tofile operand_list     // to file( Path='Console', FileType='', Definition='', Headline = false)

to_database           := _todb operand_list       // to database ( Datasource='Output', Extent=SelectedPersons )

from_file             := _fromfile operand_list   // from file( Path='Console', FileType='', Definition='', Headline = false)

file                  := _fileext operand_list    // file extent( Path='Console', FileType='', Definition='', Headline = false)

order_names           := identifier [order_name_suc(*)]

order_name_suc        := ',' identifier

// acess_path (refers to expr_code, statement)

access_path           := path_element [ path_extension(*) ]

path_extension        := ext_op path_element_expr

path_element_expr     := path_element | expr_code

ext_op                := '.' | '@' | '->'

path_element          := path_operand [ operand_list ]

//path_operand          := path_name | coll_operand | expr_code

// path_operand cannot be expression code, since this might conflict e.g. with a block after an if statement

path_operand          := path_name | coll_operand  

path_name             := pname [ name_index ]

oql_oper              := _select | _from | _where | _having | _group_by | _order_by | _join | _union | _minus | _intersect | _tofile | _todb | _fromfile | _fileext | _use

name_index            := '[' operand ']'

coll_operand          := '[' access_path ']'

operand_list          := '(' [parm_list] ')'

//cond_op1              := '(' operand cond_op_ext(*) ')

//cond_op_ext           := ':' operand ',' operand

operand               := un_operation [ bin_operand(*) ]

bin_operand           := bin_op un_operation

un_operation          := [un_oper] simple_op

un_oper               := un_op | cast_op

cast_op               := '(' simple_type_spec [ref_symbol(*)] ')'

//simple_op             := OQLSelect | access_path | block | sngl_operand | constant | sys_variable

// simple_op cannot be block, since this might conflict e.g. with a block after an if statement

cond_op               := '(' cond_case(*) operand ')'

cond_case             := operand '?' operand ':'

simple_op             := OQLSelect | call_op | access_path | cond_op |sngl_operand | constant | sys_variable

call_op               := _call fct_name [ operand_list ]

fct_name              := identifier | sys_variable

sngl_operand          := '(' operand ')'

sys_variable          := '%' option_path '%'

option_path           := identifier [ option_path_suc(*) ]

option_path_suc       := '.' identifier

// names

pname                 := oql_oper | scoped_name | db_name | any_type | scope_ext

db_name               := '##' identifier

_call                 := call__     | __call

call__                := 'call'      

__call                :: 'CALL'

_order_by             := _order [_by]

_group_by             := _group [_by]

_tofile               := __tofile   | tofile__

tofile__              :: 'toFile'

__tofile              := _to _file

_todb                 := __todb     | todb__

todb__                :: 'toDatabase'

__todb                := _to _database

_fromfile             := __fromfile | fromfile__

fromfile__            :: 'fromFile'

__fromfile            := _from _file

_fileext              := __fileext  | fileext__  

fileext__             :: 'fileExtent'

__fileext             := _file extent  

_select               := select__       | __select

select__              :: 'select'      

__select              :: 'SELECT'

_from                 := from__         | __from

from__                :: 'from'

__from                :: 'FROM'

_where                := where__        | __where

where__               :: 'where'      

__where               :: 'WHERE'

_having               := 'having'       | __having

__having              :: 'HAVING'

_join                 := 'join'         | __join

__join                :: 'JOIN'

_minus                := 'minus'        | __minus

__minus               :: 'MINUS'

_union                := 'union'        | __union

__union               :: 'UNION'

_intersect            := 'intersect'    | __intersect

__intersect           :: 'INTERSECT'

_order                := 'order'        | __order

__order               :: 'ORDER'

_group                := 'group'        | __group

__group               :: 'GROUP'

_by                   := 'by'           | __by

__by                  :: 'BY'

_to                   := 'to'           | __to

__to                  :: 'TO'

_file                 := 'file'         | __file

__file                :: 'FILE'

_use                  := 'use'          | __use

__use                 :: 'USE'

un_op                 := '--' | '++' | '-' | _not | '*' | '&' | _new | _delete

bin_op                := bin_assign_op | bin_operation | compare_op | assign_op | bool_op

bin_assign_op         := '+=' | '-=' | '*=' | '/='

bin_operation         := '%' | '+' | '-' | '*' | '/' | '<<' | '>>'

compare_op            := '==' | '<=' | '>=' | '<>' | '>' | '<' | '!='  

assign_op             := '='  | '&='  

bool_op               := '^' | _and | _or | _xor

_delete               :: 'delete' | 'DELETE'

_not                  := _not_kw  | '!'  

_and                  := _and_kw  | '&&'

_or                   := _or_kw   | '||'

_not_kw               :: 'not'    | 'NOT'

_and_kw               :: 'and'    | 'AND'

_or_kw                :: 'or'     | 'OR'  

_xor                  :: 'xor'    | 'XOR'

// OQL specifications END

// comment line characters

CC                    := '//'

// bnf references

std_symbols          ::= class(BNFStandardSymbols)

string               ::= ref(std_string)

name                 ::= ref(std_name)

number               ::= ref(std_integer)

constant             ::= ref(std_constant)

oper_symbols         ::= class(OSIMember)

simple_type_spec     ::= ref(simple_type_spec)

ref_symbol           ::= ref(ref_symbol)

parm_list            ::= ref(parm_list)

extent               ::= ref(extent)

method_symbols       ::= class(OSIMethod)

expr_code            ::= ref(expr_code)

common_symbols       ::= class(OSICommon)

scoped_name          ::= ref(scoped_name)

scope_ext            ::= ref(scope_ext)

identifier           ::= ref(identifier)  

any_type             ::= ref(any_type)

_new                 ::= ref(_new)

_database            ::= ref(_database)