company logo

Data exchange

Data Exchange provides different ways of importing or exporting data from an ODABA database to extended comma separated files (ESDF, CSV), to xml files (OXML, XML) or to object interchange format files (OIF). OIF is the proposed standard format for exchanging data between object-oriented databases (ODMG).

While the capabilities of ESDF and CSV are limited, OXML and OIF allow transferring the complete content of a database. Even though XML is the more common format, OIF has the advantage that it should be supported by all object oriented databases and it requires less space.

Besides different file formats ODABA provides different data exchange technologies.

Command line tools

In order to import or export data, one may prepare your data exchange specifications and run them from an OSI script or as embedded OSI in an OShell script. The example below shows an example for an OSI data import specification.In order to call OSI from a command line or command file, the following parameters have to be passed (supposed, the current directory is the ODABA installation folder):

    OSI.exe projects/Spielwiese/osi/ImportFilm.osi -I(projects/Spielwiese/OShell.ini)

DATASOURCE='Spielwiesedata';

bool      main()

{

Film.fromFile(Path='q:\\Spielwiese\\csv\\film.csv',

           Definition='q:\\Spielwiese\\OShellProcedures\\ExportFilm.fsc',

           FileType='esdf');

}

// data exchange specification (ExportFilm.fsc)

id = __AUTOIDENT;  // Names differ: csv_name = db_name

title;             // names are idetical

description;

release_year;

dub_languages {ident = iso_code} = dub_languages[0];  // assign object link

original_languages {ident = iso_code} = original_languages[0];

rental_duration = rental_duration;

rental_rate;

length;

replacement_cost;

rating;

special_features [4]

Import

Import provides features for importing a file with a valid import format into an ODABA database. This is a preferred way for importing data periodically, in which case a batch job can be prepared and called whenever required.

It is a possible but not the most comfortable way for ad-hoc import processes,which can be solved better with the GUI Data Exchange or from within OSI programs.

Export

Export provides features for exporting selected data from an ODABANG database to a file with one of the supported external data formats. This is also a preferred way for exporting data periodically, while ad-hoc data export becomes more comfortable from within OSI or by using the GUI DataExchange tool.

GUI tool

The Data Exchange GUI tool provides features for designing the content of a data exchange and running the data exchange directly or creating a data exchange definition file (data exchange schema).

The data exchange schema can be referred to later when calling the command line tool or from within an OSI script.

The GUI tool provides the most comfortable way for designing a data exchange schema. It allows also running the defined data exchange (e.g.for testing purpose).

OSI Expression

Often, data exchange is simple and can be directly called from within an OSI expression. OSI OQL provides two built-in functions in order to import and export data. Those functions are the same functions which are called from the command line and the GUI tool.

toFile

ToFile writes data from a defined collection to an external file with one of the defined formats. The OSI query may create a view for the data to be exported. Since the data exchange schema supports property selections, this is, however, not necessary in most cases.

FromFile

FromFile imports data from an external file with one of the supported formats into a collection. In general, one cannot import data into a view, but there are views that are partially update-able, which would allow importing data as well.