neo4j

how to find a particular node in Neo4j

放肆的年华 提交于 2019-12-07 06:19:53
问题 how to find the particular node using the Neo4j API.When i refereed the docs i got some code to get all nodes However if i have a node called "XYZ" I would like to know how to obtain ONLY that particular node. 回答1: Take a look at the Indexing Service which will allow you to index your nodes with key-value pairs. Once you've indexed your nodes you can query the graph and retrieve nodes which match a given key-value. 来源: https://stackoverflow.com/questions/4516953/how-to-find-a-particular-node

how to architect achievements and badging with nosql

南楼画角 提交于 2019-12-07 06:13:58
问题 I currently have an social game app using mongodb for it's database. My question is what are some suggestions if I want to create a points and badging system. The business logic for achievements/badges could become quite complicated and are very ad-hoc so doing real-time awarding of badges would not seem efficient. I am imagining adding tracked actions to a queue somewhere, i.e. Amazon SQS, or just using a user's activity feed as a queue, and have another offline worker process going through

Neo4j - NOT IN query

橙三吉。 提交于 2019-12-07 06:07:19
问题 The graph schema I have is (actors)-[:ACTED_IN]->(movies) . I know how to find actors who have worked with a particular actor as below: MATCH (actor {name:"Tom Hanks"} )-[:ACTED_IN]->(movies)<-[:ACTED_IN]-(costars) return distinct costars; I know how to find all the actors who have worked in some movie: MATCH (all_actor)-[:ACTED_IN]->(movies) return distinct all_actor; However I don't know how to find all actors not in costars. How do I go about it? 回答1: As you want to deduct the coactors

Efficient way to find node set having relationships to given nodes using neo4j

拈花ヽ惹草 提交于 2019-12-07 05:49:33
问题 Is there an efficient way with given two nodes to find a set of their common nodes (with defined relationships). For example, having nodes A1 , B1 , C1 - C4 connected with relationships x and y : A1 --x--> C1 A1 --x--> C2 A1 --x--> C3 B1 --y--> C2 B1 --y--> C3 B1 --y--> C4 a common node set for A1(x) and B1(y) would be [C2, C3] . 回答1: In many cases the structure of the domain can be leveraged to improve performance. Let's say that you know that in general your A entities have less x

Replace regular expressions in cypher

谁都会走 提交于 2019-12-07 05:32:12
问题 I can search for regular expressions in cypher MATCH (n:model) WHERE n.name =~ '.*&.*;.*' RETURN n.name but can I also replace them? I would like to write something like MATCH (n:model) RETURN replace(n.name, ~'&.*;', '_'); 回答1: There is a replace function in cypher, but it does not replace regexps, just simple strings. Maybe a feature request for replaceRegex could be done? An workaround would be to do this programatically, after you return the names (if you use call cypher queries from

How can I use the webadmin interface with an embedded Neo4j 2.0 instance?

点点圈 提交于 2019-12-07 05:08:17
问题 I have a project which has been running with an embedded Neo4j 1.8.2 plus web admin interface. Now I updated the project to run with the latest Neo4j 2.0.1. Although there were some obstacles during that course (as I'm utilizing Spring Data Neo4j) in the end everything went smooth. But currently I'm stuck in getting the web admin running with it. Any advise would be highly appreciated. Here's my config which I was using for the 1.8 version (class for configuration referenced in the snippets)

Does Cypher's ORDER BY uses the index?

℡╲_俬逩灬. 提交于 2019-12-07 04:38:12
问题 I have an index on :Label(Uid) and :Label(Name) However, when I profile (in the shell) the following two queries I get the same codepath for both. The issue is that I have 700,000 items of :Label, and it's starting to be painfully slow to order the items. Query ordering by a property with index: MATCH (item:Label) RETURN item.Name ORDER BY item.Name SKIP 1000 LIMIT 50 Query ordering by a property without index: MATCH (item:Label) RETURN item.Name ORDER BY item.Created SKIP 1000 LIMIT 50 The

Neo4j match path exclude node with certain label

戏子无情 提交于 2019-12-07 04:06:03
问题 I am having a issue to retrieve path in neo4j exclude certain label. Foe example, I have -->(h)-->(j) / (a)-->(b)-->(c)-->(d)-->(i) \ -->(f)-->(g) with h node has a Deleted label. I have query MATCH path = (n)-[*]->(child) where id(n)={id of node a} and NOT child:Deleted RETURN path then I want this query to return the full path but exclude the subtree of node h since node h is Deleted . the return tree should be like (a)-->(b)-->(c)-->(d)-->(i) \ -->(f)-->(g) But the query seems not working.

find distinct paths in neo4j database

孤人 提交于 2019-12-07 03:55:28
I have a graph in which nodes of type "User" can be connected (or not) to other "User" nodes using "SIMILAR" relationship. I want to find all the sub-graphs (interconnected "User" nodes) ordered by the number of their nodes. Example: Imagine I have these nodes (relationship is always of type "SIMILAR") A -> B, A -> C, D -> B, E -> F, Z I'd like to get : [A,B,C,D]; [E,F]; [Z]; Using Cypher or traversals. In cypher it will be expensive. Something like this query: MATCH m WITH collect(m) as all MATCH n RETURN distinct [x in all WHERE (n)-[*0..]-(x) | x.name] as cluster This would work too, but is

How to merge nodes that have the same value for name property in Neo4j

拟墨画扇 提交于 2019-12-07 03:45:01
问题 I just push text corpus into Neo4j database. When I execute MATCH (n) RETURN n Cypher query, it returns multiple nodes with the same name. how can I merge these nodes as one? nodes having same name 回答1: Your name values have different values because of upper and lower case letters ("Java" and "java" are different). I reproduced your scenario creating a sample data set: CREATE (n1:Node {name : "Java"}), (n2:Node {name : "Java"}), (n3:Node {name : "java"}), (n1)-[:TYPE]->(), (n1)-[:TYPE]->(),