neo4j

Neo4j cypher to count and display all the relationship between two given nodes

僤鯓⒐⒋嵵緔 提交于 2020-01-23 07:57:08
问题 Here I am using neo4j rest api, in first step I want to collect information like how many relationships are there between two given nodes. Sample : MATCH (n:Node {id: {parameter1}})-[r:someType]-(m:Node {id: {parameter2}}) RETURN COUNT(r) Then I would like to collect all the values assigned to the edges so I can calculate further calculations. I need all the different types of relationships and their properties between two given nodes. If it is possible I would like to do it in single cypher.

Neo4j 数据批量导入

二次信任 提交于 2020-01-22 05:43:50
目前主要有以下几种数据插入方式: Cypher CREATE 语句,为每一条数据写一个CREATE Cypher load csv语句,将数据转成CSV格式,通过LOAD CSV读取数据。 官方提供的Java API —— Batch Inserter 大牛编写的 BatchImport 工具 官方提供的 neo4j-import 工具 这边重点来说一下官方最快的 neo4j-import ,使用的前提条件: graph.db需要清空; neo4j需要停掉; 接受CSV导入,而且格式较为固定; 试用场景:首次导入 节点名字需要唯一 比较适用于:首次导入、无法迭代更新 简单的Demo (数据导入之前需要停止neo4j服务) movies.csv. movieId:ID,title,year:int,:LABEL tt0133093,"The Matrix",1999,Movie tt0234215,"The Matrix Reloaded",2003,Movie;Sequel tt0242653,"The Matrix Revolutions",2003,Movie;Sequel 其中,title是属性,注意此时需要有双引号;year:int也是属性,只不过该属性是数值型的; :LABEL 与 :ID 一样生成了一个新节点,也就是一套数据可以通过 : 生成双节点 actors.csv

Neo4j自用手册

江枫思渺然 提交于 2020-01-21 02:13:06
一、Neo4j基本操作 1. 增删改查 1.1 创建节点与关系 01-创建节点 CREATE(m:进制) //m为变量名,写什么都可以,“进制”为标签 02- 创建带有属性的节点 CREATE (m:进制 { 中文名:"进制",外文名称:"system of numeration",实质:"是人们规定的一种进位方法" }) match(m:进制) return(n) //match为查询匹配的功能,有match,一定要有return 03-判断是否节点已存在,若存在不操作,不存在再创建 MERGE (n {name: '3'}) //Create if a node with name='3' does not exist else match it MERGE (test2 {name:'2'}) //Create if a node with name='2' does not exist else match it 04-创建节点之间的关系 //直接创建新的节点关系,以下将创建两个节点,一个带属性的关系(边) CREATE (m:进制 {name:"byte"})-[r:应用{年代:1990,人物:"冯诺依曼"}]->(n:内存 {name:"memory"}) //已有的两个节点创建关系 MATCH (m:进制 {name:"byte"}),(n:内存 {name:

Starting Neo4j failed: Address localhost:7474 is already in use, cannot bind to it on Mac OSX

情到浓时终转凉″ 提交于 2020-01-19 17:32:07
问题 I'm trying to install a neo4j server on my localhost (mac osx - El-capitan) and i'm getting this error - Starting Neo4j failed: Address localhost:7474 is already in use, cannot bind to it. I tried to stop the port from running and then install it throw the neo4j install app, but it still give this error When i try to start the neo4j server it gives me this error : ./usr/local/bin/neo4j: line 229: [: too many arguments 回答1: Try to kill your java processes : sudo killall -9 java Then restart

Neo4j: Match multiple labels (2 or more)

蓝咒 提交于 2020-01-19 06:53:32
问题 I would like to do a search, and I would like to start traversing from 2 labels (OR condition). For example, I need to find out all the nodes which have labels either 'Male' or 'Female' and whose property, name =~ '. ail. '. 回答1: You can put this condition in the WHERE clause: MATCH (n) WHERE n:Male OR n:Female RETURN n EDIT As @tbaum points out this performs an AllNodesScan . I wrote the answer when labels were fairly new and expected the query planner to eventually implement it with a

Neo4j非关系型数据库的使用

穿精又带淫゛_ 提交于 2020-01-19 01:40:34
一、安装 1.下载地址 https://neo4j.com/download/ 根据系统进行选择 二、安装 下载完成后进行解压,并配置环境变量: 1.创建系统变量:NEO4J_HOME 变量值为Neo4j的安装路径,例如:F:\Neo4j\neo4j-community-3.5.14-windows\neo4j-community-3.5.14 2.在path里添加%NEO4J_HOME%\bin 三、启动和停止服务 以下命令需要控制台进入到Neo4j对应的安装目录中的bin目录下。在安装好之后服务是默认开启的 可以通过neo4j.bat console 来进行验证是否安装成功,若出现以下内容,则代表安装成功,并且已经启动服务: 2020-01-03 09:00:02.353+0000 INFO ======== Neo4j 3.5.14 ======== 2020-01-03 09:00:02.367+0000 INFO Starting... 2020-01-03 09:00:05.209+0000 INFO Bolt enabled on 127.0.0.1:7687. 2020-01-03 09:00:06.628+0000 INFO Started. 2020-01-03 09:00:07.474+0000 INFO Remote interface available

neo4j下载安装

二次信任 提交于 2020-01-18 01:17:45
安装java环境: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 下载社区版的neo4j: http://neo4j.com.cn/topic/5b003eae9662eee704f31cee window版本: 无需安装,直接解压就好 然后进入它的bin目录,在终端敲:./neo4j console,点击终端弹出的最后的网址就可进入了(它的初始账户和密码都是neo4j) linux系统: 将安装包上传到指定的目录下,解压 tar -axvf neo4j-community-3.4.5-unix.tar.gz 进入解压包的conf目录下,修改配置文件neo4j.conf信息 主要修改54行,开启远程ip访问功能,其他参数信息可不修改 # 修改第22行load csv时l路径,在前面加个#,可从任意路径读取文件 #dbms.directories.import=import # 修改35行和36行,设置JVM初始堆内存和JVM最大堆内存 # 生产环境给的JVM最大堆内存越大越好,但是要小于机器的物理内存 dbms.memory.heap.initial_size=5g dbms.memory.heap.max_size=10g # 修改46行,可以认为这个是缓存

neo4j

随声附和 提交于 2020-01-18 01:16:56
Neo4j是世界领先的图形数据库。它的体系结构旨在优化管理,存储和遍历节点和关系。该数据库采用一种属性图方法,这对于遍历性能和操作运行时都是有益的。Neo4j提供专用的内存管理以及高效的内存操作。 选择图数据库的场景及原因: * 社交网络; * 推荐和个性化; * 客户360,包括实体解析(关联多个来源的用户数据); * 欺诈识别; * 资产管理; * 物流 * 金融风控行业 * 实时推荐 图数据库善于处理大量的、复杂的、互联的、多变的网状数据,其效率远远高于传统的关系型数据库,擅长处理关系,速度也比传统sql更快 ubuntu18.04以 apt-get 方式安装 官方安装指南 wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add - echo 'deb https://debian.neo4j.com stable latest' | sudo tee -a /etc/apt/sources.list.d/neo4j.list sudo apt-get update sudo apt-get install neo4j PDF手册指南 启动与停止neo4j服务 开始使用neo4j sudo neo4j start sudo neo4j stop 如图,有一个WARNING提示。

What is the fastest way to import to Neo4j?

萝らか妹 提交于 2020-01-17 14:05:28
问题 I have a list of JSON documents, in the format: [{a:1, b:[2,5,6]}, {a:2, b:[1,3,5]}, ...] What I need to do is make nodes with parameter a , and connect them to all the nodes in the list b that have that value for a . So the first node will connect to nodes 2, 5 and 6. Right now I'm using Python's neo4jrestclient to populate but it's taking a long time. Is there a faster way to populate? Currently this is my script: break_list = [] for each in ans[1:]: ref = each[0] q = """MATCH n WHERE n.url

What is the fastest way to import to Neo4j?

萝らか妹 提交于 2020-01-17 14:05:25
问题 I have a list of JSON documents, in the format: [{a:1, b:[2,5,6]}, {a:2, b:[1,3,5]}, ...] What I need to do is make nodes with parameter a , and connect them to all the nodes in the list b that have that value for a . So the first node will connect to nodes 2, 5 and 6. Right now I'm using Python's neo4jrestclient to populate but it's taking a long time. Is there a faster way to populate? Currently this is my script: break_list = [] for each in ans[1:]: ref = each[0] q = """MATCH n WHERE n.url