neo4j

Cypher - get relationships with start node id, end node id and type

江枫思渺然 提交于 2019-12-25 07:20:05
问题 I have the type and the id for the start and end node of a relationship. I would like a query that returns all the possible actions. I have tried this MATCH (a)-[r]-(b) WHERE id(a)=1 AND id(b)=2 RETURN *; But it doesn't work. Solution I use GrapheneDB. Usually GrapheneDB presents the system node id on the node graphic but when you have an attribute id it presents that instead. When I ran the query I was using the graphic id which wasn't actually the system id so id(a) didn't give the expected

Update multiple nodes in a single query, each with different property / value pairs

不羁的心 提交于 2019-12-25 07:19:57
问题 A similar question was answered by Michael Hunger in early 2013 however I am unable to translate his response to Neo4j/Cypher 3.x. https://groups.google.com/forum/#!msg/neo4j/qZWhbMtMCTE/r3W7OZfCgAgJ Each node has at a property with a UUID value. In some cases the "second" property is a Boolean, in other cases a string. I want to update some of these nodes, changing or adding a property to each one. (n1 {uuid:"foo1", enabled: true}) (n2 {uuid:"foo2", example: "foo"}) (n3 {uuid:"foo3"}) I

neo4jphp: Cannot instantiate abstract class Everyman\Neo4j\Transport

♀尐吖头ヾ 提交于 2019-12-25 07:08:50
问题 maybe a simple question but for me as starter with Neo4j a hurdle. I installed the neo4jphp with composer in the same directory as my application. Vendor-Subfolder has been created and the everyman/neo4j folder below is available. For a first test I used this code snippet from the examples: spl_autoload_register(function ($className) { $libPath = 'vendor\\'; $classFile = $className.'.php'; $classPath = $libPath.$classFile; if (file_exists($classPath)) { require($classPath); } }); require(

neo4jphp: Cannot instantiate abstract class Everyman\Neo4j\Transport

泄露秘密 提交于 2019-12-25 07:07:13
问题 maybe a simple question but for me as starter with Neo4j a hurdle. I installed the neo4jphp with composer in the same directory as my application. Vendor-Subfolder has been created and the everyman/neo4j folder below is available. For a first test I used this code snippet from the examples: spl_autoload_register(function ($className) { $libPath = 'vendor\\'; $classFile = $className.'.php'; $classPath = $libPath.$classFile; if (file_exists($classPath)) { require($classPath); } }); require(

Neo4J 2.0.1 doesn't work with Gephi 0.8.2 and “Neo4J Graph Database Support” plugin

社会主义新天地 提交于 2019-12-25 06:57:15
问题 Have the following versions of software: Neo4J community: 2.0.1 Gephi: 0.8.2-beta Neo4J Graph Database Support plugin: for Gephi 0.8.2 I'm using the default.graphdb that came with Neo4j 2.0.1 (started playing with Neo4j yesterday) While doing full import from Gephi using Neo4J plugin I get this error: Caused by: org.neo4j.kernel.impl.storemigration.UpgradeNotAllowedByConfigurationException: Failed to start Neo4j with an older data store version. To enable automatic upgrade, please set

Get relationship nodes by Variable length relationships in Neo4j using Neo4jClient

北城余情 提交于 2019-12-25 06:55:13
问题 I use Neo4jClient and I want to get relation attribute by Variable length relationships (n:Users {id:1})-[r:FOLLOW*1..4]-(m:Users) RETURN r how I can get node with attribute relation , for example : Node[0]{id:1,name:"Oliver Stone"} Node[1]{id:2,name:"Charlie Sheen"} Node[2]{id:3,name:"Martin Sheen"} Node[3]{id:4,name:"TheAmericanPresident"} I should know , what is attribute relation between Node[0] and Node[2]? (attribute mean "FOLLOW" or "IGNORE") 回答1: First up, if you are using [r:FOLLOW*1

Trying out neo4j grails plugin, but it does not mach the docs

让人想犯罪 __ 提交于 2019-12-25 06:37:17
问题 I am trying neo4j plugin and I created a simple test as follows: package com.iibs.graph import groovy.util.GroovyTestCase import com.iibs.graph.Node public class NodeTests extends GroovyTestCase { void testCRUD() { Node.deleteAll(Node.list()) Node node = new Node(name: "Name") node.save(flush: true, failOnError: true) Node found = Node.findByName("Name") assert found instanceof Node assert found.getName() == "Name" assert found.node instanceof org.neo4j.graphdb.Node } } Based on the

Neo4J: find a sub-graph of arbitrary depth with nodes connected by a given set of relations?

你说的曾经没有我的故事 提交于 2019-12-25 06:28:09
问题 How to build a Neo4J query that: 1) Will return all nodes in a sub-graph of arbitrary depth with nodes connected by a given set of relations? For example in Cypher-like syntax: MATCH (*)-[r1:FRIEND_OF AND r2:COLLEAGUE_WITH]->(*) RETURN * 回答1: This query will return just the nodes, as you stated in your question: MATCH (n)-[:FRIEND_OF|COLLEAGUE_WITH*]->(m) RETURN n, m; If you also want the relationships: MATCH (n)-[r:FRIEND_OF|COLLEAGUE_WITH*]->(m) RETURN n, r, m; 来源: https://stackoverflow.com

Optimizing Cypher queries with lots of optional relationships

穿精又带淫゛_ 提交于 2019-12-25 06:26:17
问题 I'm using Cypher over the batch REST API with Neo4j 2.0.1. I'm trying to optimize my queries which have lots of optional relationships. I'd like to retrieve all of the data in one shot to limit the number of round trips I have to make to the database. Even though I only have about 12000 nodes in my database, the queries are already starting to crawl (some are taking over 1.5 seconds to return 1000 nodes). I've set up a graph gist that goes into more detail at http://gist.neo4j.org/

Side effects while combining two statements using Cypher

本秂侑毒 提交于 2019-12-25 05:43:14
问题 I created the following example case: MERGE (p1:C5{userId:'1234'}) mERGE (p2:C5{userId:'555'}) MERGE (p3:C5{userId:'1234'}) mERGE (p4:C5{userId:'6969'}) MERGE (p1)-[r1:follow]->(p2) MERGE (p2)-[t1:follow]->(p1) MERGE (p3)-[r2:follow]->(p4) MERGE (p4)-[t2:follow]->(p3) SET r1.type='mirror', t1.type='real', r2.type='real', t2.type='mirror' I am trying to create a statement which delete relationships from a given Node(by userId prop) only by this criteria: For a given Node the incoming