company logo

File access parameter

Referring to external files requires a specific parameter list, which defines file location and structure. The parameter list may contain the following named parameters:

  • Path - file location
  • PathOption - Option name for file location
  • FileType - Type of file to be read or created
  • Definition - file and exchange schema
  • Source - exchange schema name in case of multiple sources
  • Headline - headline option

Syntactically, the file operand list is an operand list (operand_list) referring to named parameters. Parameter names listed below are mandatory, but parameters are optional.

FILE EXTENT( Path='c:/temp/my_persons.xml', FileType='xml',

             Definition='c:/temp/my_persons.def', Headline = false)

Definition: 

foperand_list    := path [foptions(*)]

foptions         := ',' foption

foption          := path | path_option |  file_type | definition |source |  headline

File path

At least the file path must be passed as operand to the file access functions. Additional file options can be passed for providing file and exchange schema and file type.

The path name points to the location for storing the file. The complete path name should be enclosed in quotes (single or double) to avoid misinterpretations. The default for path is "Console", which will direct the input or output to the screen.

Definition: 

path := 'Path' '=' string

Path option

Instead of a path definition, a path option may be passed. When executing the file operation, the option value must contain the proper file location. The option name is used as temporary extent name for the property handle. This is important for hierarchical file structures in order to provide a proper name for the root element (e.g. in case of XML output files).

File type

ODABA supports different external file types. The file type need not to be defined,when the file name passed in Path has one of the following extensions:

  • CSV, ESDF - extended self delimiter file (.esdf, .csv)
  • OXML - ODABA xml file (.oxml, .xml)
  • OIF, OEL - object interchange format (.oif, .oel)
  • BINA - binary flat file (.bina)

File type definitions are not case sensitive.

Definition: 

file_type        := 'FileType' '=' type_name

type_name        := 'OXML' | 'OIF' | 'OEL' | 'CSV' |'ESDF' | 'BINA'

File schema

The file or exchange schema can be provided as definition in a dictionary, in which case the structure_name refers to a structure definition in the dictionary. Beside property definitions (file schema), data sources can be assigned, that are referred to in case of import or export operations.

The file or exchange schema might provided in a separate file as ODL (.odl), OXML (.oxsd) or ESDF (.esdf) definition files, in which case the location is passed as quoted string pointing to the file location. The format of the file schema need not to correspond to the format of the data file, i.e. one may pass an ODL exchange schema for importing an XML file.

When the file schema is not passed explicitly, the file schema is supposed to be part of the external file (e.g. headline in an ESDF file). The file or exchange schema can also be provided together with the data (and in the format according to the file type). In this case, the definition format has to correspond to the format of the data file.

  • BINA - no file definition supported in the file
  • CSV, ESDF - ESDF headline format
  • OXML - OXSD schema definition
  • OIF - ODL definition

The system determines the proper type for the definition file from the file extension. When no valid extension has been detected, the system tries to analyze the definition file type by file content:

  • first character '<' : OXML format
  • first character '{' or beginning with a word followed by a separator : ESDF format
  • Beginning with schema keyword: ODL format.
  • Beginning with META: OEL format
Definition: 

file_schema      := 'Definition' '=' def_location

def_location     := structure_name | string

Exchange schema name

When using data exchange by means of exchange schema, the schema name, which is used as source name in property definitions has to be passed. In this case, properties with a source definition containing the exchange name are included in the file operation, only.

Headline option

The headline option indicates, whether the external data file includes the file schema (typically the headline in CSV or ESDF files). Either headline or schema location must be provided in order to obtain the file schema for input operation.

In case of output operation, the file schema is written to the export file prior to the data. Existing schema definition in the output file header will be ignored, i.e.the exchange schema must be defined in a separate definition (database schema or schema file). When no exchange schema has been provided, the input structure is used as an implicit exchange schema, i.e. all attributes and depending object instances are exported to the output.

When defining both, the schema location is used. In some cases, schema location is verified against the headline definition.

Definition: 

headline := 'Headline' '=' boolean