cypher

Cypher temp relationship

半世苍凉 提交于 2021-02-08 08:23:12
问题 I'm trying to combine / merge a path into a new relationship. The problem is that I'm not interested in storing it but rather return it as a result of a cypher query. Lets say I have something like this: (a)-[:CALLS_METHOD]->(b)-[:RETURNS_TYPE]->(c) How can I create a temporary relationship like this one: (a)-[:DEPENDS_ON]->(c) Only for a result of that particular query, so that I don't have to store it. Because I'm really only interested in the dependency from a to c and not the details

Creating relationships based on array values in Neo4j

二次信任 提交于 2021-02-07 23:45:37
问题 I have two nodes representing two people: (:Person {name:"John Smith"}) (:Person {name:"Jane Doe"}) Then I have a third node representing an article coauthored by these two people: (:Article {title:"Some_article"}, {Coauthor:["John Smith", "Jane Doe"]}) My question is: Can I create a relationship between these nodes based on matching the names? Something like this: MATCH (n1:Person {name:"Jane Doe"}) MATCH (n2:Article{Coauthor:"Jane Doe"}) CREATE (n2)-[:AUTHORED_BY]->(n1) Is this possible or

Cypher 'Node Already Exists' issue with MERGE

落花浮王杯 提交于 2021-02-06 09:12:40
问题 I am preplexed on why I am getting an issue with this Cypher statment when I have a unique constraint on the address of the location node but am using a merge which should find that if it exists and only return the id for the rest of the statment. What am I missing? Here is my statement: MERGE(l:Location{location_name:"Starbucks", address:"36350 Van Dyke Ave", city: "Sterling Heights",state: "MI", zip_code:"48312",type:"location",room_number:"",long:-83.028889,lat:42.561152}) CREATE(m:Meetup

Cypher 'Node Already Exists' issue with MERGE

十年热恋 提交于 2021-02-06 09:12:34
问题 I am preplexed on why I am getting an issue with this Cypher statment when I have a unique constraint on the address of the location node but am using a merge which should find that if it exists and only return the id for the rest of the statment. What am I missing? Here is my statement: MERGE(l:Location{location_name:"Starbucks", address:"36350 Van Dyke Ave", city: "Sterling Heights",state: "MI", zip_code:"48312",type:"location",room_number:"",long:-83.028889,lat:42.561152}) CREATE(m:Meetup

Cypher 'Node Already Exists' issue with MERGE

…衆ロ難τιáo~ 提交于 2021-02-06 09:12:05
问题 I am preplexed on why I am getting an issue with this Cypher statment when I have a unique constraint on the address of the location node but am using a merge which should find that if it exists and only return the id for the rest of the statment. What am I missing? Here is my statement: MERGE(l:Location{location_name:"Starbucks", address:"36350 Van Dyke Ave", city: "Sterling Heights",state: "MI", zip_code:"48312",type:"location",room_number:"",long:-83.028889,lat:42.561152}) CREATE(m:Meetup

Neo4j Cypher: Find common nodes between a set of matched nodes

ぃ、小莉子 提交于 2021-02-05 07:37:50
问题 Very similar to the question posted here I have the following nodes: Article and Words. Each word is connected to an article by a MENTIONED relationship. I need to query all articles that have common words where the list of common words is dynamic. From the clients perspective, I am passing back a list of words and expecting back a results of articles that have those words in common. The following query does the job WITH ["orange", "apple"] as words MATCH (w:Word)<-[:MENTIONED]-(a:Article)-[

neo4j return a relationship that isn't defined

 ̄綄美尐妖づ 提交于 2021-02-02 09:55:20
问题 I am quite new to graph databases so what I am asking may be completely made up in my head. I have three nodes, product, supplier and country which looks like the below (feedback welcome on appraoch). I would like to return the product and the country BUT I would like to return a relationship between them to show they are connected (I am envisioning two nodes connected by a line). I got this far where I can return product and supplier but no matter which way I spin the syntax I can't seem to

How to query exact path in neo4j and avoid cartesian product?

[亡魂溺海] 提交于 2021-01-29 09:36:58
问题 I have around 3000 nodes with 7000 relationships in a graph but for a presentation, I'd like to plot a sub-graph of which I know exactly which nodes I need. Therefore, I use the following query which sometimes gives me the correct path as a result (after a long waiting period) and sometimes depletes memory and cpu resources until I force-quit the neo4j-browser. MATCH p1=(:DestinationNode)-[:IS_AT]-> (:CentiDegreeNode{x: 4714, y: 843})-[:CONNECTED_TO*1]- (:CentiDegreeNode{x: 4715, y: 843})-[

Pivoting data in Cypher

若如初见. 提交于 2021-01-29 09:22:23
问题 I've just gotten into working with a Neo4J database, and I'm having a hard time figuring out a good way to pivot some data that I'm working with. I have a basic query that looks like this: MATCH (n:DATA) WHERE n.status =~ "SUCCESS" return n.group as Group, n.label as Label, avg(toFloat(n.durationMillis)/60000) as Minutes , which produces tall narrow data like this: |Group |Label |Minutes| |-------|-------|-------| |group1 |label1 |1.0 | |group1 |label2 |2.0 | |group1 |label3 |5.0 | |group2

Neo4J variable alias not recognized

£可爱£侵袭症+ 提交于 2021-01-29 08:41:01
问题 I have three Person nodes with various relationships. Each node has a latitude and longitude. First, I find the combinations of pairs of nodes: MATCH (p1: Person)-[]->(p2: Person) RETURN p1.name, p2.name My output is correct: Next, I attempt to find the distances between the pairs of nodes: MATCH (p1:Person)-[]->(p2:Person) WITH point({longitude: p1.longitude, latitude: p1.latitude}) AS p1Point, point({longitude: p2.longitude, latitude: p2.latitude}) AS p2Point RETURN (distance(p1Point,