面向对象的python库与neo4j独立rest服务器交互
neo4jrestclient的Python项目详细描述
neo4j python rest客户端
<表> < COL/> < COL/> <正文> 概要:面向对象的python库,用于与neo4j独立rest服务器交互。 < > <表>neo4j python rest客户端的第一个目标是使 python程序员通过python embedded或 远程数据库感谢neo4j rest服务器。所以,这个api的语法是 与嵌入式python完全兼容。但是,在 为了达到更像蟒蛇的风格。
入门
主要类是graphdatabase,确切地说是如何在python embedded中实现的:
>>>fromneo4jrestclient.clientimportGraphDatabase>>>gdb=GraphDatabase("http://localhost:7474/db/data/")
由于语法与嵌入的python完全兼容 添加的命令及其差异。
创建节点:
>>>n=gdb.nodes.create()# Equivalent to>>>n=gdb.node()
指定新节点的属性:
>>>n=gdb.nodes.create(color="Red",width=16,height=32)
访问属性:
>>>value=n['key']# Get property value>>>n['key']=value# Set property value
建立关系:
>>>n1.relationships.create("Knows",n2)# Useful when the name of# relationship is stored in a variable
指定新关系的属性:
>>>n1.Knows(n2,since=123456789,introduced_at="Christmas party")