company logo

ESDF exchange schema definition

The definition for CSV or ESDF (Extended Self Delimiter Files) is an extension of a CSV file headline. In the minimal case it only consists of variable names.

In order to support more complex data structures in a comfortable and CSV compatible format, we introduced ESDF, which is a CSV extension, since it supports complex attributes as well as references. In addition, the definition of mapping rules has been added to the file schema in order to provide exchange schema definitions.

Specification

The rules for defining a CSV or ESDF file are described in the subsequent BNF definition. All fields are assumed to be presented as ASCII text (string data type).

The BNF describes the ESDF header. In contrast to CSV, ESDF limits field delimiter to ';', tab and '|', which can be used simultaneously. Undefined BNF symbols name, number and constant are standard symbols.

The file or exchange schema for an ESDF file is usually passed in the first line of the file (headline). I might be passed, however, also separately from the data file or dictionary.

The exchange schema supports three types of property definition:

  • Simply referring to the name (as: name;)
  • In this case, the external column name name will be assigned to the internal property with the same name.

  • Defining an assignment (as: place = city;)
  • Here, the external data provided in column place will be assigned to the database property with the name city).

  • Defining an empty assignment (as: fiirst_name =;)

Assigning an empty value causes the data exchange to ignore the column, i.e. it will be skipped when importing data and an empty column will be created when exporting data.

In order to assign references or relationships, sub-allocations have to be defined. This is the only way to assign key components for the key required for locating an object instance in the database. When the identifying key for the referenced object instance is a single component key, one may directly assign the relationship or reference to the column, e.g. mother_id = mother. In this case, a person(mother) with the person id passed via mother_id in the external table will be assigned or the cossesponding person id will be exported to mother_id.

name;                  // assign name to name

first_name =;          // ignore first_name

place = city;          // assign place to city

mother_id = mother     // associate person with mother_id to mother

                       //   relationship

Notes:

The schema definition must not terminate with a separator, but with a line break. After a separator, always a new field definition is expected. This is also true for embedded sub-allocations.

Definition: 

ESDFSchema            := fields

fields                := field [ field_ext(*) ]

field_ext             := sep field

field                 := [name] [size] [sub_fields] [dimension] [source]

source                := '=' [path]

size                  := '(' number ')'

dimension             := '[' number ']'

sub_fields            := '{' fields '}'

path                  := path_element [ path_extension(*) ]

path_extension        := '.' path_element

path_element          := name [ parameter ]

parameter             := get_parm | provide_parm

get_parm              := '(' value ')'

provide_parm          := '[' value ']'

value                 := path | constant

sep                   := ';' | '|' | '\t'

std_symbols          ::= class(BNFStandardSymbols)

name                 ::= ref(std_name)

number               ::= ref(std_number)

constant             ::= ref(std_constant)

name

A name or identifier is a field name which usually starts with an alphabetic character or underscore and contains ASCII characters and numbers, only.

Number

In this context a number is an integer value.

constant

A constant is either a number, a string constant or a Boolean value.

Usage

The file or exchange schema for an ESDF file is usually passed in the first line(s) of the file (headlines). It might be passed, however, also separately from the data file or dictionary.

// ESDF headline definition

f_pid = pid; fname = name; f_first_name = first_name; f_birth_date= birth_date; f_sex = sex; f_married = married; f_income = income; f_location {f_zip = zip; f_city = city; f_street= street; f_number = number} [3] = location

- Title unknown
Defaults

When names in the headline are identical with database source names, source assignments can be omitted. In order to skip or ignore fields defined in the external file (import data), the name has to be followed by an assignment operator (=) but without referring to a source.

pid; name; first_name; birth_date; sex; married; income; location {zip; city ;street; number } [3]

Schema file

When providing the exchange or file schema separately instead of providing it in the headline, the definition may contain line breaks:

// Separate exchange schema

f_pid         = pid;

f_name        = name;

f_first_name  = first_name;

f_birth_date  = birth_date;

f_sex         = sex;

f_married     = married;

f_income      = ; // do not import income

f_location {

  f_zip = zip;

  f_city = city;

  f_street= street;

  f_number = number

} [3]          = location