cypher

How can I limit to only one relationship between two nodes in Neo4j?

♀尐吖头ヾ 提交于 2020-05-24 00:35:46
问题 I have the following graph: Currently I am using this QUERY to add a relationship between two nodes: MATCH (a:Service),(b:Service) WHERE a.service_id = 'cs2322' and b.service_id = 'ab3232' CREATE (a)-[r:DEPENDENT_ON]->(b) RETURN type(r) However I dont want to have more than one relationship between any two nodes, because I want to visualise my services and the dependency between them, so I cannot have a service being two times dependent on the other. Is there any way I can limit this to force

Neo4j match nodes related to all nodes in collection

那年仲夏 提交于 2020-05-14 01:29:47
问题 I have a graph of tags, which are related with each other. My goal is to create a Cypher query, which will return all tags that are related to an array of input tags via 1 or 2 hops. I made a query, which doesn't work quite as intended. MATCH (t:Tag) WHERE t.name IN ["A", "B", "C"] WITH t MATCH (a:Tag)-[:RELATED*1..2]-(t) RETURN DISTINCT a; This query first finds the nodes A , B , C and then searches for tags, that are related to A , B or C via 1 node or less. What I want to do though is to

Neo4j match nodes related to all nodes in collection

我们两清 提交于 2020-05-14 01:28:47
问题 I have a graph of tags, which are related with each other. My goal is to create a Cypher query, which will return all tags that are related to an array of input tags via 1 or 2 hops. I made a query, which doesn't work quite as intended. MATCH (t:Tag) WHERE t.name IN ["A", "B", "C"] WITH t MATCH (a:Tag)-[:RELATED*1..2]-(t) RETURN DISTINCT a; This query first finds the nodes A , B , C and then searches for tags, that are related to A , B or C via 1 node or less. What I want to do though is to

Neo4j match nodes related to all nodes in collection

放肆的年华 提交于 2020-05-14 01:28:33
问题 I have a graph of tags, which are related with each other. My goal is to create a Cypher query, which will return all tags that are related to an array of input tags via 1 or 2 hops. I made a query, which doesn't work quite as intended. MATCH (t:Tag) WHERE t.name IN ["A", "B", "C"] WITH t MATCH (a:Tag)-[:RELATED*1..2]-(t) RETURN DISTINCT a; This query first finds the nodes A , B , C and then searches for tags, that are related to A , B or C via 1 node or less. What I want to do though is to

Neo4j match nodes related to all nodes in collection

一曲冷凌霜 提交于 2020-05-14 01:28:05
问题 I have a graph of tags, which are related with each other. My goal is to create a Cypher query, which will return all tags that are related to an array of input tags via 1 or 2 hops. I made a query, which doesn't work quite as intended. MATCH (t:Tag) WHERE t.name IN ["A", "B", "C"] WITH t MATCH (a:Tag)-[:RELATED*1..2]-(t) RETURN DISTINCT a; This query first finds the nodes A , B , C and then searches for tags, that are related to A , B or C via 1 node or less. What I want to do though is to

how to get all related nodes idetails based on node id?

陌路散爱 提交于 2020-04-18 03:42:08
问题 I want to fetch all the connected nodes based on the node id. e.g: In the below image if I send id: 0 then I need all the nodes and edges related to that. i.e 0,1 and 2 . I am using Match (n)-[r]-() return n,r to fetch all the nodes from the db. How can I specify the id of the nodes to get all the related nodes information 来源: https://stackoverflow.com/questions/60650902/how-to-get-all-related-nodes-idetails-based-on-node-id

Facing an error while trying to get a .csv column

陌路散爱 提交于 2020-04-17 22:45:00
问题 I'm trying to display one column of a .csv file in Neo4j. Here in the content of .csv file: site,IP ex1.com,10.10.10.10 ex2.com,11.0.0.0 I use this query: LOAD CSV WITH HEADERS FROM 'file:///file.csv' AS row WITH row[1] AS ip RETURN ip LIMIT 3 but I get this error: Expected Long(1) to be a org.neo4j.values.storable.TextValue, but it was a org.neo4j.values.storable.LongValue What's wrong? 回答1: Since you specified the WITH HEADERS option, you should access the file's data fields using the

Import data from 2 csv files in neo4j

烂漫一生 提交于 2020-04-17 21:28:30
问题 As a continue to this post in which I completely explained what I'm supposed to do, in case my central node is located in another .csv file, how can I import it in my graph? The content of names.csv (2 columns: Lname & Fname): Lname,Fname Brown,Helen Right,Eliza Green,Helen Pink,Kate Yellow,Helen The content of central.csv (2 columns: central & value): central,value cent1,10 I tried something like this: LOAD CSV WITH HEADERS FROM 'file:///central.csv' AS frow MERGE (c:center {name: frow

neo4j LOAD CSV with Tabs

為{幸葍}努か 提交于 2020-04-13 05:00:09
问题 I am trying to load a csv and create nodes in neo4j 2.1.0 using the following: USING PERIODIC COMMIT LOAD CSV FROM "file://c:/temp/listings.TXT" AS line FIELDTERMINATOR '\t' CREATE (p:person { id: line[0] }); The columns are separated using 0x9 (tab) characters. But the created nodes have the entire row content in the id. Any help is greatly appreciated. 回答1: try FIELDTERMINATOR '\\t' that's what worked for me 回答2: Try casting toint(line[0]) since the default type when importing is string.

How to get all parent nodes of a particular node based on ID

谁都会走 提交于 2020-04-07 08:03:12
问题 I want to fetch all 3rd level nodes(4,5,6 and 7 in below pic) and its relationships along with its parent node details In the below example: If I send ID : 7 then I should get node info of 3 and `1 If I send ID : 4 then I should get node info of 2 and `1 How can I get parent node details? Please help EDIT: I am trying query to get nodes, edges and immediate parent details. Nodes and edges I am getting but with parent I am getting big list of nodes. Not sure why Match (n)-[r]-() OPTIONAL MATCH