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. RNN,LSTM,GRU基本原理的个人理解

    记录一下对RNN,LSTM,GRU基本原理(正向过程以及简单的反向过程)的个人理解 RNN Recurrent Neural Networks,循环神经网络 (注意区别于recursive neura ...

  2. tensorflow 学习笔记-- tf.reduce_max、tf.sequence_mask

    1.tf.reduce_max函数的作用:计算张量的各个维度上的元素的最大值.例子: import tensorflow as tfmax_value = tf.reduce_max([1, 3, 2 ...

  3. Java 调用存储过程 返回结果集

    这里使用Oracle数据库的thin连接. 下面是存储过程SQL 1 createorreplaceprocedure proc3(stid in student.stuid%type, stname ...

  4. 微信小程序UI组件库 iView Weapp快速上手

    概述 今天在网上突然看到iView新出了一个微信小程序的组件库iView Weapp,自己就上手试了一下,发现用起来还是不错的,把自己使用的过程与大家分享下. 一 预览iView组件 1.可以在手机上 ...

  5. ERC20 Token

    pragma solidity ^0.4.8; contract Token{ // token总量,默认会为public变量生成一个getter函数接口,名称为totalSupply(). uint ...

  6. thinkphp3.2使用PHPQrcode实现二维码

    Thinkphp中没有二维码相关的生成库,百度有不少工具和库 这里就实例一下通过think3.2搭配phpqrcode来完成生成二维码的功能. 至于phpQrcode库文件 百度很容易找到这里也给大家 ...

  7. NRF24L01注意点

    nrf24L01被设置为接收模式后,可通过6个不同的数据通道(data pipe)接收数据. 每个数据通道都有一个唯一的地址但是各数据通道的频率是相同的.这意味着可以有6个被配置成发送状态的nRF24 ...

  8. C51 继电器 个人笔记

    一句话 小电流控制大电流的开关. 电路图 给J2端口一个低电平,三极管导通,线圈吸合 一般用P1^4口连接 #include <reg51.h> #define u16 unsigned ...

  9. java连接MySQL数据库并读取内容

    package sqldemo; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSe ...

  10. 【BZOJ2330】糖果(差分约束系统,强连通分量,拓扑排序)

    题意: 幼儿园里有N个小朋友,lxhgww老师现在想要给这些小朋友们分配糖果,要求每个小朋友都要分到糖果.但是小朋友们也有嫉妒心,总是会提出一些要求,比如小明不希望小红分到的糖果比他的多,于是在分配糖 ...