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. JAVA基础——设计模式之单列模式

    一:单例设计模式 Singleton是一种创建型模式,指某个类采用Singleton模式,则在这个类被创建后,只可能产生一个实例供外部访问,并且提供一个全局的访问点. 单例设计模式的特点: 单例类只能 ...

  2. IP、CIDR、广播地址、子网掩码、MAC地址--这些是什么鬼

    继续学习趣谈网络协议中的内容,认识几个专有名词,IP.CIDR.广播地址.子网掩码.MAC地址,这些都是什么鬼? 一.IP IP地址是一个网卡在网络世界的通讯地址,相当于我们现实世界的门牌号码 (1) ...

  3. c++基础_特殊的数字

    #include <iostream> #include <math.h> using namespace std; int main(){ ;i<;i++){ ; )% ...

  4. 77-CCI,Commodity Channel Index,商品通道指标.(2015.7.1)

    CCI,Commodity Channel Index 商品通道指标 Channel Index,商品通道指标.(2015.7.1)" title="77-CCI,Commodit ...

  5. jquery点击事件

    $("#hoetelNameSelect").click( $.post("${ctx}/meeting/restaurant/queryHotelName", ...

  6. NOI模拟赛(3.8)Problem B

    Description Alice和Bob在玩一个游戏,给出一张n*m的棋盘,上面有一些点是障碍,游戏的开始,Alice选定棋盘上任意一个不是障碍的格子,并且将一枚棋子放在其中,然后Bob先手,两人轮 ...

  7. 一个ajax实例

    一个ajax实例   html   <!DOCTYPE html> <html lang="zh-cn"> <head> <meta ch ...

  8. NYOJ-58最少步数,广搜思想!

    最少步数 时间限制:3000 ms  |  内存限制:65535 KB 难度:4 ->   Link  <- 这个题深搜广搜都是可以的,迷宫已经给出了,就看怎么做了:一般起点终点确定用广搜 ...

  9. POJ 1679 判最小生成树的不唯一性 或 利用次小生成树求解

    题目大意: 给定一个无向图,寻找它的最小生成树,如果仅有一种最小生成树,输出所有边的和,否则输出unique! 根据kruscal原理来说,每次不断取尽可能小的边不断添加入最小生成树中,那么可知如果所 ...

  10. [luoguP1962] 斐波那契数列(矩阵快速幂)

    传送门 解析详见julao博客连接 http://worldframe.top/2017/05/10/清单-数学方法-——-矩阵/ ——代码 #include <cstdio> #incl ...