neo4j

Cypher: Matching nodes at arbitrary depth via a strictly alternating set of relations

十年热恋 提交于 2019-12-12 05:08:52
问题 I'm quite new to Cypher but struggling to find how to do this. I want to generalise the following so that it will match at an arbitrary depth. MATCH (:start)-[:a]-()-[:b]-(:end) //Depth1 MATCH (:start)-[:a]-()-[:b]-()-[:a]-()-[:b]-(:end) //Depth2 MATCH (:start)-[:a]-()-[:b]-()-[:a]-()-[:b]-()-[:a]-()-[:b]-(:end) //Depth3 MATCH (:start)-[:a]-()-[:b]-()-[:a]-()-[:b]-()-[:a]-()-[:b]-()-[:a]-()-[:b]-(:end) //Depth4 In other words, the path needs to pass through any number of a-node-b in strict

Exception in Executing Cypher Queries of Neo4j in Java Application

孤街醉人 提交于 2019-12-12 05:06:53
问题 I am new to Neo4j Graph Database and I want to create CyperQueries from java Application . I am using the above neo4j manual http://docs.neo4j.org/chunked/milestone/query-create.html I am creating nodes from java APplication as follow public class CreateQuery { public static final String DBPATH="D:/Neo4j/CQL"; public static void main(String args[]) { GraphDatabaseService path=new EmbeddedGraphDatabase(DBPATH); Transaction tx=path.beginTx(); try { Map<String, Object> props = new HashMap<String

Neo4 giving error:“ Uncaught exception 'Everyman\Neo4j\Exception' with message 'Unable to retrieve server info [500]:”

倖福魔咒の 提交于 2019-12-12 05:05:15
问题 require('phar://neo4jphp.phar'); $client = new Everyman\Neo4j\Client(); if($client) { echo 'Connected'; } i am using neo4j version 1.9 RC1, i am able to access server via myip:7474, Curl is Enabled. Error is : couldn't connect Host[7] Please Help 回答1: In order to create the client, you must specify the transport you want to use, if you want to use Curl: $client = new Everyman\Neo4j\Client(new Everyman\Neo4j\Transport\Curl('localhost', 7474)); or with Stream: $client = new Everyman\Neo4j

Neo4j: Shortest Path with Cost Function depending on two Consecutive Relations in Path

廉价感情. 提交于 2019-12-12 04:58:45
问题 Say I have a graph with nodes representing cities and and relations representing possible connections between cities. A connection has a departure and an arrival time. I want to find the shortest path between cities A and B and the cost function is the total travel time. The travel time is the sum of waiting times between connections and connection times. I'm using the Java API and I have tried using the Dijkstra algorithm using GraphAlgoFactory.dijkstra(expander, costEvaluator) . My main

using multiple match clauses doesn't return any result in neo4j cypher query

依然范特西╮ 提交于 2019-12-12 04:58:37
问题 I am executing the following two queries and i am getting some result. First query START person=node:NODE_TYPE(NODE_TYPE='PERSON') MATCH (person)-[?:contacts]->(var1)-[?:addresses]->(var2)-[?:details]->(var3)-[?:items]->(var4)-[?:items]->(var5)-[?:value]->(var6) WHERE var2.`#nodeId` ='at0000' and var3.`#nodeId` ='at0001' and var4.`#nodeId` ='at0002' and var5.`#nodeId` ='at0028' and var6.`value` =~'address.*' return distinct person; Second query START person=node:NODE_TYPE(NODE_TYPE='PERSON')

create a node in neo4j graph db with transaction endpoint

五迷三道 提交于 2019-12-12 04:50:00
问题 I know this is probably asked a hundred times and believe me, I read soooo much on the net already. But still, I am absolutely unapt to do this, so I'm in dire need of help here. What I want to do, is to create a node with label and properties in the neo4j db using cypher and the transactional endpoint - with the properties from a json. This is my code so far: /** * * @description creates a node in the graph * @param json object * @param label * */ private String createNodeObjectTransactional

How to delete nodes recursively from a start node

℡╲_俬逩灬. 提交于 2019-12-12 04:49:20
问题 I have a graph which has a set of nodes and its children. There is a root node from where the rest of the nodes branch out. There are few sets of such node collection. I want to pick a root node and clear all its connections and nodes recursively, leaving the root node for future additions. start n=node:DataSpace(DataSpaceName="DS1") match (ds)-[r]-(e) delete e,r The above Query is definitely wrong, as it does not consider recursion and also the condition that entities have to be deleted

How to configure spring-data-neo4j embedded server properties?

笑着哭i 提交于 2019-12-12 04:48:50
问题 I have setup using spring-data-neo4j v 4.2.1, neo4j-ogm v 2.1.2. I need embedded neo4j server with specific configuration for testing. cypher.forbid_shortestpath_common_nodes=false . I tried this without success in spring @Configuration bean: @Bean public org.neo4j.ogm.config.Configuration getConfiguration() { org.neo4j.ogm.config.Configuration config = new org.neo4j.ogm.config.Configuration(); config.driverConfiguration().setDriverClassName("org.neo4j.ogm.drivers.embedded.driver

Neo4j Cypher sort on collections

吃可爱长大的小学妹 提交于 2019-12-12 04:46:19
问题 I have a query (below) that returns collections of nodes containing create dates. I want to sort the rows by newest create date. Some of the rows have one create date, other rows have several. As can be seen, the node "name4" should be first. What corrections should I make to my query? Thanks. MATCH (node:node) WITH node ORDER BY node.created DESC RETURN count(node.name) AS count, node.name, collect(node.created) AS created count node.name created 3 "name1" [1410234609620,1410234606534

Neo4j Cypher delete query

梦想与她 提交于 2019-12-12 04:45:37
问题 I have a following Neo4j Cypher query for Decision entity deleting: MATCH (d:Decision) WHERE id(d) IN {decisionsIds} OPTIONAL MATCH (d)-[r]-(t) DELETE d, r WITH t, r WHERE NOT (id(t) IN {decisionsIds}) OPTIONAL MATCH (t)-[r2:VOTED_ON|:CREATED_BY|:VOTED_FOR]-() WHERE r2 <> r WITH t, r2 WHERE none(x in labels(t) WHERE x in ['User', 'Decision']) DELETE t, r2 Previously I had a Vote entity with relationships VOTED_ON and VOTED_FOR to entities Criterion and Decision . Also, Vote has relationship