https://neo4j.com/docs/

#https://pypi.python.org/pypi/neo4j-driver/1.5.3
from neo4j.v1 import GraphDatabase driver = GraphDatabase.driver("bolt://localhost:7687", auth=("my@my.com","mypwd")) def add_friends(tx, name, friend_name):
tx.run("MERGE (a:Person {name: $name}) "
"MERGE (a)-[:KNOWS]->(friend:Person {name: $friend_name})",
name=name, friend_name=friend_name) def print_friends(tx, name):
for record in tx.run("MATCH (a:Person)-[:KNOWS]->(friend) WHERE a.name = $name "
"RETURN friend.name ORDER BY friend.name", name=name):
print(record["friend.name"]) with driver.session() as session:
session.write_transaction(add_friends, "Arthur", "Guinevere")
session.write_transaction(add_friends, "Arthur", "Lancelot")
session.write_transaction(add_friends, "Arthur", "Merlin")
session.write_transaction(add_friends, "Arthur", "MyinputF")
session.read_transaction(print_friends, "Arthur")
Server version Neo4j/3.3.1
Server address 127.0.0.1:7687
Query MATCH (a:Person)-[:KNOWS]->(friend) WHERE a.name ="Arthur" RETURN friend.name ORDER BY friend.name
Response
[
{
"keys": [
"friend.name"
],
"length": 1,
"_fields": [
"Guinevere"
],
"_fieldLookup": {
"friend.name": 0
}
},
{
"keys": [
"friend.name"
],
"length": 1,
"_fields": [
"Lancelot"
],
"_fieldLookup": {
"friend.name": 0
}
},
{
"keys": [
"friend.name"
],
"length": 1,
"_fields": [
"Merlin"
],
"_fieldLookup": {
"friend.name": 0
}
},
{
"keys": [
"friend.name"
],
"length": 1,
"_fields": [
"Myinput"
],
"_fieldLookup": {
"friend.name": 0
}
},
{
"keys": [
"friend.name"
],
"length": 1,
"_fields": [
"MyinputF"
],
"_fieldLookup": {
"friend.name": 0
}
}
]
Started streaming 5 records after 1 ms and completed after 1 ms.
 
 
 
 
删除
MATCH (n) DETACH DELETE n
 
Deleted 5687 nodes, deleted 4885 relationships, completed after 453 ms.

												

GraphDatabase_action的更多相关文章

随机推荐

  1. day21 05 员工信息表

    day21 05 员工信息表 假设有一个员工信息表,里面有每个员工的名字,id,年龄,电话,还有他们所作的工作,而有时候我们并不需要所有的信息,而想根据某些条件,寻找符合条件即可,即筛选, 比如想要筛 ...

  2. Python中的列表(4)

    1.遍历列表 如果想打印列表中的所有元素,则必须遍历列表. 可以使用for ... in ... 语句来遍历列表中的元素.遍历的意思 words = ['a','b','c','d'] for wor ...

  3. angular2集成highchart

    集成highchart的配置困扰了我很久,今天终于解决了: 1.修改tsconfig.app.json: "compilerOptions": { //... "type ...

  4. MySQL操作示例

    """ MySQL综合练习作业 """ # 1.自行创建测试数据: # 创建数据库 """ create da ...

  5. Session与Token的区别

    1. 为什么要有session的出现?答:是由于网络中http协议造成的,因为http本身是无状态协议,这样,无法确定你的本次请求和上次请求是不是你发送的.如果要进行类似论坛登陆相关的操作,就实现不了 ...

  6. Mybatis传递多个参数的4种方式(干货)

    Mybatis传递多个参数的4种方式(干货)-----https://blog.csdn.net/youanyyou/article/details/79406486

  7. 九度oj 题目1056:最大公约数

    题目1056:最大公约数 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8068 解决:5317 题目描述: 输入两个正整数,求其最大公约数. 输入: 测试数据有多组,每组输入两个正整数. ...

  8. docsearch & algolia

    docsearch & algolia The easiest way to add search to your documentation. https://community.algol ...

  9. Codeforces Beta Round #85 (Div. 1 Only) C (状态压缩或是数学?)

    C. Petya and Spiders Little Petya loves training spiders. Petya has a board n × m in size. Each cell ...

  10. [K/3Cloud] 调用其他界面时通过Session传递对象参数

    DynamicFormShowParameter参数的CustomParams参数列表只支持string类型的参数,对于复杂参数的传递需要通过单据View对象的共享Session来完成,如: 在调用界 ...