neo4j

Reliable (auto)incrementing identifiers for all nodes/relationships in Neo4j

穿精又带淫゛_ 提交于 2019-12-12 22:09:29
问题 I'm looking for a way to generate unique identifiers for all my nodes/relationships in Neo4j, based on an incrementing counter (not big long uuids). The internal ids maintained by the Neo4j engine are known not to be reliable as outside references. A solution that comes close is the code proposed in this question, but it doesn't work when a single CREATE clause creates multiple new nodes: // get unique id MERGE (id:UniqueId{name:'Person'}) ON CREATE SET id.count = 1 ON MATCH SET id.count = id

One-to-Many Shortest Path query support in Neo4j

ⅰ亾dé卋堺 提交于 2019-12-12 21:36:34
问题 Does neo4j have support for one-to-many shortest path queries? An example of such query would be: Given a node i, and a list of several other nodes N, compute the shortest paths from i to all the nodes that belong to N. I am aware of this thread: Neo4j shortest path (BFS) distances query variants, but it is specifically for one-to-all queries. My question is for one-to-many queries. Thank you. 回答1: To get All paths from one node to multiple nodes MATCH p = shortestPath((s:skill)-[r]->(s1

Slow results retrieval from Cypher query in Java - Neo4j 2.0

巧了我就是萌 提交于 2019-12-12 21:24:33
问题 I'm experiencing surprisingly slow retrieval of results with ResourceIterator<Node> when I get results from Cypher query execution in Java. next() command takes on average 156ms, with standard deviation of 385! Is this behavior expected, or am I doing something wrong? Can anybody suggest a more efficient way of achieving the same thing? Graph structure I have the following graph layout, where Point nodes have LinksTo relations to other points: Node:Point Properties: - idPoint (new style

How do you create self-referential nodes?

邮差的信 提交于 2019-12-12 21:11:48
问题 ... or is it possible at all to create a node in Neo4j which has a relationship with itself (a simple loop-node)? If so, what would be the corresponding Cypher query? 回答1: The following query creates Peter who voted for himself. MERGE (peter:User { name: "Peter" }) MERGE (peter)<-[:VOTED_FOR]-(peter) RETURN peter 来源: https://stackoverflow.com/questions/22185212/how-do-you-create-self-referential-nodes

How to get automatic node ID from py2neo?

你离开我真会死。 提交于 2019-12-12 21:06:00
问题 I'm using py2neo 3.1.2 version with Neo4j 3.2.0 and I have a question about it. At Neo4J's web interface I can run the following query to get the nodes ids: MATCH (n:Person) RETURN ID(n) I'd like to know if there's something at py2neo API that does that same thing. I've already inspected the Node object, but I couldn't find anything about it. 回答1: Update: Previous Answer does not work with new py2neo but this answer works The current version of py2neo (4.0.0b12) dropped the remote method. Now

Could not initialize class persistence.common.neo4j.Neo4jSpringContext$ in sbt yet test works in IntelliJ IDEA?

别说谁变了你拦得住时间么 提交于 2019-12-12 20:31:42
问题 I wanted to see if all my test are passing after git merge , and noticed that sbt test failed. All of those tests are the ones that are using Spring context. As to not load Spring context for every test I created the following trait: import org.springframework.context.support.ClassPathXmlApplicationContext trait Neo4jSpringContext { val context = Neo4jSpringContext.context } object Neo4jSpringContext { val context = new ClassPathXmlApplicationContext("testNeo4jApplicationContext.xml") } and

Neo4j node/relation inconsistencies

ⅰ亾dé卋堺 提交于 2019-12-12 19:49:12
问题 When fetching or when I try to delete a specifc node like MATCH (p) where ID(p)=79259223 OPTIONAL MATCH (p)-[r]-() //drops p's relations DELETE r,p I get the following error While loading relationships for Node[79259223] a Relationship[87331456] was encountered that had startNode: 80312215 and endNode: 83719851, i.e. which had neither start nor end node as the node we're loading relationships for I also run the ConsistencyChecker what resulted in a big list of inconsistencys. However how can

Can we generate Cypher Queries from Visual Model of Property Graph of Neo4j?

≯℡__Kan透↙ 提交于 2019-12-12 19:18:31
问题 Is there a way to generate cypher queries from simply modeling the nodes, relations and properties in visual tool ? Something similar to generating java code from UI Mockups in JFormDesigner or any GUI Builder like glade for GTK based things. 回答1: Not exactly what you're looking for, but maybe it helps anyway: With Structr, you can either import a GraphGist, or create schema nodes and relationships with their properties in a visual tool. Structr then creates a schema by auto-detecting labels,

Finding Specific Path in Neo4j Quickly

冷暖自知 提交于 2019-12-12 19:16:15
问题 I've recently asked about how to find all paths between two types os nodes in a way where all the edges in the path had the same attribute (like the same ID). This would be something like: MATCH (a {type: 'cin1'})-[rels:Next*1.. {value: 1}]->(b {type: 'cancer'}) RETURN (a), (b) where instead of having value: 1 I would have value: same for all edges . I found a way to solve this by using something like this (as answered in my other question): MATCH (a:Label {type: 'cin1'}) MATCH (b:Label {type

Neo4j import-tool succeeds but results are not showing up

不问归期 提交于 2019-12-12 19:05:35
问题 I recently started using the import tool for faster load times, and so far the results were promising, except that they are not reflected in my database afterwards through cypher. My process: $ /path/to/neo4j-community-3.0.3/bin/neo4j stop $ rm -rf /path/to/neo4j-community-3.0.3/data/ $ mkdir /path/to/neo4j-community-3.0.3/data $ /path/to/neo4j-community-3.0.3/bin/neo4j-import --nodes:record /path/to/records.csv --into /path/to/neo4j-community-3.0.3/data tmp.csv: meta:ID,time:long,lat:float