将包含 2 个属性的节点插入 Neo4j 数据库后,如何从 REST API 查询响应中提取属性(“名称”和“电话”)?我查询数据库的脚本是:
<script>
function query_database()
{
var restServerURL = "http://localhost:7474/db/data"; //local copy on windows machine
$.ajax({
type:"POST",
url: restServerURL + "/cypher",
accepts: "application/json",
dataType:"json",
data:{
"query" : "start n = node(*) return n",
"params" : {}
},
success: function(data, xhr, textStatus){
//alert("query success!");
//process query results here
alert(JSON.stringify(data, null, 4));
},
error:function(jqXHR, textStatus, errorThrown){
alert(errorThrown);
}
});
}//end of query database
显示"alert(JSON.stringify(data, null, 4));"
以下内容:
{
"columns": [
"n"
],
"data": [
[
{
"paged_traverse": "http://localhost:7474/db/data/node/3761/paged/traverse/{returnType}{?pageSize,leaseTime}",
"outgoing_relationships": "http://localhost:7474/db/data/node/3761/relationships/out",
"data": {
"phone": "123.456.7890",
"name": "jeff "
},
"traverse": "http://localhost:7474/db/data/node/3761/traverse/{returnType}",
"all_typed_relationships": "http://localhost:7474/db/data/node/3761/relationships/all/{-list|&|types}",
"all_relationships": "http://localhost:7474/db/data/node/3761/relationships/all",
"property": "http://localhost:7474/db/data/node/3761/properties/{key}",
"self": "http://localhost:7474/db/data/node/3761",
"properties": "http://localhost:7474/db/data/node/3761/properties",
"outgoing_typed_relationships": "http://localhost:7474/db/data/node/3761/relationships/out/{-list|&|types}",
"incoming_relationships": "http://localhost:7474/db/data/node/3761/relationships/in",
"incoming_typed_relationships": "http://localhost:7474/db/data/node/3761/relationships/in/{-list|&|types}",
"extensions": {},
"create_relationship": "http://localhost:7474/db/data/node/3761/relationships"
}
]
]
}
非常感谢,
杰夫