OrientDB 官方 etl 工具 导入 csv文件

beers.csv: contains the beer records
breweries.csv: contains the breweries records
breweries_geocode.csv: contains the geocodes of the breweries. This file is not used in this Tutorial
categories.csv: contains the beer categories
styles.csv: contains the beer styles

beers.csv:包含啤酒记录
breweries.csv:包含啤酒厂记录
breweries_geocode.csv:包含啤酒厂的地理编码。 本教程中未使用此文件
categories.csv:包含啤酒类别
styles.csv:包含啤酒风格

Nodes: Beer, Category, Style, Brewery;
Relationships: HasCategory, HasStyle, HasBrewery.

节点:啤酒,类别,风格,啤酒厂;
关系:有类别,有风格,有啤酒厂。

{
  "source": { "file": { "path": "D:/WorkSpaces/data/orientdb/openbeerdb/categories.csv" } },
  "extractor": { "csv": {} },
  "transformers": [
    { "vertex": { "class": "Category" } }
  ],
  "loader": {
    "orientdb": {
       "dbURL": "remote:localhost/openbeerdb",
       "dbType": "graph",
	   "dbUser": "root",
	   "dbPassword": "root",
	   "serverUser": "root",
	   "serverPassword": "root",
       "classes": [
         {"name": "Category", "extends": "V"}
       ], "indexes": [
         {"class":"Category", "fields":["id:integer"], "type":"UNIQUE" }
       ]
    }
  }
}
{
  "source": { "file": { "path": "D:/WorkSpaces/data/orientdb/openbeerdb/styles.csv" } },
  "extractor": { "csv": {} },
  "transformers": [
    { "vertex": { "class": "Style" } },
    { "edge": { "class": "HasCategory",  "joinFieldName": "cat_id", "lookup": "Category.id" } }
  ],
  "loader": {
    "orientdb": {
       "dbURL": "remote:localhost/openbeerdb",
       "dbType": "graph",
	   "dbUser": "root",
	   "dbPassword": "root",
	   "serverUser": "root",
	   "serverPassword": "root",
       "classes": [
         {"name": "Style", "extends": "V"},
         {"name": "HasCategory", "extends": "E"}
       ], "indexes": [
         {"class":"Style", "fields":["id:integer"], "type":"UNIQUE" }
       ]
    }
  }
}
{
  "config" : { "haltOnError": false },
  "source": { "file": { "path": "D:/WorkSpaces/data/orientdb/openbeerdb/beers.csv" } },
  "extractor": { "csv": { "columns": ["id","brewery_id","name","cat_id","style_id","abv","ibu","srm","upc","filepath","descript","last_mod"],
                                "columnsOnFirstLine": true } },
  "transformers": [
    { "vertex": { "class": "Beer" } },
    { "edge": { "class": "HasCategory",  "joinFieldName": "cat_id", "lookup": "Category.id" } },
    { "edge": { "class": "HasBrewery",  "joinFieldName": "brewery_id", "lookup": "Brewery.id" } },
    { "edge": { "class": "HasStyle",  "joinFieldName": "style_id", "lookup": "Style.id" } }
  ],
  "loader": {
    "orientdb": {
       "dbURL": "remote:localhost/openbeerdb",
       "dbType": "graph",
	   "dbUser": "root",
	   "dbPassword": "root",
	   "serverUser": "root",
	   "serverPassword": "root",
       "classes": [
         {"name": "Beer", "extends": "V"},
         {"name": "HasCategory", "extends": "E"},
         {"name": "HasStyle", "extends": "E"},
         {"name": "HasBrewery", "extends": "E"}
       ], "indexes": [
         {"class":"Beer", "fields":["id:integer"], "type":"UNIQUE" }
       ]
    }
  }
}