У нас есть два отдельных файла, загружающих neo4j с использованием APO C. Первый загружает узлы, и кажется, что он работает правильно. Теперь мне нужно загрузить отношения. У меня есть файл json.
{
"0": {
"child": "54690",
"compile": "webgoat.combined.source",
"parent": "0",
"tree": "runs"
},
"1": {
"child": "2",
"compile": "webgoat.combined.source",
"parent": "1",
"tree": "calls"
},
parent и child - это два узла, которые необходимо соединить. Имя отношения должно быть основано на tree и уточнено на основе поля compile . Другими словами, мне нужны отношения, созданные только в том случае, если родительский и дочерний элементы используют одну и ту же строку компиляции.
Это команда APO C, которая у меня есть:
with graphDB_Driver.session() as ses:
ses.run("UNWIND $batch AS row MATCH (a:ProgNode{parent:row.a}) MATCH (b:ProgNode{child:row.b}) CALL apoc.merge.relationship(a, 'TREE', {}, apoc.map.removeKeys(properties(row), ['parent', 'child']), b) YIELD rel RETURN 1", batch=BATCH["batch"])
У меня есть попытался заменить «ДЕРЕВО» различными именами переменных, включая row.tree, tree: row.a, но ничего не работает. Я проверил, что ПАРТИЯ ['партия'] ниже содержит те же данные.
[{"child": "54690", "compile": "webgoat.combined.source", "parent": "0", "tree": "runs", "from": 0}, {"child": "2", "compile": "webgoat.combined.source", "parent": "1", "tree": "calls", "from": 1}, {"child": "101", "compile": "webgoat.combined.source", "parent": "100", "tree": "runs", "from": 100}, {"child": "1001", "compile": "webgoat.combined.source", "parent": "1000", "tree": "runs", "from": 1000}, {"child": "10001", "compile": "webgoat.combined.source", "parent": "10000", "tree": "runs", "from": 10000}, {"child": "10004", "compile": "webgoat.combined.source", "parent": "10003", "tree": "runs", "from": 10003}, {"child": "10009", "compile": "webgoat.combined.source", "parent": "10004", "tree": "runs", "from": 10004}, {"child": "10007", "compile": "webgoat.combined.source", "parent": "10005", "tree": "runs", "from": 10005}, {"child": "10008", "compile": "webgoat.combined.source", "parent": "10007", "tree": "runs", "from": 10007}, {"child": "1005", "compile": "webgoat.combined.source", "parent": "1001", "tree": "runs", "from": 1001}, {"child": "1003", "compile": "webgoat.combined.source", "parent": "1002", "tree": "runs", "from": 1002}, {"child": "10028", "compile": "webgoat.combined.source", "parent": "10022", "tree": "runs", "from": 10022}, {"child": "10025", "compile": "webgoat.combined.source", "parent": "10023", "tree": "runs", "from": 10023}, {"child": "10026", "compile": "webgoat.combined.source", "parent": "10025", "tree": "runs", "from": 10025}, {"child": "10041", "compile": "webgoat.combined.source", "parent": "10028", "tree": "runs", "from": 10028}, {"child": "10034", "compile": "webgoat.combined.source", "parent": "10029", "tree": "runs", "from": 10029}, {"child": "10031", "compile": "webgoat.combined.source", "parent": "10030", "tree": "runs", "from": 10030}, {"child": "10040", "compile": "webgoat.combined.source", "parent": "10035", "tree": "runs", "from": 10035}, {"child": "10037", "compile": "webgoat.combined.source", "parent": "10036", "tree": "runs", "from": 10036}, {"child": "10051", "compile": "webgoat.combined.source", "parent": "10041", "tree": "runs", "from": 10041}, {"child": "10044", "compile": "webgoat.combined.source", "parent": "10042", "tree": "runs", "from": 10042}, {"child": "10045", "compile": "webgoat.combined.source", "parent": "10044", "tree": "runs", "from": 10044}, {"child": "10046", "compile": "webgoat.combined.source", "parent": "10045", "tree": "runs", "from": 10045}, {"child": "10050", "compile": "webgoat.combined.source", "parent": "10048", "tree": "runs", "from": 10048}, {"child": "10052", "compile": "webgoat.combined.source", "parent": "10051", "tree": "runs", "from": 10051}, {"child": "10071", "compile": "webgoat.combined.source", "parent": "10052", "tree": "runs", "from": 10052}, {"child": "10054", "compile": "webgoat.combined.source", "parent": "10053", "tree": "runs", "from": 10053}, {"child": "10061", "compile": "webgoat.combined.source", "parent": "10054", "tree": "runs", "from": 10054}, {"child": "10057", "compile": "webgoat.combined.source", "parent": "10055", "tree": "runs", "from": 10055}, {"child": "10059", "compile": "webgoat.combined.source", "parent": "10057", "tree": "runs", "from": 10057}, {"child": "10060", "compile": "webgoat.combined.source", "parent": "10059", "tree": "calls", "from": 10059}, {"child": "1007", "compile": "webgoat.combined.source", "parent": "1006", "tree": "runs", "from": 1006}, {"child": "10063", "compile": "webgoat.combined.source", "parent": "10062", "tree": "runs", "from": 10062}, {"child": "10065", "compile": "webgoat.combined.source", "parent": "10063", "tree": "runs", "from": 10063}, {"child": "10067", "compile": "webgoat.combined.source", "parent": "10065", "tree": "runs", "from": 10065}, {"child": "10068", "compile": "webgoat.combined.source", "parent": "10067", "tree": "runs", "from": 10067}, {"child": "10070", "compile": "webgoat.combined.source", "parent": "10068", "tree": "runs", "from": 10068}, {"child": "1009", "compile": "webgoat.combined.source", "parent": "1007", "tree": "runs", "from": 1007}, {"child": "10072", "compile": "webgoat.combined.source", "parent": "10071", "tree": "runs", "from": 10071}, {"child": "10074", "compile": "webgoat.combined.source", "parent": "10072", "tree": "runs", "from": 10072}, {"child": "10102", "compile": "webgoat.combined.source", "parent": "10088", "tree": "runs", "from": 10088}, {"child": "10090", "compile": "webgoat.combined.source", "parent": "10089", "tree": "runs", "from": 10089}, {"child": "1011", "compile": "webgoat.combined.source", "parent": "1009", "tree": "runs", "from": 1009}, {"child": "10093", "compile": "webgoat.combined.source", "parent": "10091", "tree": "runs", "from": 10091}, {"child": "10094", "compile": "webgoat.combined.source", "parent": "10093", "tree": "runs", "from": 10093}, {"child": "10097", "compile": "webgoat.combined.source", "parent": "10095", "tree": "runs", "from": 10095}, {"child": "10098", "compile": "webgoat.combined.source", "parent": "10097", "tree": "runs", "from": 10097}, {"child": "10100", "compile": "webgoat.combined.source", "parent": "10098", "tree": "runs", "from": 10098}, {"child": "103", "compile": "webgoat.combined.source", "parent": "101", "tree": "runs", "from": 101}, {"child": "10261", "compile": "webgoat.combined.source", "parent": "10102", "tree": "runs", "from": 10102}, {"child": "10107", "compile": "webgoat.combined.source", "parent": "10103", "tree": "runs", "from": 10103}, {"child": "10106", "compile": "webgoat.combined.source", "parent": "10105", "tree": "runs", "from": 10105}, {"child": "10129", "compile": "webgoat.combined.source", "parent": "10107", "tree": "runs", "from": 10107}, {"child": "10115", "compile": "webgoat.combined.source", "parent": "10108", "tree": "runs", "from": 10108}, {"child": "10110", "compile": "webgoat.combined.source", "parent": "10109", "tree": "runs", "from": 10109}, {"child": "1013", "compile": "webgoat.combined.source", "parent": "1011", "tree": "runs", "from": 1011}, {"child": "10114", "compile": "webgoat.combined.source", "parent": "10112", "tree": "runs", "from": 10112}, {"child": "10116", "compile": "webgoat.combined.source", "parent": "10115", "tree": "runs", "from": 10115}, {"child": "10117", "compile": "webgoat.combined.source", "parent": "10116", "tree": "runs", "from": 10116}, {"child": "10118", "compile": "webgoat.combined.source", "parent": "10117", "tree": "runs", "from": 10117}, {"child": "10126", "compile": "webgoat.combined.source", "parent": "10119", "tree": "runs", "from": 10119}, {"child": "10121", "compile": "webgoat.combined.source", "parent": "10120", "tree": "runs", "from": 10120}, {"child": "10125", "compile": "webgoat.combined.source", "parent": "10123", "tree": "runs", "from": 10123}, {"child": "10127", "compile": "webgoat.combined.source", "parent": "10126", "tree": "runs", "from": 10126}, {"child": "10128", "compile": "webgoat.combined.source", "parent": "10127", "tree": "runs", "from": 10127}, {"child": "10138", "compile": "webgoat.combined.source", "parent": "10129", "tree": "runs", "from": 10129}, {"child": "10131", "compile": "webgoat.combined.source", "parent": "10130", "tree": "runs", "from": 10130}, {"child": "10137", "compile": "webgoat.combined.source", "parent": "10133", "tree": "runs", "from": 10133}, {"child": "10135", "compile": "webgoat.combined.source", "parent": "10134", "tree": "runs", "from": 10134}, {"child": "10136", "compile": "webgoat.combined.source", "parent": "10135", "tree": "runs", "from": 10135}, {"child": "10139", "compile": "webgoat.combined.source", "parent": "10138", "tree": "runs", "from": 10138}, {"child": "10151", "compile": "webgoat.combined.source", "parent": "10139", "tree": "runs", "from": 10139}, {"child": "1045", "compile": "webgoat.combined.source", "parent": "1014", "tree": "runs", "from": 1014}, {"child": "10141", "compile": "webgoat.combined.source", "parent": "10140", "tree": "runs", "from": 10140}, {"child": "10143", "compile": "webgoat.combined.source", "parent": "10141", "tree": "runs", "from": 10141}, {"child": "10145", "compile": "webgoat.combined.source", "parent": "10143", "tree": "runs", "from": 10143}, {"child": "10146", "compile": "webgoat.combined.source", "parent": "10145", "tree": "runs", "from": 10145},
Мысли?