Transcript
Page 1: L4: imports exports (english)

i-viewsUniversityPart04:Imports&Exports

Page 2: L4: imports exports (english)

Imports&Exports

2

Ifyouhaveproblemswiththesound:- Checktheaudiosettingsinmenuitem „Communicate“- Joinalternativelybytelephoneorbydial-innumber

from landline phone (for free):• 000-800-100-8171 for India• 0800-894627for Switzerland

from mobilephone• +41434569564 only for Switzerland

Event-Number: 841561659Event-Password: hello

Page 3: L4: imports exports (english)

Imports&Exports

3

Today‘s Speaker

AnnekathrinLösche

KnowledgeEngineer

intelligentviews gmbh

Page 4: L4: imports exports (english)

Imports&Exports

4

Agenda1. DataFormatsand Recommendations

2. BasicPrinciple of the Import-ExportToolExplained

3. Opening of and Overview over Import-ExportTool

4. Mappingof DataSources3.1Mappingof Objects

3.2Mappingof Types

3.3Mappingof MultipleValues

5. ImportBehaviour

6. XMLImport

7. Export

Page 5: L4: imports exports (english)

Imports&Exports

5

ImportDataFormats• Standardized database interface for direct connection to relationaldatabases

• MySQL

• ODBC

• Oracle

• PostgreSQL

• LDAP(available for exchanging user IDs)

• .csv/.xlsx

• .xml• .rdf

• .owl

Page 6: L4: imports exports (english)

Imports&Exports

6

ExportDataFormats• Standardized database interface for direct connection to relationaldatabases

• MySQL

• ODBC

• Oracle

• PostgreSQL

• LDAP(available for exchanging user IDs)

• .csv/.xlsx

• .rdf

• .owl

• Furtherformats (e.g.JSON)can be generated through the i-views programming interface – the programminginterface is notpart of the import-exporttool

Page 7: L4: imports exports (english)

Imports&Exports

7

Import-RecommendationsThereisnobackbutton!

• Toavoidunnessecaryfallbacks,importsshouldfirstbetestedinalocalcopyofthenetwork

Thedatabasestructureshouldnotbecreatedviaimports!• Importsshouldnotbeusedtobuildthedatamodel

• Relation- andattributetypescannotbedefinedduringtheimport

Largefilesshouldnotbeimporteduntested!• Importmappingsshouldbetestedwithasmallsamplefile

Page 8: L4: imports exports (english)

Imports&Exports

8

BasicPrinciple:Mappingwith the Import-ExportTool• MAPPING=assigningtable-columns/xml-tagstothe

datamodelini-views

Artist Album

Radiohead TheKingoflimbs

Portishead Artist

Nameoftheobject

Album

Page 9: L4: imports exports (english)

Imports&Exports

9

BasicPrinciple:Mappingwith the Import-ExportTool

Artist Album

Radiohead TheKingoflimbs

Portishead Artist

Nameoftheobject

Album

Page 10: L4: imports exports (english)

Demonstration

Importsettings

Page 11: L4: imports exports (english)

Imports&Exports

11

Opening the Import-ExportTool• Locationoftheimport-exporttool:

• Folder->WorkingfolderorPrivate

• Technical->Registeredobjects->Datasources

Page 12: L4: imports exports (english)

Imports&Exports

12

Opening the Import-ExportTool• Importand export mappings require:• Name

• Informationof the format to be imported

Page 13: L4: imports exports (english)

Imports&Exports

13

Example File(.csv)

"Band";“Album”;"Shortdescriptionalbum";"Songs"

“Pink”;"M!ssundaztood";"MissundaztoodisthesecondstudioalbumbyAmericansinger-songwriterPink."Thealbumwhichreleasedworldwideinlate2001toglobalcommercialandcriticalsuccess,criticswelcomingthenewpop-rocksoundpinkpresentedontherecord,afterurban-influencedR&bdebut.";"M!ssundaztood,Don'tletmegetme,JustLikeapill,Getthepartystarted,Respect,18Wheeler,Familyportrait,misery,Deardiary,Eventually,LonelyGirl,Numb,GonetoCalifornia,MyVietnam"

Page 14: L4: imports exports (english)

Imports&Exports

14

ReadDatafrom Import-File

1.Selectfiletoimport(mustcorrespondtoformatoftheimport)

2.Read/updatestructureofthe

table

Page 15: L4: imports exports (english)

Imports&Exports

15

Choose TableFileType

Selectfiletype(default:.csv)

Page 16: L4: imports exports (english)

Imports&Exports

16

Identifying Headings

Ifthefirstlineconsistsofheadingsandthevaluesofthecellsarein““- puta

checkmarkhere

"Band";'Album';"Shortdescriptionalbum";"Songs"

'Pink';"M!ssundaztood";"MissundaztoodisthesecondstudioalbumbyAmericansinger-songwriterPink."Thealbumwhichreleasedworldwideinlate2001toglobalcommercialandcriticalsuccess,criticswelcomingthenewpop-rocksoundpinkpresentedontherecord,afterurban-influencedR&bdebut.";""M!ssundaztood,Don'tletmegetme,JustLikeapill,Getthepartystarted,Respect,18Wheeler,Familyportrait,misery,Deardiary,Eventually,LonelyGirl,Numb,GonetoCalifornia,MyVietnam"

Page 17: L4: imports exports (english)

Imports&Exports

17

Identifying Columns

Theidentificationofcolumnsisverythatimportantforone-timeimports.

Ifamappingisusedforimportingvariousfilesorperiodicallyrecurringimports,thisoptionisveryimportant.

Page 18: L4: imports exports (english)

Imports&Exports

18

Identfiy Columns• Ifthestructureofafileischanged

(columnsrenamed,sequencechanged,etc.),themappinghastobeadaptedtothesechanges

• Ifi-viewscanidentifythecolumns,themappingdoesn'thavetobeadaptedmanually

Album Artist

TheKingofLimbs Radiohead

Dummy Portishead

Artist Album

Radiohead TheKingofLimbs

Portishead Dummy

Page 19: L4: imports exports (english)

Imports&Exports

19

Identfiy Columns• Byheading• When?

• Columnheadingsremainconstantbuttheorderofthecolumnsdoesn’t

• Requirements

• Stringsofthecolumnheadingsmustbeidentical

Album Artist

TheKingofLimbs Radiohead

Dummy Portishead

Artist Album

Radiohead TheKingofLimbs

Portishead Dummy

i-viewscomparesthestringsoftheheadingsandadaptsthechangesinthe

mapping

Page 20: L4: imports exports (english)

Imports&Exports

20

Identfiy Columns• Byposition• When?

• Columnlabelchanges,thetypeofinformationremainsthesame

• Requirements

• Columnpositionandnumbermaynotchange

Band CDname

Radiohead TheKingofLimbs

Portishead Dummy

Artist Album

Radiohead TheKingofLimbs

Portishead Dummy

Contentfromcolumn1alwaysbecomeartistobjectsinthenetwork,thosefromcolumn2arealbumsobjects.

Page 21: L4: imports exports (english)

Imports&Exports

21

Identfiy Columns• ÜberZeichenposition• When?

• Iftheentriesarenotcommaseparatedandhaveaconstantlength(withina"column")

• Requirement

• Characterpositionandnumbermaynotchange

1 6 7

ID123 F Ida

ID456 M Timmi

ID789 M Max

ID753 F Michaela

Radio h ead

Exampledata

ID123FIdaID456MTimmiID789MMaxID753FMichaelaRadiohead

Positionofcharactersresultsin

this"table"

Thelastlinemakeslittlesense,sinceit

doesnotcorrespondtothe

grid

Page 22: L4: imports exports (english)

Imports&Exports

22

Choosing the Seperator

Indicationofthecharacterthatseparatesthe

valuesintheCSVfile

"Band";'Album';"Shortdescriptionalbum";"Songs"

'Pink';"M!ssundaztood";"MissundaztoodisthesecondstudioalbumbyAmericansinger-songwriterPink."Thealbumwhichreleasedworldwideinlate2001toglobalcommercialandcriticalsuccess,criticswelcomingthenewpop-rocksoundpinkpresentedontherecord,afterurban-influencedR&bdebut.";""M!ssundaztood,Don'tletmegetme,JustLikeapill,Getthepartystarted,Respect,18Wheeler,Familyportrait,misery,Deardiary,Eventually,LonelyGirl,Numb,GonetoCalifornia,MyVietnam"

Page 23: L4: imports exports (english)

Imports&Exports

23

Encoding

Characterencodingoftextinthe.csv

file

Page 24: L4: imports exports (english)

Imports&Exports

24

LineSeperator

Methodbywhichthelinesareseparatedfromeachother

InWindowsyoucanselect"autodetect"orCR-LF

CR=carriagereturn(beginningoftheline)

LF=linefeed(nextline)

Page 25: L4: imports exports (english)

Imports&Exports

25

Identification of Objectsby Seperator

, Tablecolumnsthatcontainmultiplevaluescanbe

identifiedbyspecifyingtheseparator

Inthe"songs"columnmultipleentriesareseparatedbycommas.Ifthecommaisspecifiedasdelimiter,the

importtoolcancreatethesongsasindividualobjects

"Band";'Album';"Shortdescriptionalbum";"Songs"

'Pink';"M!ssundaztood";"MissundaztoodisthesecondstudioalbumbyAmericansinger-songwriterPink."Thealbumwhichreleasedworldwideinlate2001toglobalcommercialandcriticalsuccess,criticswelcomingthenewpop-rocksoundpinkpresentedontherecord,afterurban-influencedR&bdebut.";""M!ssundaztood,Don'tletmegetme,JustLikeapill,Getthepartystarted,Respect,18Wheeler,Familyportrait,misery,Deardiary,Eventually,LonelyGirl,Numb,GonetoCalifornia,MyVietnam"

Page 26: L4: imports exports (english)

Imports&Exports

26

Creating Logs

Foraneasycontroloftheimportresults,theimportedobjectscanbecollectedinafolder.Thisfoldermusthavebeencreatedpreviously

Create"NewSemanticelementsfolder"(whetherinthePrivateorWorkingFolder)

andselectduringimportmapping.

Page 27: L4: imports exports (english)

Imports&Exports

27

Registry

Registrykeysfordatasourcescanbesetintheregistry.

Registereddatasourcescanbeusedagaininanothercontext.

Anyotheruseofthisdatasourcecanbeviewed.

Page 28: L4: imports exports (english)

Buildingyourimportmapping

Demonstration

Page 29: L4: imports exports (english)

Imports&Exports

29

MappingTools

Themappingsforimportsandexportsarebuiltusingthesebuildingblocks.

Object

Type

Attribute

Relation

Extension

Deletemappingmodule

Forexport:Exporttheobjectinventoryofa

folder

Forexport:Exportresultslistofasearch

Forexport:Modifythevalueofacellwith

script

Forexport:Exportinternali-

viewsID

MoveImport/ExportMapping

toanotherwindow

ForexportofSearch:

Objectswiththisidentifier

Export! specificobjectImportstepbystep!

Import!

Page 30: L4: imports exports (english)

Imports&Exports

30

Mappingof DataSources

Page 31: L4: imports exports (english)

Imports&Exports

31

Object Mapping

Page 32: L4: imports exports (english)

Imports&Exports

32

AttributeMapping(1stColumn)

• Eachcolumnheadingcanbemappedtoanattribute;eachcellrepresentsanattributevalue(canalsobeempty)

Page 33: L4: imports exports (english)

Imports&Exports

33

Mappingof DataSources

Page 34: L4: imports exports (english)

Imports&Exports

34

Mappingof DataSources

• „Pink“is singing the song.

• Furthermore,„Pink“is aPerson.

• We know that the Personsinging this song is the creator of the song and can therefor linkthe song to the creater„Pink“with arelation of the type„wascreated by“.

• Therelation target (Pink)is anobject of type„Person“.

• Thisobject has anan attribute „Name“with the value of „Pink“.

Page 35: L4: imports exports (english)

Imports&Exports

35

RelationMapping

• Eachrelationneedsasourceandatarget

Page 36: L4: imports exports (english)

Imports&Exports

36

AttributeMapping(2ndColumn)

• Each column heading can be mapped to anattribute,each of this column‘s cell represents anattribute value (it can be empty though)

Page 37: L4: imports exports (english)

Imports&Exports

37

Mappingof DataSources

Page 38: L4: imports exports (english)

Imports&Exports

38

Identification of Objects

• Each object needs atleastone attribute for identification inthe graph database.

• If available,the IDshould be used for identification.

IfthereisnoID,andandoneattributeisnotsufficienttouniquelyidentifyanobject,severalattributesshouldbeselected(ex.nameandalbumofthesong).

!

Page 39: L4: imports exports (english)

Imports&Exports

39

TypeIllustration

• Typescanalsobeimportedandexported.Forexample,thegenresofsongsaretobeimportedastypes.Thesongsshouldbespecificobjectsofgenretypes.

Page 40: L4: imports exports (english)

Imports&Exports

40

Mappingof Types

!

Page 41: L4: imports exports (english)

Imports&Exports

41

Mappingof Types

Page 42: L4: imports exports (english)

Imports&Exports

42

Mappingof Types – SpecialCase

• Differenttypescanbepresentinonecolumnofatable.This case canalsobemapped.

Page 43: L4: imports exports (english)

Imports&Exports

43

AttributeTypes

• Adate/timecan be assigned to anattribute of type„date“.

• Booleanattributens and selection attributes can beassigned the corresponding values from the database.

Page 44: L4: imports exports (english)

Imports&Exports

44

Mappingof MultipleValuesfor One Object Type

If several values are given for anobject typewith anobject (inourexample,several „Genres“for eachalbum),there are three possibleways the table could look like.For two of those,the import has tobe adapted.

Page 45: L4: imports exports (english)

Imports&Exports

45

Mappingof MultipleValuesfor One Object Type

Page 46: L4: imports exports (english)

Imports&Exports

46

Settingsfor ImportBehavior

• Foreachitemitsownimportbehaviorcanbedetermined.

• Defaultsetting:"Updateorcreateifnotfound"• Existingelementswillbeoverwritten,iftheyarenotpresent,theywillbecreated

YoucanspecifytheImportbehaviour.

Page 47: L4: imports exports (english)

Imports&Exports

47

Settingsfor ImportBehavior• Update

• Existingitemswillbeoverwritten(updated),nonewelementswillbecreated.

• Createnew

• Createsanewproperty/object,withoutconsideringwhethertheattributevalueortheobjectalreadyexists,ifpossible(notethesetting,canoccurseveraltimesintheattributedefinition).

• Createnewifnotfound(onlyavailableonattributes)

• Onlyifnootherattributeofthedesiredtypeexists,anewonewillbeapplied.(Theimportmultipleattributevaluessimultaneouslytoanattributetypeisnotpossible,sincewecannotdecidewhichoftheattributevaluesshouldbeused.)

• Donotimport

Page 48: L4: imports exports (english)

Imports&Exports

48

Settingsfor ImportBehavior• Delete

• Usedtodeleteexactlytheelement.

• Deleteallwithsamevalue(onlypropertiesavailable)

• Allattributevaluesthatmatchtheimportedvaluewillbedeletedfortherespectivecorrespondingobjectsoftheimporttable.

• Deleteallofsamekind

• Allattributevaluesoftheselectedtypearedeletedforthecorrespondingobjectsoftheimporttable,regardlessofwhetherthevaluesmatchornot.

Import

Page 49: L4: imports exports (english)

Imports&Exports

49

Settingsfor ImportBehavior• Synchronize

• Caution- Syncisalsoaformofdeletion:• Ifobjectsofatypearesynchronized,allobjectsofthattypethatdon'toccurintheimporttablewillbedeleted,

• Ifanexistingattributereceivesnovaluefromanimport,itisdeletedforthecorrespondingobjectoftheimporttable.If theexistingattributehasadifferentvaluethanintheimporttable,itisupdated,evenifitmayappearseveraltimes.

Import

Page 50: L4: imports exports (english)

Imports&Exports

50

XMLImport

• AllXMLfiles can be imported into i-views.

• JSONpreprocessingpossible

• XSLTtransformationpossible

Page 51: L4: imports exports (english)

Imports&Exports

51

XMLImport• OptionsofdatasourcefileorURI

• Tagscanbereadthroughthebutton"Readfromdatasource"

Page 52: L4: imports exports (english)

Imports&Exports

52

XMLImport

- Adding anXPath expression

Page 53: L4: imports exports (english)

Imports&Exports

53

XMLImport• Anitemmaybedisplayedineachcaseononeday.

• X-pathexpressionscanbeusedforamapping,too.

Page 54: L4: imports exports (english)

Imports&Exports

54

XPath - Examples

//genre[@label=„Rock“]/@lable

//genre Selectsallgenres,itdoesnotmatterwheretheyareinthedocument.

./genre Selects genres,which are asubelement ofthe current node.

genre[@label] Selects allgenres which hava alable.

@label Selects the lable itself.

Page 55: L4: imports exports (english)

Imports&Exports

55

Export• Theexportmappingissimilartotheimportmapping

• Columnsmustbedefinedmanually.

• Exportsettingsperelement:ExportAllorDonotexport

Page 56: L4: imports exports (english)

Imports&Exports

56

Exporting QueryResults

Exportofstructurequeryresultspossible.

Withidentifiersyoucanaccessindividualelements.

Page 57: L4: imports exports (english)

Imports&Exports

57

ExportDetails• Exportofcollectionsofsemanticobjectsispossible

• Exportofindividualsemanticelementsispossible

• ExportoftheframeIDsasastringor64-bitintegerispossible

Page 58: L4: imports exports (english)

Imports&Exports

58

Exporting with Script• Scriptmappingsareusedwhenspecialcolumnsinthetargettablehavetobecreated.

• Scriptinglanguage:KScriptorJavascript

• Example:threeattributesfromthesemanticgraphdatabasearetobecombinedtoanID.

• Example:allattributesofatypeshouldbewrittenseparatedbycommainarowinthetargettable.

Page 59: L4: imports exports (english)

Imports&Exports

59

ExercisemusicCSVbeispielEinfach.csv

1. Importallalbumsofaband(withshortdescription).

2. 1+allsongs of analbum

musicCSVbeispiel.csv

1. importallbands,albumandsongs

2. 1+genre

spicePersonen2.csv

1. Importallbandmembersandalltheiralternativenames

musicXMLbeispiel2.xml

1. importallbandsandalbums

2. 1+pricesofthealbums

3. importonlybandsandalbumswhosealbumscostmorethan10dollars

Exportallsongswiththemoodpleasant

Exportallsongsandtheirdurationinminutes

Page 60: L4: imports exports (english)

Imports&Exports

60

Sendyour questions to:[email protected]

Consultationhours:EveryWednesday

Thank you for visitingi-viewsUniversity

Page 61: L4: imports exports (english)

Imports&Exports

61

UnsereneuenIcons


Top Related