我是OrientDB的新手,在将.csv(MovieLens)数据集导入OrientDB时遇到问题。
这是.csv文件的格式
movieId , title , genres
1 , Toy Story (1995) , Adventure|Animation|Children|Comedy|Fantasy
2 , Jumanji (1995) , Adventure|Children|Fantasy
3 , Grumpier Old Men (1995) , Comedy|Romance
4 , Waiting to Exhale (1995) , Comedy|Drama|Romance
5 , Father of the Bride Part II (1995), Comedy
6 , Heat (1995) , Action|Crime|Thriller
我将“Genres”字段与“|”分开时遇到问题。我在orientdb studio中创建了split函数,并在JSON ETL配置脚本中调用它,它仍然无法识别它并抛出异常。
Split Function in OrientDB Studio
Exception JSON脚本:
{
"config": {
"log": "info",
parallel: false
},
"source": { "file": { "path": "E:\Orient DB\OrientDB Project\Project DataSet MovieLens\ml-latest\movies.csv"} },
"extractor": { "row": {} },
"transformers": [
{ "csv": {"separator": ",",
"columnsOnFirstLine":true,
"columns":["id","title:string","genres"]}},
{ "field": { "fieldName": "genresArray", "expression": " split(genres,'|') "} },
{ "field": { "fieldName": "genresArray_0", "expression": "genresArray[0]"} },
{ "field": { "fieldName": "genresArray_1", "expression": "genresArray[1]"} },
{ "field": { "fieldName": "genresArray_2", "expression": "genresArray[2]"} },
{ "field": { "fieldName": "genresArray_3", "expression": "genresArray[3]"} },
{ "field": { "fieldName": "genresArray_4", "expression": "genresArray[4]"} },
{ "field": { "fieldName": "genresArray_5", "expression": "genresArray[5]"} },
{ "vertex": { "class": "Movies" } },
{ "edge": {
"class": "HasGenera",
"joinFieldName": "genresArray_0",
"lookup": "Genres.description",
"unresolvedLinkAction": "CREATE"
} },
{ "edge": {
"class": "HasGenera",
"joinFieldName": "genresArray_1",
"lookup": "Genres.description",
"unresolvedLinkAction": "CREATE"
} },
{ "edge": {
"class": "HasGenera",
"joinFieldName": "genresArray_2",
"lookup": "Genres.description",
"unresolvedLinkAction": "CREATE"
} },
{ "edge": {
"class": "HasGenera",
"joinFieldName": "genresArray_3",
"lookup": "Genres.description",
"unresolvedLinkAction": "CREATE"
} },
{ "edge": {
"class": "HasGenera",
"joinFieldName": "genresArray_4",
"lookup": "Genres.description",
"unresolvedLinkAction": "CREATE"
} },
{ "edge": {
"class": "HasGenera",
"joinFieldName": "genresArray_5",
"lookup": "Genres.description",
"unresolvedLinkAction": "CREATE"
} }
],
"loader": {
"orientdb": {
"dbURL": "remote:localhost/MovieRating",
"dbType": "graph",
"standardElementConstraints": false,
"classes": [
{"name": "Movies", "extends": "V"},
{"name": "Genres", "extends": "V"},
{"name": "HasGenera", "extends": "E"}
], "indexes": [
{"class":"Movies", "fields":["id:integer"], "type":"UNIQUE" },
{"class":"Genres", "fields":["description:string"], "type":"UNIQUE_HASH_INDEX" }
]
}
}
}