[Studio version : 2.0 OrientDB version : 2.0.3] ETL - Importing JSON to OrientDB

58 views
Skip to first unread message

Kiheung Park

unread,
Mar 4, 2015, 7:06:02 PM3/4/15
to orient-...@googlegroups.com
Hi,

I want to load JSON formatted data into OrientDB. I have studied all the tutorial materials and sample codes that are provided by orient technologies teams. 
However, I am having a hard time to figuring what did I do wrong when importing JSON.

I have already designed the document based database called "AgendDatabase_Document" and here is schema of Politician Class:

And here is my sample json (input file / source):

[{
    "affiliatedCommittee": [
        "국회운영위원회",
        "안전행정위원회"
    ],
    "age": 0,
    "birthPlace": "",
    "birthday": "6/4/1960",
    "class": "Politician",
    "constituency": "경남 창원시성산구",
    "contact": {
        "address": null,
        "class": "Contact",
        "phoneNumber": null
    },
    "education": {
        "class": "Education",
        "degreeStatus": null,
        "department": null,
        "highschool": "마산공업고등학교",
        "major": null,
        "university": null
    },
    "experience": {
        "class": "Experience",
        "experience": [
            "경남도의회 의원 (7대, 8대), 새누리당 경남도당 수석부대변인"
        ]
    },
    "gender": true,
    "group": [
        "19"
    ],
    "military": "",
    "name": "강기윤",
    "nationality": "대한민국",
    "partyName": "새누리당"
}]


And here is my ETLpolitician.json on bin directory.
{
"config": {
"log": "debug"
},
"begin": [
],
"source": {
"file": { "path": "./ETLPolitician.json", "lock": true } //have tried ETLPolitician.json, but didn't work as well...
},
"extractor": {
"json": {}
},
"transformers": [
{ "document": { "class": "Politician"}}
],
"loader": {
"orientdb": {
"dbURL: "plocal:../databases/AgentDatabase_Document",
"dbUser": "admin",
"dbPassword": "admin",
"dbAutoCreate": false,
"tx": false,
"batchCommit": 1000,
"dbType": "document"
}
},

When I run oetl.bat ETLPolitician.json , I got following error message...

 
Can anyone help me on importing JSON? DEFINITELY NEED MORE DOCUMENTATIONS!!! :(

Sincerely, 

Ki

Kiheung Park

unread,
Mar 4, 2015, 10:45:45 PM3/4/15
to orient-...@googlegroups.com
I have fixed ETLPolitician.json as follow:

{
"config": {
"log": "debug"
},
"begin": [
],
"source": {
"file": { "path": "./ETLPolitician.json", "lock": true }
},
"extractor": {
"json": {}
},
"transformers": [
{ "document": { "class": "Politician"}}
],
"loader": {
"orientdb": {
"dbURL": "plocal:../databases/AgentDatabase_Document",
"dbUser": "admin",
"dbPassword": "admin",
            "dbAutoCreate": false,
            "standardElementConstraints":  false,

"tx": false,
"batchCommit": 1000,
            "dbType": "document",
            "classes": [{ "name": "Politician", "extends": "Agent" } ],
            "indexes": [{ "class": "Politician", "fields": ["name:string"], "type":"NOTUNIQUE_HASH_INDEX" }]
}
}
}

And now having another error message,

Is ETL only support 'graph' type database? Should I go for graph? 

Best, 

Ki

Kiheung Park

unread,
Mar 4, 2015, 11:48:41 PM3/4/15
to orient-...@googlegroups.com
So I changed into 'graph' (database type) and tried.

And the error message says "The process cannot access the file because another process has locked a portion of the file."

Thus, from the source section on json file, I have changed "lock" to false instead true. NOW IT SEEMS RUNNING BUT FAILED TO FULLY OPERATED.

Got a new error that saying, "the class 'Politician' does not extend class 'V' and therefore cannot be considered a Vertex."

I have created class 'Agent' extends class 'V', then created class 'Politician' extends class 'Agent'.

How should I change the following (bold) area. Please help me sir...

{
"config": {
"log": "debug"
},
"begin": [
],
"source": {
"file": { "path": "politician_sample.json", "lock": false }
},
"extractor": {
"json": {}
},
"transformers": [
{ "vertex": { "class": "Politician"}}
],
"loader": {
"orientdb": {
"dbURL": "plocal:../databases/AgentDatabase_Document",
"dbUser": "admin",
"dbPassword": "admin",
            "dbAutoCreate": false,
            "standardElementConstraints":  false,
"tx": false,
"batchCommit": 1000,
            "dbType": "graph",
Reply all
Reply to author
Forward
0 new messages