파이썬
라이브러리
neo4jrestclient
#
Find similar titles
Structured data
- Category
- Programming
- Database
Table of Contents
How to install #
Neo4jrestclient is object-oriented Python library to interact with Neo4j standalone REST server. It is very convinient to work with graph db models especially when retrieving data.
For installing neo4jrestclient
make shure you have installed Neo4jDB server on your local machine or you have an access to remote Neo4jDB server.
Then, you can install with pip:
$ pip install -U neo4jrestclient
Example usage #
from neo4jrestclient.client import GraphDatabase
from neo4jrestclient.query import Q
from neo4jrestclient.constants import DESC, ASC
gdb = GraphDatabase("http://neo4j:hackme@localhost:7474/db/data/")
people = gdb.labels.create("Person")
def delete_all_relationships():
for r in gdb.relationships.all():
r.delete()
def delete_all_nodes():
for n in gdb.nodes.all():
n.delete()
def main():
delete_all_relationships()
delete_all_nodes()
alice = gdb.nodes.create(name="Alice", age=30)
bob = gdb.nodes.create(name="Bob", age=30)
carl = gdb.nodes.create(name="Carl", age=25)
alice.relationships.create("Knows", bob, since=1980)
people.add(alice, bob, carl)
under_30 = people.filter(Q("age", "gte", 30)).order_by("name", DESC)
print 'people under 30: %s' % ', '.join([p['name'] for p in under_30])
if __name__ == '__main__':
main()
References #
https://neo4j-rest-client.readthedocs.org/en/latest/index.html
Incoming Links #
Related Articles (Article 0) #
Suggested Pages #
- 0.211 pcr
- 0.194 question test1
- 0.067 bacteriophage
- 0.050 예시페이지
- 0.049 flutter
- 0.044 바이오잉크
- 0.028 오픈 테스트
- 0.025 Jython
- 0.024 객체클레스
- 0.023 Cypher
- More suggestions...