【问题标题】:add uuid for a node in neo4j graph db with php api使用php api为neo4j图形数据库中的节点添加uuid
【发布时间】:2014-07-04 13:23:44
【问题描述】:

我正在尝试为我创建的每个节点分配一个唯一的 ID。我尝试了以下语法,但失败了有人能指出我正确的方向吗?

我想提一下我正在使用 Neo4jPHP Api。

 $test =  $this->client->makeNode();
        $test->setId(2212313131)

            ->setProperty('age', 12)

            ->save();
        $label = $this->client->makeLabel('test');
        $test->addLabels(array($label));`

【问题讨论】:

    标签: php neo4j neo4jphp


    【解决方案1】:

    setId() 使用的 id 是实体的内部 Neo4j id。它不能/不应该手动设置(该方法只公开,以便 HTTP 客户端可以从响应中设置它。)

    如果您想拥有自己的节点 ID,请创建一个名为 iduuid 或任何您想要的属性:

    $test = new Node($client); $test ->setProperty('uuid', 2212313131) ->setProperty('age', 12) ->save(); 然后使用标签或 Cypher 按属性查找节点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-13
      • 2016-03-16
      • 2016-10-21
      • 1970-01-01
      • 1970-01-01
      • 2017-06-10
      相关资源
      最近更新 更多