我正在创建一个通信图。
每条消息都有一个 msgid,每个人都有一个用户 ID。
我已经创建了消息顶点,现在我想创建用户顶点和将消息顶点连接到用户顶点的边。
一个用户可以收到多条消息(显然)。
我的文件包含:
msgid、用户 ID(以及我将分配给边缘的一些其他信息)
我遇到的问题是在我的文件中我有重复的用户 ID(因为用户可以获得多条消息),我不想使用用户 ID 创建另一个顶点,所以我跳过重复。但是,如果我确实跳过重复项,则也不会创建边缘。我确实想要同一个用户顶点的多条边,因为每条边代表一条消息。
我如何保持用户顶点唯一但创建边缘?
我当前的 ETL .json 文件可以正常工作,除了我上面详述的内容。
{
"source": { "file": { "path": "msgs.txt" } },
"extractor": { "row": {} },
"transformers": [
{ "csv": {"separator": "\t"} },
{ "vertex": { "class": "user", "skipDuplicates": true } },
{ "edge": { "class": "sent_to", "joinFieldName": "msgid", "lookup":"message.id","direction": "in" } },
"edgeFields": { "n": "${input.n}" }
],
"loader": {
"orientdb": {
"dbURL": "remote:/localhost/databases/communication",
"dbType": "graph",
"classes": [
{"name": "user", "extends": "V"},
{"name": "message", "extends": "V"},
{"name": "sent_to", "extends": "E"}
], "indexes": [
{"class":"user", "fields":["id"], "type":"UNIQUE" }
]
}
}
}