cypher

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

how to create relationship and merge/create new node in loop in neo4j

与世无争的帅哥 提交于 2019-12-25 04:34:52
问题 I am trying to create friend relationship to all the ids in the list but I am getting an error: y already declared (line 2, column 41 (offset: 64)) "Merge (y:User{id:"21",name:"b"}) Merge (y:User{id:"41",name:"d"}) Merge (y:User{id:"51",name:"e"}) " ^ Neo.ClientError.Statement.InvalidSyntax I am trying to create a new user with id,name,year and also relationship with existing node at the same time .How can I do it ?Is there any other way also?I really appreciate any help. MATCH (u:User {id:"2

Drawing a graph using d3js from neo4j/cypher json output

守給你的承諾、 提交于 2019-12-25 04:07:12
问题 Is it possible to return in a single cypher query distinct nodes and edges of a specific path. For instance, using the movies graph the query below return separately movies and actors, I'd like to return all nodes together. using path p = (...) and nodes(p) actually returns pairs of nodes regardless the use of distinct. match (m:Movie {name: "Rain"}) -- (p:Person) return {nodes: collect(distinct {name: m.title}), actors: collect(distinct {name: a.name}), links: collect({source: m.title,

Performance issues using neo4j rest http client

别来无恙 提交于 2019-12-25 03:57:20
问题 Struggling this after replacing neo4j-jdbc client with Apache http client. Seems like we still have issues when running only 1k concurrent users that execute our query. This is how we using the client: https://gist.github.com/IdanFridman/1989b600a0a032329a5e this is how we execute the query using that rest-client: https://gist.github.com/IdanFridman/22637f95ba696f498b6c after profiling we see the above bad performance results: With avg latency of 3 seconds per request. Should we ditch neo4j?

How to retrieve the nodes with multiple relationships using cypher query

孤人 提交于 2019-12-25 03:38:15
问题 Can some one please help me on this. I am using cypher query to get the nodes that are having relationship as either 'hive' or 'hadoop' and i am able to get the nodes. but when i try to get the nodes that are having relationship as both 'hive' and 'hadoop' i am not able to get the nodes. This is the query i am using start n=node(*) match (n)-[r]-() where type(r)="Hadoop" and type(r)="hive" return n,count(n); This query returns 0 rows. Is my query wrong or do i need to do it the other way.

Set a transient property on a node neo4j

微笑、不失礼 提交于 2019-12-25 03:32:39
问题 Is there way to set a transient property on nodes returned by a cypher query such that it is only visible to the user running the query. This would allow us offload some controller logic directly into Neo4j and reduce business logic queries. Currently I have a list that is returned by List<Post> newsFeed (Long uid) {} Post is a relationship between a User and News node. I have two sub-classes of the Post object: BroadcastedPost MentionedPost I have two cypher queries that return the posts

How to store properties of a neo4j node as an array?

ぃ、小莉子 提交于 2019-12-25 03:23:11
问题 I am working on an HR analytics projects using neo4j and I encountered a complicated query (I am also very new to cypher). Basically, I have a list of employee with some features like location, skill set, education and positions with location, skills required. I look if location (employee’s location and position’s location) matches and set that score to 1 (0 otherwise). If I have only one open position, the query works fine. However, with more positions the variable gets overwritten with last

How to get all connected nodes, excluding specific relationships

风格不统一 提交于 2019-12-25 03:17:39
问题 I'm looking for a performant way of retrieving all connected nodes. However there is a twist. I would like to exclude nodes and consequent children, that are connected via certain relationship types. The attached figure illustrates my case. There are two or more clusters of nodes. I would like to retrieve all nodes of a single cluster, depending on the id inside the query. All other nodes (coming from different clusters) and connected via "LINK..." relations shall not be included. I know how

hierarchy property in graph database

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 03:14:01
问题 I'm starting to use neo4j. In my graph database I've the nodes Person (look at "John" below), with the labels: Name (string), Food (positive integer). Each Person is connected with other Person through the relationship isFriendTo , that has a value. I use the graph DB only to find the shortest weighted path between two person. Also, every day I check every node in the graph, and if the food go under value of 100, I take some actions. Now, after some improvements, the property Food is no more