1

以下 REST API 批处理失败:

POST http://localhost:7474/db/data/batch [{"method":"POST","to":"index/node/name uniqueness=get_or_create","body":{"key":"name","value":"Person1","properties":{"Type":"PERSON"}},"id":1},
{"method":"POST","to":"index/node/name?uniqueness=get_or_create","body":{"key":"name","value":"Person2","properties":{"Type":"PERSON"}},"id":2},
{"method":"POST","to":"{1}/relationships","body":{"type":"Knows","to":"{2}","data":{"Since":"2012"}},"id":3}]

带有 500 内部服务器错误。

由于某种原因,在使用 uniqueness=get_or_create 时,似乎无法使用 {1} 和 {2} 引用批处理中的节点。还是我错过了什么?

4

1 回答 1

1

您可以在第三个操作中使用 cypher 和索引查找来访问新创建的节点。

start n1=node:name(name={name1}), n2=node:name(name={name2}) 
create n1-[:Knows {props}]->n2

与参数

{
"query":"start n1=node:name(name={name1}), n2=node:name(name={name2}) create n1-[:Knows {props}]->n2",
"params":{"name1":"Person1","name2":"Person2","props":{"Since":"2012"}}
}
于 2013-04-09T06:11:04.567 回答