3

以下を使用して、インデックスからノードを取得しています。

neo.get_node_index('nodes_index', 'type', 'repo')

これはうまくいきます。ただし、返されるデータは次のように Hash オブジェクトです。

> {"indexed"=>"http://localhost:7474/db/data/index/node/nodes_index/type/repo/12", "outgoing_relationships"=>"http://localhost:7474/db/data/node/12/relationships/out",
> "data"=>{"name"=>"irc-logs"},
> "traverse"=>"http://localhost:7474/db/data/node/12/traverse/{returnType}",
> "all_typed_relationships"=>"http://localhost:7474/db/data/node/12/relationships/all/{-list|&|types}",
> "property"=>"http://localhost:7474/db/data/node/12/properties/{key}",
> "self"=>"http://localhost:7474/db/data/node/12",
> "properties"=>"http://localhost:7474/db/data/node/12/properties",
> "outgoing_typed_relationships"=>"http://localhost:7474/db/data/node/12/relationships/out/{-list|&|types}",
> "incoming_relationships"=>"http://localhost:7474/db/data/node/12/relationships/in",
> "extensions"=>{},
> "create_relationship"=>"http://localhost:7474/db/data/node/12/relationships", "paged_traverse"=>"http://localhost:7474/db/data/node/12/paged/traverse/{returnType}{?pageSize,leaseTime}",
> "all_relationships"=>"http://localhost:7474/db/data/node/12/relationships/all",
> "incoming_typed_relationships"=>"http://localhost:7474/db/data/node/12/relationships/in/{-list|&|types}"}

実際のノード オブジェクトを返すか、ID を簡単に取得できるようにしたいと考えています。id によって、 内の整数を参照していhttp://localhost:7474/db/data/node/12ます。

正規表現で取得できますが、これは確かに最善の方法ではありませんか?

4

1 に答える 1

2

「フェーズ 2」APIを使用して、以下のように見つけることができます。

n = Neography::Node.find('nodes_index', 'type', 'repo')

n.neo_id # 12

于 2013-11-06T12:27:59.000 に答える