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. 如何用SQL语句在指定字段前面插入新的字段?

    如何用SQL语句在指定字段前面插入新的字段? 2007-10-17 09:28:00|  分类: 笔记|举报|字号 订阅     create proc addcolumn @tablename va ...

  2. yii1框架,事务使用方法

    Yii1框架事务操作方法如下: $transaction= Yii::app()->db->beginTransaction();//创建事务 $transaction->commi ...

  3. Groovy常用语法汇总

    基本语法 1.Grovvy的注释分为//和/**/和java的一样. 2.Grovvy语法可以不已分号结尾. 3.单引号,里面的内容严格的对应java中的String,不对$符号进行转义. def s ...

  4. solr-5.3.1配置(win7 x64)

    下载solr,下载地址http://www.eu.apache.org/dist/lucene/solr/5.3.1/solr-5.3.1.zip 解压到某个目录下,这里是解压到了d盘目录下,路径:D ...

  5. Tomcat8.0 JDK1.8 的详细配置 Win10

    官网下载 先安装JDK以及JRE 之后安装Tomcat jdk配置环境变量: 用户变量:path:C:\Program Files\Java\jdk1.8.0_161\bin     ( jdk安装的 ...

  6. element-UI 多表单重置的时候的坑

    问题细化一下是这样的:比如我有一个用来修改数据的表单,第一条数据是{name: 'Xixi', age: 12},打开表单后就有两个输入框分别填的是Xixi和12,此时我修改Xixi为Haha,调用t ...

  7. 九度oj 题目1047:素数判定

    题目1047:素数判定 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:12466 解决:5644 题目描述: 给定一个数n,要求判断其是否为素数(0,1,负数都是非素数). 输入: 测试数 ...

  8. C语言不容易识别的坑

    1.重复两次定义 #include<stdio.h> #include<stdlib.h> #include<string.h> int a,b; void fun ...

  9. 洛谷 P2285 BZOJ 1207 [HNOI2004]打鼹鼠

    题目描述 鼹鼠是一种很喜欢挖洞的动物,但每过一定的时间,它还是喜欢把头探出到地面上来透透气的.根据这个特点阿牛编写了一个打鼹鼠的游戏:在一个n*n的网格中,在某些时刻鼹鼠会在某一个网格探出头来透透气. ...

  10. Writing Code-Codeforces511C**

    http://codeforces.com/problemset/problem/544/C 完全背包 dp[i][j]表示第i行有j个bug #include<stdio.h> #inc ...