我不能让Gremlin做基本的查询。
=> curl --data-urlencode "script=g.v(3)" http://localhost:7474/db/data/ext/GremlinPlugin/graphdb/execute_script
=>
{
"extensions" : {
},
"outgoing_relationships" : "http://localhost:7474/db/data/node/3/relationships/out",
"labels" : "http://localhost:7474/db/data/node/3/labels",
"all_typed_relationships" : "http://localhost:7474/db/data/node/3/relationships/all/{-list|&|types}",
"traverse" : "http://localhost:7474/db/data/node/3/traverse/{returnType}",
"self" : "http://localhost:7474/db/data/node/3",
"property" : "http://localhost:7474/db/data/node/3/properties/{key}",
"outgoing_typed_relationships" : "http://localhost:7474/db/data/node/3/relationships/out/{-list|&|types}",
"properties" : "http://localhost:7474/db/data/node/3/properties",
"incoming_relationships" : "http://localhost:7474/db/data/node/3/relationships/in",
"create_relationship" : "http://localhost:7474/db/data/node/3/relationships",
"paged_traverse" : "http://localhost:7474/db/data/node/3/paged/traverse/{returnType}{?pageSize,leaseTime}",
"all_relationships" : "http://localhost:7474/db/data/node/3/relationships/all",
"incoming_typed_relationships" : "http://localhost:7474/db/data/node/3/relationships/in/{-list|&|types}",
"metadata" : {
"id" : 3,
"labels" : [ "node" ]
},
"data" : {
"node_name" : "test_node",
"email_address" : "test@gmail.com"
}
}
因此我们可以看到数据存在,并且它具有“node_name”属性,该属性设置为“test_node”。现在,当我们尝试使用Gremlin来寻找那个节点时......
=> curl --data-urlencode "script=g.V('node_name','test_node')" http://localhost:7474/db/data/ext/GremlinPlugin/graphdb/execute_script
=> []
什么都没有出现。发生了什么事?
Neo版本:2.1.7
Gremlin版本:neo4j-gremlin-plugin-2.1-SNAPSHOT.jar,直接来自https://github.com/neo4j-contrib/gremlin-plugin
Java版本: java版“1.7.0_75” Java(TM)SE运行时环境(版本1.7.0_75-b13) Java HotSpot(TM)服务器VM(内置24.75-b04,混合模式)
答案 0 :(得分:0)
正如D.Mill所指出的,正确的Gremlin语法是:
g.V().has("node_name", "test_node")