gpt4 book ai didi

etl - 通过 Orientdb ETL 添加 Edge 属性

转载 作者:行者123 更新时间:2023-12-04 21:54:33 24 4
gpt4 key购买 nike

我有 2 个 csv 文件。

人.csv

ID,PetID,Jumps
1,101,Yes
2,102,No
3,103,Yes

宠物.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绑定(bind)边缘中的属性。例子:

"edge":{
"class":"HAS_PET",
"joinFieldName":"PETID",
"lookup":"PET.ID",
"direction":"out",
"edgeFields": { "Jumps": "${input.Jumps}" },
"unresolvedLinkAction":"NOTHING"
}

请记住在边缘更改器(mutator)之后从顶点删除“跳跃”,其中:
"field": { "fieldName": "Jump", "operation": "remove" },

关于etl - 通过 Orientdb ETL 添加 Edge 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31112923/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com