cypher

In Neo4J, how to set the label as a parameter in a cypher query from Java?

安稳与你 提交于 2019-12-19 05:24:17
问题 I have problems with parameter in cypher in Neo4J from Java. I run the the database embedded. The code should be like this (GraphDB.cypher goes directly to the ExecutionEngine) HashMap<String, Object> parameter = new HashMap<>(); parameter.put("theLabel1", "Group"); parameter.put("theRelation", "isMemberOf"); parameter.put("theLabel2", "Person"); GraphDB.cypher("MATCH (n1:{theLabel1})-[r:{theRelation}]->(n2:{theLabel2}) RETURN n1, r, n2", parameter); but it ends in this exception Exception in

Neo4j 2 Cypher fuzzy search

↘锁芯ラ 提交于 2019-12-19 04:24:19
问题 I'm using Neo4j 2 REST API and I have the ability to add plugins. I have an entity in my database with the label 'Entity' and name 'United Kingdom'. How do I execute a fuzzy search to find this entity. I would like to be able to find it using queries like United Kingdom Uniter Kingdom United Kinjdom So the .*<query>.* won't do it. I notice there was support for something like this in previous versions. start n = node:index("name : 'United Kinjom'~0.2") return n But this doesn't appear to work

Find all events between 2 dates

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 13:38:01
问题 Trying to figure out the following scenario. Setup: Used the suggestions in this post to create a Time Tree http://www.markhneedham.com/blog/2014/04/19/neo4j-cypher-creating-a-time-tree-down-to-the-day/ Extended it to go to the Hour and Minutes (for the sake of simplicity, using 0,15,30,45 Connected the Minutes with :NEXT (similar to what's done on days, but on minutes) Created several events attached to the minutes with "STARTS_AT" and "ENDS_AT" Goals Find all events occurring between two

Neo4j Cypher: How do you unpack nodes from a path to allow for further matching?

社会主义新天地 提交于 2019-12-18 12:32:08
问题 This question is a follow on to the question here I have a graph that has a circular linked list. (see here for an example) Each node in the linked list points to a User. When querying the list I have to use a path statement as the list is circular and I do not want to retrieve nodes beginning from the u:USER node. In order to get the nodes of interest my query looks like this: MATCH path=(nl:NODELINK { linkId:'cc' })-[:LINK*]->(u:USER) RETURN nodes(path) Once I have retrieved the path I

Neo4j - Cypher vs Gremlin query language

情到浓时终转凉″ 提交于 2019-12-18 09:54:36
问题 I'm starting to develop with Neo4j using the REST API. I saw that there are two options for performing complex queries - Cypher (Neo4j's query language) and Gremlin (the general purpose graph query/traversal language). Here's what I want to know - is there any query or operation that can be done by using Gremlin and can't be done with Cypher? or vice versa? Cypher seems much more clear to me than Gremlin, and in general it seems that the guys in Neo4j are going with Cypher. But - if Cypher is

Neo4jClient - Retrieving relationship from Cypher query

你离开我真会死。 提交于 2019-12-18 09:23:34
问题 I'm having trouble retrieving matched relationships from a Cypher query. I have this simple trial code: var movie = client.Create(new Movie { Title = "The Matrix" }); client.Create(new Actor { Name = "Keanu Reeves" }, new ActedIn(movie, new ActedInPayload { Role = "Neo" })); client.Create(new Actor { Name = "Hugo Weaving" }, new ActedIn(movie, new ActedInPayload { Role = "Agent Smith" })); var actorsAndRoles = client .Cypher .Start(new { movie = movie }) .Match("actor-[r:ACTED_IN]->movie")

Neo4j: Lucene phrase matching using Cypher (fuzzy)

耗尽温柔 提交于 2019-12-18 09:12:23
问题 In Lucene, a Phrase is a group of words surrounded by double quotes such as "hello dolly". I would like to be able to do the CYPHER equivalent of this Lucene fuzzy query: "hello dolly"~0.1 This finds my "hello dolly" node: START n=node:node_auto_index("name:\"hello dolly\"~0.1") RETURN n This doesn't: START n=node:node_auto_index("name:\"hella dolly\"~0.1") RETURN n Splitting the search phrase by whitespace into Single Terms does work: START n=node:node_auto_index("name:hella~0.1 AND name

Neo4j query for shortest path stuck (Do not work) if I have 2way relationship in graph nodes and nodes are interrelated

旧城冷巷雨未停 提交于 2019-12-18 07:05:10
问题 I made relation graph two relationship, like if A knows B then B knows A, Every node has unique Id and Name along with other properties.. So my graph looks like if I trigger a simple query MATCH (p1:SearchableNode {name: "Ishaan"}), (p2:SearchableNode {name: "Garima"}),path = (p1)-[:NAVIGATE_TO*]-(p2) RETURN path it did not give any response and consumes 100% CPU and RAM of the machine. UPDATED As I read though posts and from comments on this post I simplified the model and relationship. Now

Creating a metabolic pathway in Neo4j

為{幸葍}努か 提交于 2019-12-18 05:01:15
问题 I am attempting to create the glycolytic pathway shown in the image at the bottom of this question, in Neo4j, using these data: glycolysis_bioentities.csv name α-D-glucose glucose 6-phosphate fructose 6-phosphate "fructose 1,6-bisphosphate" dihydroxyacetone phosphate D-glyceraldehyde 3-phosphate "1,3-bisphosphoglycerate" 3-phosphoglycerate 2-phosphoglycerate phosphoenolpyruvate pyruvate hexokinase glucose-6-phosphatase phosphoglucose isomerase phosphofructokinase "fructose-bisphosphate

Move/copy all relationships to different node

我的未来我决定 提交于 2019-12-18 03:42:11
问题 Is there any way to copy or move a relationship from one node to another? I have a situation similar to that here: neo4j merge 2 or multiple duplicate nodes and here: Copy relationships of different type using Cypher Say I have this pattern in the graph (a)-[r:FOO]->(b) (a)<-[r2:BAR]-(c) I then have another node, (d) , which may or may not be a duplicate of (a) . My thinking is that it does not matter whether the nodes are duplicate or not from a functionality point of view. I want to be able