neo4jrestclient-查询获取id
我正在使用neo4jrestclient库neo4jrestclient-查询获取id,neo4j,neo4jrestclient,Neo4j,Neo4jrestclient,我正在使用neo4jrestclient库 from neo4jrestclient.client import GraphDatabase from neo4jrestclient import client from neo4jrestclient import query gdb = GraphDatabase("http://localhost:7474/db/data/") q = """MATCH n RETURN n;""" result = gdb.query(q=q) prin
from neo4jrestclient.client import GraphDatabase
from neo4jrestclient import client
from neo4jrestclient import query
gdb = GraphDatabase("http://localhost:7474/db/data/")
q = """MATCH n RETURN n;"""
result = gdb.query(q=q)
print(result[0])
当我执行查询“MATCH n RETURN n”时,输出为:
[{
'all_relationships': 'http://localhost:7474/db/data/node/1131/relationships/all',
'all_typed_relationships': 'http://localhost:7474/db/data/node/1131/relationships/all/{-list|&|types}',
'self': 'http://localhost:7474/db/data/node/1131',
'labels': 'http://localhost:7474/db/data/node/1131/labels',
'properties': 'http://localhost:7474/db/data/node/1131/properties',
'create_relationship': 'http://localhost:7474/db/data/node/1131/relationships',
'outgoing_relationships': 'http://localhost:7474/db/data/node/1131/relationships/out',
'data': {
'title': 'title',
'name': 'Poludnie'
},
'incoming_typed_relationships': 'http://localhost:7474/db/data/node/1131/relationships/in/{-list|&|types}',
'property': 'http://localhost:7474/db/data/node/1131/properties/{key}',
'paged_traverse': 'http://localhost:7474/db/data/node/1131/paged/traverse/{returnType}{?pageSize,leaseTime}',
'incoming_relationships': 'http://localhost:7474/db/data/node/1131/relationships/in',
'outgoing_typed_relationships': 'http://localhost:7474/db/data/node/1131/relationships/out/{-list|&|types}',
'traverse': 'http://localhost:7474/db/data/node/1131/traverse/{returnType}'}]
我看到该节点的id=1131。问题是:我可以在没有这些链接的情况下以原始形式获取该id吗?我只希望id与“数据”字段的值一起存在。要获取“仅id和数据,请将查询更改为:
MATCH (n) RETURN id(n), n.data
看看这是否令人满意。在Cypher中,可以这样表示:
MATCH (n) RETURN {id: ID(n), name: n.name, title: n.title} as city
在响应中,数据
散列将包含一个数组,每个元素的行
键将包含可使用其给定键访问的数据