neo4j

Can I recursively evaluate a tree in neo4j cypher language?

妖精的绣舞 提交于 2019-12-23 19:53:24
问题 In my application, I have what is essentially the syntax tree of a mathematical expression as neo4j graph... a picture is probably helpful: I'm wondering if it's possible to write a Cypher query that fully evaluates a tree like this for the top node, i.e.: gets the average of the connected inputs for Node 1.2, the max for 1.1.2 the average of 1.1.2 and 3 for Node 1.1 and finally returns the max of 1.2 and 1.1 as value for Node 1 The value is stored in the property status for the input nodes,

Neo4J server exception - fails to start

我的未来我决定 提交于 2019-12-23 19:24:49
问题 The server had been running fine and dandy but suddenly stopped. Tried restarting but that didn't help. This is what the log says: 2015-02-18 15:07:58.092+0000 INFO [o.n.k.i.DiagnosticsManager]: --- SHUTDOWN diagnostics END --- 2015-02-18 15:07:58.336+0000 ERROR [o.n.s.CommunityBootstrapper]: Failed to start Neo Server on port [7474] org.neo4j.server.ServerStartupException: Starting Neo4j Server failed: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, /var/lib/neo4j-community-2.1.4/data

Paging with Spring Data Graph/Neo4j

[亡魂溺海] 提交于 2019-12-23 19:12:00
问题 Is it possible to fetch Page results when using Spring Data Graph (Neo4J) as the data store? The findAll(Pageable) seems to be the only Pageable query availalble when using the GraphRepository . What I am looking for is Pageable APIs for other findBy***() like queries. Perhaps, there may be a completely different (recommended) way to Page results using Spring Data Graph. Thoughts on that are welcome as well! 回答1: Spring Data Neo4j (2.0 currently in SNAPSHOT but soon RC1) added Page support

how to match only one relationship between two nodes

纵饮孤独 提交于 2019-12-23 19:03:55
问题 i am using neo4j graph db ,it used in Ruby on Rails , for example: i have 3 relationship between tom and jerry ,they cooperated to build 3 houses, and now i just want to match 1 of 3 ;how to write the query code??? i have tried this: this is my code: Neo4j::Session .query("MATCH (s1:Scholar)<-[r:COOPERATE]-(s2:Scholar) WHERE s1.id = #{@scholar.id} RETURN DISTINCT r ") and the result is all relationship between s1 and s2 were founded i just need 1 of relationship between s1 and s2 (i want to

neo4j cypher set statement with parameter map

荒凉一梦 提交于 2019-12-23 17:52:01
问题 I'm struggling to find a definition of how to use the set cypher command with a parameter map Cheat sheet says use: SET n = {map} I have tried: START n = node(11379) SET n = {Name: "Random Test Change"} on my server I get error:- `.' expected but `=' found What am I doing wrong? 回答1: The map parameter could be used like this: String query = "START n = node(11379) SET n = {map}"; Map<String, String> myMap = new HashMap<String, String>(); myMap.put("Name", "Random Test Change"); Map<String,

Neo4j cypher - Import CSV and add relationships between nodes based on the csv values

霸气de小男生 提交于 2019-12-23 15:15:32
问题 Is it possible in cypher to create different relationship between nodes based on the value of csv using the import functionality . Eg : For a given csv data product_id user_id action 1 1 VIEW 1 2 PURCHASE I need to create product node(product_id) , user node(user_id) and either VIEW or PURCHASE relationship between ' user ' and product node based on the value of ' action ' field in csv . Below are the approaches I tried . I know the syntax is incorrect but just to give an idea what I am

How can you log from a Neo4j Server Plugin?

早过忘川 提交于 2019-12-23 15:11:05
问题 I'm trying to debug a problem in the Neo4J Server plugin I'm writing. Is there a log I can output to? It's not obvious where or how to do this. 回答1: Good question. I think you could use Java Logging? That should be routed into the normal logging system. 来源: https://stackoverflow.com/questions/11704687/how-can-you-log-from-a-neo4j-server-plugin

Delete leaf nodes with single relationship in neo4j

与世无争的帅哥 提交于 2019-12-23 15:05:55
问题 I am trying to remove leaf nodes in Neo4j, but only those with a single incoming relationship. (I'm so close.) I have a query that returns the exact node I wish to remove. However, when I replace the RETURN with DELETE, it removes more than the query returns. Here's the complete sequence: neo4j-sh (?)$ match (n)-[r]->(p) return n, r, p ; +------------------------------------------------------------+ | n | r | p | +------------------------------------------------------------+ | Node[2164]{name

Recursive neo4j query

让人想犯罪 __ 提交于 2019-12-23 14:25:06
问题 I have a graph which has categories and sub-categories and sub-sub-categories to indefinite level. How I can I get all this hierarchical data in one cipher query? I currently have this query : START category=node:categoryNameIndex(categoryName = "category") MATCH path = category <- [rel:parentCategory] - subcategory RETURN category, collect(subcategory); Which gives me following result: | category | collect(subcategory) | ==> +------------------------------------------------------------------

Unexpected behavior combining collections in Cypher

拥有回忆 提交于 2019-12-23 14:04:11
问题 Using http://console.neo4j.org as a sandbox, I have come across the following unexpected behavior: Statement 1 - Returns 1 row with a collection containing Neo Node MATCH (n:Crew) WHERE n.name="Neo" WITH COLLECT(n) AS c1 WITH c1+[] AS c2 RETURN c2 Statement 2 - Returns 0 rows (unexpected) MATCH (n:Crew) WHERE n.name="Neo" WITH COLLECT(n) AS c1 MATCH (n:Crew) WHERE n.name="NoOne" WITH c1+COLLECT(n) AS c2 RETURN c2 Statement 3 - Returns 1 row containing an empty collection MATCH (n:Crew) WHERE