neo4j

To get all the nodes connected to a super node in Neo4j

女生的网名这么多〃 提交于 2019-12-24 00:58:12
问题 I have started learning cypher query for using graphical database. How should i get the values of all the nodes related to a super node. I am trying out the following query in console but its not working: start a=node(2) match (a)-[:TYPE*]<-(node) return node; node(2) is the super node. and the relation by which all other nodes are connected to a super node is TYPE. How should i correct my query.? Error : SyntaxException: expected - 回答1: You're representing the relationship wrong, try start a

Neo4j k-shortest paths with cost property

核能气质少年 提交于 2019-12-24 00:56:40
问题 We are using Neo4J 2.0 embedded; we have a Graph with around 1 Million of Nodes, and 50 Million of relationships; we have to find N shortestPath but with a well known cost property We saw that there is no such method in GraphAlgo class of neo4j and we were thinking to use Chyper, but when run this query START startNode = node(269604), endNode = node(269605) MATCH path=(startNode)-[:CAR_MAIN_NODES_RELATION*]->(endNode) RETURN path AS shortestPath, reduce(cost=0, rel in relationships(path) |

What is the difference between “started streaming” and “completed” in Neo4j queries?

不想你离开。 提交于 2019-12-24 00:42:30
问题 In the Neo4j browser, when I profile a query, I get: "Started streaming 162063 records after 129 ms and completed after 13793 ms." Were the results all gathered after 129ms, but it took 13793ms to output them to the browser? Also, when I run queries in the Cypher Shell, I get "162063 rows available after 9 ms, consumed after another 8673 ms". Does this mean all of the data was gathered after 9ms, but it took 8673ms to output it to the shell? 回答1: When records (or rows) are streamed , the

Spring Data REST Neo4j create a relationship

天大地大妈咪最大 提交于 2019-12-24 00:20:05
问题 I'm building a little test app as a way to learn Angular and refresh myself on a lot of the Spring stack. I have some minor experience with Neo4J, but the app idea has ground with a graph db like Neo4j. The idea is pretty simple, a ui to create characters and stories, and relate the characters to the stories and each other, map their individual versions of a story and create some graphs that show the character interactions to help write the overall narrative. I've got nodes for the characters

Neo4j merge performance VS create/set

三世轮回 提交于 2019-12-24 00:18:55
问题 I have a tree I store in Neo4j, in the tree, each node contains an identifier and a counter. I want to be able to increment that counter in a fast way, for a bunch of nodes. So I used MERGE (with ON CREATE SET and ON MATCH SET), however the performance is quite poor. And it seems that if I do it with two transactions, one to know if each node exists and another to create it or update it, it is faster. Do you know why MERGE is slower than a MATCH and CREATE combined ? And how can I improve its

Can I find all the relations between two nodes in neo4j?

倖福魔咒の 提交于 2019-12-24 00:16:19
问题 I have a group of nodes which are related in the following way: A --> B --> C --> D The relation is a "connected with" relationship with some id property. My question is: Can I write a cypher query which will show me all the id properties of each relationship from start node A to the start node D without mentioning in the query any of the nodes in between. Thanks Dimitris 回答1: Perhaps you are looking for a variable length relationship: MATCH (a:A { name:"Some property" })-[r:connected_with*1.

Spring Data Neo4j 4returning cached results?

丶灬走出姿态 提交于 2019-12-24 00:03:43
问题 I'm not sure if this is a Neo4j question or a Spring Data question. I'm fairly new to Neo4j, so I just want to make sure I'm doing things right. I'm using spring-data-neo4j:4.0.0.RELEASE with a neo4j-community-2.3.1 DB instance. The situation is that I am getting more nodes that I'm expecting back from DB queries. If I create a graph consisting of 3 different types of nodes: (NodeA)-[:NodeAIncludesNodeB]->(NodeB)-[:NodeBIncludesNodeC]->(NodeC) and then I run a query to get a single NodeA node

How to return max counts per another node's properties

青春壹個敷衍的年華 提交于 2019-12-23 20:38:45
问题 I need to calculate how many times a composer's pieces of music were performed per decade, then return only the one piece with the most performances per decade. This cypher does everything except filter all but the highest counts per decade. match (c:Composer)-[:CREATED_BY]-(w:Work)<-[*..2]-(prog:Program) WHERE c.lastname =~ '(?i).*stravinsky.*' WITH w.title AS Title, prog.title AS Program, LEFT(prog.date, 3)+"0" AS Decade RETURN Decade, Title, COUNT(Program) AS Total ORDER BY Decade, Total

Working with indexes in neo4j and py2neo

回眸只為那壹抹淺笑 提交于 2019-12-23 20:21:22
问题 I have just started working with py2neo and neo4j. I am confused about how to go about using indices in my database. I have created a create_user function: g = neo4j.GraphDatabaseService() users_index = g.get_or_create_index(neo4j.Node, "Users") def create_user(name, username, **kwargs): batch = neo4j.WriteBatch(g) user = batch.create(node({"name" : name, "username" : username})) for key, value in kwargs.iteritems(): batch.set_property(user, key, value) batch.add_labels(user, "User") batch

run neo4j with docker-compose - neo4j not accessible from localhost:7474

半城伤御伤魂 提交于 2019-12-23 20:18:40
问题 ---EDITED -- NO LONGER WORKING --- PLEASE HELP--- maybe something is changed in the latest neo4j image (SE MY ANSWER BELOW FOR MORE DETAILS) I'm try to run neo4j with docker-compose by means of this github repo (that contains the docker-compose.yml) https://github.com/GraphRM/workshop-neo4j-docker The docker-compose file conteined in this repo is nothing more that a plain neo4j docker image with some data already attached (you can try yourself, the image is realy small) Running this file