我有2个csv文件.
Person.csv
ID,PetID,Jumps
1,101,Yes
2,102,No
3,103,Yes
Pet.csv
ID,Name
101,Dog
102,Cat
103,Rabbit
我正在编写ETL以使用这两个实体填充我的图形.
我想在Person和Pet之间添加一个HAS_PET边.我也希望这个边缘有一个名为Jumps的属性.我怎样才能实现这一目标?
我尝试如下,
{
"source":{
"file":{
"path":"C:/Users/60886/Project/person.csv"
}
},
"extractor":{
"row":{
}
},
"transformers":[
{
"csv":{
}
},
{
"vertex":{
"class":"Person"
}
},
{
"edge":{
"class":"HAS_PET",
"joinFieldName":"PETID",
"lookup":"PET.ID",
"direction":"out",
"unresolvedLinkAction":"NOTHING"
}
}
],
"loader":{
"orientdb":{
"dbURL":"remote:localhost/GratefulDeadConcerts",
"dbType":"graph",
"wal":false,
"tx":false,
"batchCommit":1000
}
}
}
最佳答案 在边缘变换器中,使用edgeFields绑定边缘中的属性.例:
"edge":{
"class":"HAS_PET",
"joinFieldName":"PETID",
"lookup":"PET.ID",
"direction":"out",
"edgeFields": { "Jumps": "${input.Jumps}" },
"unresolvedLinkAction":"NOTHING"
}
请记住在边缘变换器之后从顶点删除“跳转”,使用:
"field": { "fieldName": "Jump", "operation": "remove" },