创建工作正常但 Neo4j post 参数中的 MERGE 有错误

Create is working but MERGE in neo4j post params has error

我有下面的代码。还有一个 我收到这个 error.How 我可以修复它吗?

BTW CREATE 同样有效:

 <?php

$data2='{
  "names" : [{
    "name" : "Keanu Reeves1",
    "role" : "Neo1"
  },
  {
    "name" : "Keanu Reeves2",
    "role" : "Neo2"
  },
  {
    "name" : "Keanu Reeves3",
    "role" : "Neo3"
  }]
}';


$data ='MERGE (u:Person {names}) RETURN u';


$data2=json_decode($data2);


$data = array("query" =>$data,"params"=>$data2 );
$data_string = json_encode($data);


print_r($data_string);
//print_r($data2);
$ch = curl_init('http://192.....:7474/db/data/cypher');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data_string))
);

print_r ($ch);

$result = curl_exec($ch);

print_r($result);

?>

错误:

参数映射不能用于 MERGE 模式

{ "message" : "Parameter maps cannot be used in MERGE patterns (use a literal map instead, eg. \"{id: {param}.id}\") (line 1, column 17)\n\"MERGE (u:Person {names}) RETURN u\"\n ^", "exception" : "SyntaxException", "fullname" : "org.neo4j.cypher.SyntaxException"

不幸的是,由于查询计划的原因,这些映射不能用于合并。就像您在 sql.

中有动态 table 列一样

你可以做的是:

create constraint on (n:Label) assert n.id is unique;

MERGE (n:Label {id:{map}.id})
ON CREATE SET n={map}