简体   繁体   English

neo4j使用python rest客户端查询节点

[英]neo4j query for a node using python rest client

I have nodes in index with following proprties: 我在索引中具有以下属性的节点:

{'user_id': u'00050714572570434939', 'hosts': [u'http://shyjive.blogspot.com/'], 'follows': ['null']}

Now i have index and I am trying simple query to index to get nodes as : 现在我有了索引,我正在尝试简单的查询来索引以获取节点为:

index = gdb.nodes.indexes.create('blogger2')
uid = gdb.nodes.create()
uid["hosts"] = ['http://shyjive.blogspot.com/']
uid["user_id"] = "00050714572570434939"
uid["follows"] = ['null']
print index["user_id"]["00050714572570434939"][:]

this returns [] , what is wrong here !! 返回[] ,这是怎么了!

reason why i am using list in python as suggested by developers on neo4j groups is I want to store multi property values to the node , so instead of array i am using list here 我按neo4j组开发人员的建议在python中使用list的原因是我想将多属性值存储到node,所以我在这里使用list而不是array

You first need to index the node. 您首先需要索引节点。 If you are not using automatic indexing , the code for neo4j-rest-client would be: 如果您没有使用自动索引 ,则neo4j-rest-client的代码为:

index["user_id"]["00050714572570434939"] = uid

Now you have: 现在您有了:

>>> index["user_id"]["00050714572570434939"][:]
[<Neo4j Node: http://localhost:7474/db/data/node/38>]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM