ESDF format
The Extended Self Delimiter File format is an extension of the CSV format. ESDF files contain any number of records (instances of a collection) enclosed in parenthesis { ... }. Between properties and lines non or any number of line breaks might be defined. In contrast to CSV, ESDF supports complex attributes and reference collections with variable number of instances. Because ESDF does not provide property names, all properties are interpreted by position.
Since ESDF does not require any tags, it is an efficient way of exchanging large data files. On the other hand, it requires fields being defined in a correct sequence. ESDF files must not contain data of more than one extent or weak-typed collections. Typically, ESDF is used to pass complex data within an application. Thus, the Instance contains ESDF structured instances when not being defined with another format.
Furthermore, ESDF files can be accessed in exportData() and importData() functions (Property and ObjectSpace) or when opening external files by Property::openExtern().
ESDF files may carry the file or data exchange schema directly in the data file (headline). The file or data exchange schema can also be defined in the dictionary or passed separately in any file schema definition format.
Limited access to ESDF files is supported by defining ESDF extents in the dictionary (access type AT_EXTERN). In this case, the file path is expected in an option having the same name as the extent name. No header and no external file description are supported for ESDF extents.
In order to provide more flexible access to ESDF files, a file description has to be passed explicitly to the Property::openExtern() function. In order to provide an external schema definition, any of the supported definition formats might be used (see Data Exchange schema)
ESDF has a simple BNF specification as described below. As line break, new line (NL), carriage return (CR) or both are accepted after headline and between data lines. Headlines are optional. File definitions (headline) might be also passed separately and in any other format.
New lines are not considered as instance separator when being defined within a locator, an item set or an item block.
StringData := Headline | Data | CSV // defined for providing the bnf class name
Headline := fields
fields := field [ field_ext(*) ]
field_ext := sep field
field := [fname] [size] [sub_fields] [dimension] [source]
fname := name | string
source := '=' [path_ref]
path_ref := _null | 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
CSV := csv_items
csv_items := [ cvalue ] [ csv_item_ext(*) ]
csv_item_ext := sep [ cvalue ]
cvalue := string | csv_string
Data := items
items := [ item ] [ item_ext(*) ]
item_ext := sep [ item ]
item := dvalue | locator | item_set | item_block
dvalue := string | svalue
locator := '[' dvalue ']' [ item ]
item_set := '(' items ')'
item_block := '{' items '}'
sep := ';' | '|' | '\t' | ','
_null :: 'NULL'
std_symbols ::= class(BNFStandardSymbols)
spec_symbols ::= class(BNFSpecialSymbols)
svalue ::= ref(spec_value)
csv_string ::= ref(spec_csv_value)
name ::= ref(std_name)
number ::= ref(std_number)
string ::= ref(std_stringn)
constant ::= ref(std_constant)
ESDF files may contain a headline defining the file or exchange schema. Since headlines need not differ syntactically from data lines, the file definition must pass the headline option in order to indicate, that an ESDF file contains a headline at the beginning.
When passing the exchange schema in the data file headline, the schema must be defined completely in the first line. When passing en exchange schema in a separate file, the data exchange definition may contain any number of line breaks.
Another way is defining the data exchange specification in the dictionary (resource database).
ESDF defines a reserved set of delimiter characters. Delimiter characters must not appear in values without being quoted. In contrast to CSV, ESDF requires additional delimiters for instances and collections.
Characters ';', '|' and '\t' (tab) are considered as field delimiters. Field delimiters may appear also mixed, i.e. also when creating an ESDF file using '\t' as field separator, values containing a ';' must be enclosed in string delimiters.
" and ' are considered as string delimiters. The starting string delimiter must be the terminating delimiter, too. Starting a string value with ", the value may contain ' and reverse. When starting string delimiters need to be coded within the string, those must be preceded by an '\'.
'my name is"Paul"' // valid
'my name is\"Paul\"' // valid, same as above
'my name is\'Paul\'' // valid
"myname is 'Paul'" // valid, same as above
Instance delimiters '{' and '}' are used to define begin and end of complex (structured) data values. Instance delimiter may appear within value collections but also outside collections. Instance delimiters are not required for base structure members.
Collection delimiters '[' and ']' are used to define value or instance collections.