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. mysql explain的使用

    一.explain返回各列的含义: 1.table:显示这一行的数据是关于那张表的 2.type:重要的列,显示连接使用了何种类型,从最好到最差的连接类型为const.eq_reg.ref.range ...

  2. Linux忘记root密码,密码找回,图片展示

    忘记root密码 CentOS 7参考地址如下:https://www.baidu.com/s?wd=CentOS7+%E6%89%BE%E5%9B%9Eroot%E5%AF%86%E7%A0%81& ...

  3. Python之面向对象函数式编程

    Python之面向对象函数式编程 函数式编程的根本就是用 def 去模拟数学式的编程逻辑. 类似与 y = 2*x + 1 ,当x = 3 时,函数的结果y就得7. def test(x): retu ...

  4. YOLOv3测试命令

    一.老规矩 在darknet\build\darknet\x6下按住shift键,点击鼠标右键选择“在此处打开Powershell 窗口(s)” 二.测试图片命令: .\darknet detect ...

  5. Cropping multiple images the same way

    The tools we’ll be using are =GIMP= and =mogrify= (from the ImageMagick suite), so make sure that yo ...

  6. 集训第四周(高效算法设计)I题 (贪心)

    Description Shaass has n books. He wants to make a bookshelf for all his books. He wants the bookshe ...

  7. BNUOJ 5997 Fibonacci again and again

    Fibonacci again and again Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HD ...

  8. MySQL prepare语句的SQL语法

    MySQL prepare语法: PREPARE statement_name FROM preparable_SQL_statement; /*定义*/ EXECUTE statement_name ...

  9. 记一次springMVC的跨域解决方案

    日期:2019年5月18日 事情原因:由于微信小程序的开发只有测试环境,而后台提供借口的环境是开发环境:两个环境的域名不同,导致前端开发产生了跨域问题: 理论概念: 1.同源策略:同源策略是浏览器的安 ...

  10. JSP的异常处理

    以下内容引用自http://wiki.jikexueyuan.com/project/jsp/exception-handling.html: 当写JSP代码的时候,有可能会留下一个编码错误,并且它会 ...