使用一个joinFieldName和查找边缘变压器工作完美。但是,现在需要两个键,即查找中的复合索引。如何指定两个joinFieldNames?
这是脚本(后处理)版本:创建边缘扩展(从MC、sample=1和mkey=6选择)到(从sample=1和mcl=6事件中选择)。
这是可行的,但不适合生产。
有人能帮忙吗?
发布于 2016-09-15 18:46:38
您可以简单地添加2个joinFieldName(s),如
{ "edge": { "class": "Conn",
"joinFieldName": "b1",
"lookup": "A.a1",
"joinFieldName": "b2",
"lookup": "A.a2",
"direction": "out"
}}见下面的测试数据:
json1.json
{
"source": { "file": { "path": "/home/ivan/Scrivania/cose/etl/stak39517796/data1.csv" } },
"extractor": { "csv": {} },
"transformers": [
{ "vertex": { "class": "A" } }
],
"loader": {
"orientdb": {
"dbURL": "plocal:/home/ivan/OrientDB/db_installati/enterprise/orientdb-enterprise-2.2.10/databases/stack39517796",
"dbType": "graph",
"dbAutoCreate": true,
"classes": [
{"name": "A", "extends": "V"},
{"name": "B", "extends": "V"},
{"name": "Conn", "extends": "E"}
]
}
}
}json2.json
{
"source": { "file": { "path": "/home/ivan/Scrivania/cose/etl/stak39517796/data2.csv" } },
"extractor": { "csv": {} },
"transformers": [
{ "vertex": { "class": "B" } },
{ "edge": { "class": "Conn",
"joinFieldName": "b1",
"lookup": "A.a1",
"joinFieldName": "b2",
"lookup": "A.a2",
"direction": "out"
}}
],
"loader": {
"orientdb": {
"dbURL": "plocal:/home/ivan/OrientDB/db_installati/enterprise/orientdb-enterprise-2.2.10/databases/stack39517796",
"dbType": "graph",
"dbAutoCreate": true,
"classes": [
{"name": "A", "extends": "V"},
{"name": "B", "extends": "V"},
{"name": "Conn", "extends": "E"}
]
}
}
}data1.csv
a1,a2
1,1
1,2
2,3data2.csv
b1,b2
1,1
2,3
1,2执行令:
这是最后的结果:
orientdb {db=stack39517796}> select from v
+----+-----+------+----+----+-------+----+----+--------+
|# |@RID |@CLASS|a1 |a2 |in_Conn|b2 |b1 |out_Conn|
+----+-----+------+----+----+-------+----+----+--------+
|0 |#17:0|A |1 |1 |[#25:0]| | | |
|1 |#18:0|A |1 |2 |[#27:0]| | | |
|2 |#19:0|A |2 |3 |[#26:0]| | | |
|3 |#21:0|B | | | |1 |1 |[#25:0] |
|4 |#22:0|B | | | |3 |2 |[#26:0] |
|5 |#23:0|B | | | |2 |1 |[#27:0] |
+----+-----+------+----+----+-------+----+----+--------+https://stackoverflow.com/questions/39517796
复制相似问题