1. Data Formats and Recommendations
2. Basic Principle of the Import-Export Tool Explained
3. Opening of and Overview over Import-Export Tool
4. Mapping of Data Sources
3.1 Mapping of Objects
3.2 Mapping of Types
3.3 Mapping of Multiple Values
5. Import Behaviour
6. XML Import
7. Export
4. Imports & Exports
4
Agenda
1. Data Formats and Recommendations
2. Basic Principle of the Import-Export Tool Explained
3. Opening of and Overview over Import-Export Tool
4. Mapping of Data Sources
3.1 Mapping of Objects
3.2 Mapping of Types
3.3 Mapping of Multiple Values
5. Import Behaviour
6. XML Import
7. Export
6. Imports & Exports
6
Export Data Formats
• Standardized database interface for direct connection to relational databases
• MySQL
• ODBC
• Oracle
• PostgreSQL
• LDAP (available for exchanging user IDs)
• .csv/.xlsx
• .rdf
• .owl
• Further formats (e.g. JSON) can be generated through the i-views programming interface – the programming
interface is not part of the import-export tool
19. Imports & Exports
19
Identfiy Columns
• By heading
• When?
• Column headings remain
constant but the order of the
columns doesn’t
• Requirements
• Strings of the column headings
must be identical
Album Artist
The King of Limbs Radiohead
Dummy Portishead
Artist Album
Radiohead The King of Limbs
Portishead Dummy
i-views compares the strings of the
headings and adapts the changes in the
mapping
20. Imports & Exports
20
Identfiy Columns
• By position
• When?
• Column label changes, the type
of information remains the
same
• Requirements
• Column position and
number may not change
Band CD name
Radiohead The King of Limbs
Portishead Dummy
Artist Album
Radiohead The King of Limbs
Portishead Dummy
Content from column 1 always become
artist objects in the network, those
from column 2 are albums objects.
21. Imports & Exports
21
Identfiy Columns
• Über Zeichenposition
• When?
• If the entries are not comma separated
and have a constant length (within a
"column")
• Requirement
• Character position and
number may not change
1 6 7
ID123 F Ida
ID456 M Timmi
ID789 M Max
ID753 F Michaela
Radio h ead
Example data
ID123FIda
ID456MTimmi
ID789MMax
ID753FMichaela
Radiohead
Position of
characters results in
this "table"
The last line makes
little sense, since it
does not
correspond to the
grid
25. Imports & Exports
25
Identification of Objects by Seperator
, Table columns that contain
multiple values can be
identified by specifying the
separator
In the "songs" column multiple
entries are separated by
commas. If the comma is
specified as delimiter, the
import tool can create the songs
as individual objects
"Band"; 'Album'; "Short description album"; "Songs"
'Pink'; "M! ssundaztood"; "Missundaztood is the second studio
album by American singer-songwriter Pink." The album which released
worldwide in late 2001 to global commercial and critical success, critics
welcoming the new pop-rock sound pink presented on the record,
after urban-influenced R & b debut. ";" "M!ssundaztood, Don't let me
get me, Just Like a pill, Get the party started, Respect, 18 Wheeler,
Family portrait, misery, Dear diary, Eventually, Lonely Girl, Numb,
Gone to California, My Vietnam"
34. Imports & Exports
34
Mapping of Data Sources
• „Pink“ is singing the song.
• Furthermore, „Pink“ is a Person.
• We know that the Person singing this song is the creator of the song and can therefor link the song to the creater
„Pink“ with a relation of the type „was created by“.
• The relation target (Pink) is an object of type „Person“.
• This object has an an attribute „Name“ with the value of „Pink“.
38. Imports & Exports
38
Identification of Objects
• Each object needs at least one attribute for identification in the graph database.
• If available, the ID should be used for identification.
If there is no ID, and and one attribute is not
sufficient to uniquely identify an object,
several attributes should be selected (ex.
name and album of the song).
!
44. Imports & Exports
44
Mapping of Multiple Values for One Object Type
If several values are given for an
object type with an object (in our
example, several „Genres“ for each
album), there are three possible
ways the table could look like.
For two of those, the import has to
be adapted.
47. Imports & Exports
47
Settings for Import Behavior
• Update
• Existing items will be overwritten (updated), no new elements will be created.
• Create new
• Creates a new property / object, without considering whether the attribute value or the object already exists, if
possible (note the setting, can occur several times in the attribute definition).
• Create new if not found (only available on attributes)
• Only if no other attribute of the desired type exists, a new one will be applied. (The import multiple attribute
values simultaneously to an attribute type is not possible, since we can not decide which of the attribute
values should be used.)
• Do not import
48. Imports & Exports
48
Settings for Import Behavior
• Delete
• Used to delete exactly the element.
• Delete all with same value (only properties available)
• All attribute values that match the imported value will be deleted for the respective corresponding objects of the
import table.
• Delete all of same kind
• All attribute values of the selected type are deleted for the corresponding objects of the import table, regardless
of whether the values match or not.
Import
49. Imports & Exports
49
Settings for Import Behavior
• Synchronize
• Caution - Sync is also a form of deletion:
• If objects of a type are synchronized, all objects of that type that don't occur in the import table will be deleted,
• If an existing attribute receives no value from an import, it is deleted for the corresponding object of the import table. If the
existing attribute has a different value than in the import table, it is updated, even if it may appear several times.
Import
54. Imports & Exports
54
XPath - Examples
//genre[@label=„Rock“]/@lable
//genre Selects all genres, it does not matter where
they are in the document.
./genre Selects genres, which are a subelement of
the current node.
genre[@label] Selects all genres which hava a lable.
@label Selects the lable itself.
58. Imports & Exports
58
Exporting with Script
• Script mappings are used when special
columns in the target table have to be
created.
• Scripting language: KScript or Javascript
• Example: three attributes from the semantic
graph data base are to be combined to an ID.
• Example: all attributes of a type should be
written separated by comma in a row in the
target table.
59. Imports & Exports
59
Exercise
musicCSVbeispielEinfach.csv
1. Import all albums of a band (with short description).
2. 1 + all songs of an album
musicCSVbeispiel.csv
1. import all bands, album and songs
2. 1 + genre
spicePersonen2.csv
1. Import all band members and all their alternative
names
musicXMLbeispiel2.xml
1. import all bands and albums
2. 1+ prices of the albums
3. import only bands and albums whose albums
cost more than 10 dollars
Export all songs with the mood pleasant
Export all songs and their duration in minutes