cypher

create relationship and merge node in loop in neo4j

允我心安 提交于 2020-01-04 23:51:40
问题 I am trying to create a relationship in loop from both top list and bottom list .I am trying to connect the top loop with the bottom loop .I really appreciate any help.Thanks. UNWIND [{id:"1",name:"b1",year:"2010"}, {id:"2",name:"d1",year:"2011"}, {id:"3",name:"e1",year:"2013"}] as user MERGE (u:User {id: user.id, name: user.name,year:user.year}) UNWIND [{id:"21",name:"b",year:"2010"}, {id:"41",name:"d",year:"2011"}, {id:"51",name:"e",year:"2013"}] as w MERGE (y:W {id: w.id, name: w.name,year

create relationship and merge node in loop in neo4j

不羁岁月 提交于 2020-01-04 23:46:42
问题 I am trying to create a relationship in loop from both top list and bottom list .I am trying to connect the top loop with the bottom loop .I really appreciate any help.Thanks. UNWIND [{id:"1",name:"b1",year:"2010"}, {id:"2",name:"d1",year:"2011"}, {id:"3",name:"e1",year:"2013"}] as user MERGE (u:User {id: user.id, name: user.name,year:user.year}) UNWIND [{id:"21",name:"b",year:"2010"}, {id:"41",name:"d",year:"2011"}, {id:"51",name:"e",year:"2013"}] as w MERGE (y:W {id: w.id, name: w.name,year

variable length matching over paths in Cypher

亡梦爱人 提交于 2020-01-04 18:12:06
问题 Is it possible to allow variable length matching over multiple paths in Cypher? By a path I mean something like two KNOWS traversals or three BLOCKS traversals, where KNOWS and BLOCKS are relationship types in my graph. For example, I'd like to be able to write something like: MATCH (s)-[r*]->(t) WHERE ALL (x in type(r) WHERE x=KNOWS/KNOWS OR x= BLOCKS/BLOCKS/BLOCKS) RETURN s, t where by "KNOWS/KNOWS" I mean something like (a)-[:KNOWS]->(b)-[:KNOWS]->(c). I want to do this without changing

Neo4j Cypher query performance optimization

試著忘記壹切 提交于 2020-01-04 14:02:31
问题 I have the following Neo4j Cypher query MATCH (dg:DecisionGroup)-[:CONTAINS]->(childD:Decision) WHERE dg.id = 1 MATCH (childD)-[relationshipValueRel4:HAS_VALUE_ON]-(filterCharacteristic4:Characteristic) WHERE filterCharacteristic4.id = 4 WITH relationshipValueRel4, childD, dg WHERE (ANY (id IN [2,3] WHERE id IN relationshipValueRel4.optionIds )) WITH childD, dg OPTIONAL MATCH (childD)-[vg:HAS_VOTE_ON]->(c:Criterion) WHERE c.id IN [2, 3] WITH childD, dg, vg.avgVotesWeight as weight, vg

neo4j how to work with two match

我是研究僧i 提交于 2020-01-04 09:05:24
问题 I have two queries. First query is match (user)-[r:CreatesChat]-(chatitems) Second query is match (chatitems)-[r:PartOf]-(teamschat)-[s:OwnedBy]-() I want to return the first 3 users from the first query And to return the first 3 teams from the second query The goal is to check if users from first query have the teams of second query My neo4j query is match (user)-[r:CreatesChat]-(chatitems) with user.id as uid,chatitems.id as chatid order by uid desc with collect([uid])[..3] as users,collect

Adding millions of nodes to neo4j spatial layer using cypher and apoc

半世苍凉 提交于 2020-01-04 06:50:28
问题 I have a data set of 3.8million nodes and I'm trying to load all of these into Neo4j spatial. The nodes are going into a simple point layer, so have the required latitude and longitude fields. I've tried: MATCH (d:pointnode) WITH collect(d) as pn CALL spatial.addNodes("point_geom", pn) yield count return count But this just keeps spinning without anything happening. I've also tried (I've been running the next query all on one line, but I've just split it up for ease of reading): CALL apoc

Adding millions of nodes to neo4j spatial layer using cypher and apoc

ⅰ亾dé卋堺 提交于 2020-01-04 06:50:27
问题 I have a data set of 3.8million nodes and I'm trying to load all of these into Neo4j spatial. The nodes are going into a simple point layer, so have the required latitude and longitude fields. I've tried: MATCH (d:pointnode) WITH collect(d) as pn CALL spatial.addNodes("point_geom", pn) yield count return count But this just keeps spinning without anything happening. I've also tried (I've been running the next query all on one line, but I've just split it up for ease of reading): CALL apoc

Is there a way to remove _id _type from cypher result

梦想与她 提交于 2020-01-04 05:54:29
问题 I'm converting the result of my query to a tree using the apoc.convert.toTree() procedure and then I filter the result to get only couple properties. However, in the resulting payload I get two properties _id and _type that I'm unable to remove. this is my query where I' supposed to get only prefLabel and uri: MATCH p=(n {uri:'https://enterprise.poolparty.biz/Taxo_test/11325'})-[:narrower*]->(m) WHERE NOT ()-[:narrower]->(n) WITH COLLECT(p) AS ps call apoc.convert.toTree(ps, true, { nodes:

Load only few samples from large csv file in neo4j

我是研究僧i 提交于 2020-01-04 05:36:39
问题 I am new for neo4j db. I've a large csv file which cannot fit in my machine's ram. Before I load all the records in db using USING PERIODIC COMMIT , I want to test my cypher query on the small sample of data. How can I load load just 1000 rows of data and test out my query. The data has columns in simplified form as [Employee, CompanyName] . I want to create relationship as (:Employee)-[:Employed]->(:Company) . The Employee and the CompanyName nodes are already loaded into the database. 回答1:

Can I parameterize labels and properties on CREATE or SET? (REST and transaction)

一笑奈何 提交于 2020-01-04 04:16:09
问题 I have a query 1. CREATE (a:%1$s {props}), (b:%2$s {props2}), (b)-[:%3$s {relProps}]->(a) 2. MATCH (a:%1$s { value:{value} })-[:%2$s]->(b) WHERE (b:%3$s) SET (b {props}) I'm using underscore.string to allow string format but would love to just stick with parameters. Is it possible to parameterize labels such as { "query": CREATE (a:{label} {props}), "params": { "label":"SomeLabel", "props":{....} } } and is it also possible to parameterize properties on a SET? { "query": "MATCH ..... SET