我无法使用PHP查询来使用PHP API客户端。使用Neo4J-REST-PHP-API-客户端的Neo4j索引查找
首先,我正在创建一个节点并对它进行索引。这工作正常。然后,当我测试查找
curl -H Accept:application/json http://localhost:7474/db/data/index/node/my_nodes/guid/108
我得到:
[ {
"indexed" : "http://localhost:7474/db/data/index/node/my_nodes/guid/108/57",
"outgoing_relationships" : "http://localhost:7474/db/data/node/57/relationships/out",
"data" : {
"guid" : 108,
"title" : "New User ABC",
"owner_guid" : "2"
},
"traverse" : "http://localhost:7474/db/data/node/57/traverse/{returnType}",
"all_typed_relationships" : "http://localhost:7474/db/data/node/57/relationships/all/{-list|&|types}",
"property" : "http://localhost:7474/db/data/node/57/properties/{key}",
"self" : "http://localhost:7474/db/data/node/57", ....
到目前为止好。但是,当我在PHP API客户端中定义如下函数来执行查找时。
public function getNodeByKey ($key, $value)
{
$uri = $this->base_uri . 'index/node/my_nodes/' . $key . '/' . $value ;
list($response, $http_code) = HTTPUtil::jsonGetRequest($uri);
if ($http_code == 200)
return Node::inflateFromResponse($this, $response);
else {
throw new HttpException($http_code);
}
}
和下面是如何我打电话上述功能:
$graphDb = new GraphDatabaseService('http://localhost:7474/db/data/');
...
$node = $graphDb->getNodeByKey ('guid', $uid);
$relationship = $node->createRelationshipTo($another_node, 'works with');
$relationship->save();
我从getNodeByKey的200 HTTP响应()。但是,当我尝试保存关系时,我得到了404。我尝试使用dump_node()进行测试,并试图查找节点,即$ node为null。我无法弄清楚哪里会出错。任何指针?
由于提前, 南大
皮特,是的,我是能够访问使用使用curl索引节点,但无法得到它的工作与PHP API客户端。但是,我发现了这个问题。我会很快发布答案。 – 2011-06-10 04:09:26