neo4j

How to use MERGE to create or reuse a part of pattern?

不问归期 提交于 2019-12-31 07:11:30
问题 I have node PRODUCT with multiple REVIEW node. I would create node PRODUCE if the product is not exist, then bind with REVIEW. For the example, I want a PRODUCE node {name:'X phone'} with 3 REVIEW {content:'best phone ever'}, {content:'worst phone ever'}, {content:'nope'}. I tried First, use one cypher MERGE for each REVIEW. MERGE(product:PRODUCT{name:'X phone'})-[:RATE]-(review:REVIEW{content:'best phone ever'}) MERGE(product:PRODUCT{name:'X phone'})-[:RATE]-(review:REVIEW{content:'worst

How can I efficiently create unique relationships in Neo4j?

只愿长相守 提交于 2019-12-31 06:59:07
问题 Following up on my question here, I would like to create a constraint on relationships. That is, I would like there to be multiple nodes that share the same "neighborhood" name, but each uniquely point to a particular city in which they reside. As encouraged in user2194039's answer, I am using the following index: CREATE INDEX ON :Neighborhood(name) Also, I have the following constraint: CREATE CONSTRAINT ON (c:City) ASSERT c.name IS UNIQUE; The following code fails to create unique

Neo4j 3.0.7 Enterprise trial version failed to start in Windows

∥☆過路亽.° 提交于 2019-12-31 05:17:06
问题 Windows 7 Pro (64-bit) I've successfully installed the "service" thanks to both posts Neo4j 3.0.4 Enterprise trial version failed to start in Windows and Missing `server' JVM. You may find the corresponding trace below. C:\Users\bguarism\Dropbox\PORTABLE\MyDBs\neo4j\cnaf_enterprise\bin>neo4j.bat install-service -verbose COMMENTAIRES : Neo4j Root is 'C:\Users\bguarism\Dropbox\PORTABLE\MyDBs\neo4j\cnaf_enterprise' COMMENTAIRES : Neo4j Server Type is 'Enterprise' COMMENTAIRES : Neo4j Version is

Passing a Lucene query to Neo4j REST API using Cypher 2.0

无人久伴 提交于 2019-12-31 04:29:33
问题 If I have a Lucene query such as (title:"foo bar" AND body:baz*) OR title:bat is there any straightforward way to pass this into a Cypher query? It looks like this sort of used to work with START and the old node_auto_index but I'm not sure how to do this properly with Cypher 2.0. I've tried sticking it in the MATCH clause but I get invalid syntax errors: MATCH (item:Item {...}) RETURN item I'm about to write a parser that converts a Lucene query to a parameterized Cypher query but I thought

Jruby: NameError: uninitialized constant Neo4j

谁说胖子不能爱 提交于 2019-12-31 04:29:25
问题 I ran this example from git: https://github.com/andreasronge/neo4j require "rubygems" require 'neo4j' Neo4j::Transaction.run do node = Neo4j::Node.new(:name => 'andreas') node.outgoing(:friends) << Neo4j::Node.new(:name => 'peter') node.outgoing(:friends).each {|node| puts "name #{node[:name]}"} end and it outputted the error: NameError: uninitialized constant Neo4j const_missing at org/jruby/RubyModule.java:2626 (root) at ./neo4j.rb:4 require at org/jruby/RubyKernel.java:1027 require at .

Getting the max record with different values using cypher

三世轮回 提交于 2019-12-31 04:19:45
问题 I have a graph with spatial data using the spatial plugin. This graph has "Threat Zones" (Polygons) which can be on top of the other so they also have a z-index property. Each "Threat Zone" is attached to 1 to N threat scenarios, sometimes multiple "Threat Zones" are attached to the same threat scenario, with different properties. I'm trying to get the top threat zone for each threat scenario, based on the z-index, for a specific location. This is my current query which is almost perfect:

Neo4j Cypher: copy relationships and delete node

风流意气都作罢 提交于 2019-12-31 04:09:10
问题 I'm trying to copy all inward relationships of a node (n) to another node (m) (both of witch I know the ids) before deleting (n) , but I couldn't come up with the code. The relationships may or may not exist. Anybody snippet? 回答1: You wont be able to create a relationshiptype dynamically from inside a collection of relationships. Suppose even if we collect all the incoming relationships as below START n=node(id1) MATCH n<-[r]-() WITH collect(r) as rels ... You would be able to iterate over

Reset Index in neo4j using Python

耗尽温柔 提交于 2019-12-31 03:47:07
问题 Is there a possibility to reset the indices once I deleted the nodes just as if deleted the whole folder manually? I am deleting the whole database with node.delete() and relation.delete() and just want the indices to start at 1 again and not where I had actually stopped... 回答1: I assume you are referring to the node and relationship IDs rather than the indexes? Quick answer: You cannot explicitly force the counter to reset. Slightly longer answer: Generally speaking, these IDs should not

Neo4j server in VirtualBox: Unable to create rrd store

﹥>﹥吖頭↗ 提交于 2019-12-31 03:18:13
问题 I'm trying to run a Neo4j server inside my Virtualbox which is running Ubuntu. The server files and the database are located within my Windows-Host and accessed via a shared folder (vboxsf). Unfortunately I can not easily transfer the data into the virtual machine and run it there directly (due to insufficient free space on the virtual disk. I tried to enlarge it but that didn't work out.) The database was set up and used by my teammate. Now I want to access the prepared data on my system.

Neo4j Casual Clustering benfits over High-Availability Clustering

天涯浪子 提交于 2019-12-31 03:15:43
问题 We are in the process of migrating HA cluster to Causal Clustering. Is there any real advantage of migrating from HA Clustering to Causal Clustering? Currently using REST End points only. Is it possible to have causal clustering with just two Neo4j instances? Thanks. 回答1: Causal cluster is the new generation of Neo4j cluster, and it will continue to evolve with new releases. There are many advantages for CC comparing to HA : no branch data (thanks to raft and consensus commit) more stability