cypher

How to specify relationship type in CSV?

耗尽温柔 提交于 2019-12-20 03:23:13
问题 I have a CSV file with data like: ID,Name,Role,Project 1,James,Owner,TST 2,Ed,Assistant,TST 3,Jack,Manager,TST and want to create people whose relationships to the project are therein specified. I attempted to do it like this: load csv from 'file:/../x.csv' as line match (p:Project {code: line[3]}) create (n:Individual {name: line[1]})-[r:line[2]]->(p); but it barfs with: Invalid input '[': expected an identifier character, whitespace, '|', a length specification, a property map or ']' (line

Query case-specific nodes in neo4j

我与影子孤独终老i 提交于 2019-12-20 03:17:25
问题 I have a setup like the attached image. Orange nodes denotes the cases and the Blue nodes denotes the Performers of various activities within that case. I would like to query each case in turn. Within each case, I need to add relationship [:RELATED {value: 1}] from node i to node k , for all k that lies in between(nodes whose ID fall between i and j) those pair of Performer nodes ( node i , node j ) such that : Name(node i ) == Name( node j ) and | ID(node i ) - ID(node j ) | >= 2 [Example

Full text search in Neo4j with spaces

穿精又带淫゛_ 提交于 2019-12-20 02:42:29
问题 When the neo4j lucene auto index is in exact mode (which is the default) queries of the type: start n=node:node_auto_index('name:asfd\\ a*') return n Work correctly (assuming you have a node with the name asdf adsf for instance. However when switching the index to "fulltext" mode following these instructions (including deleting the index and reassigning the indexed property), then the same query doesn't return any results. Original Question Trying to search neo4j via the full text index when

Neo4j cypher query : using ORDER BY with COLLECT(S)

匆匆过客 提交于 2019-12-20 02:32:41
问题 I'm having a hard time collecting data from two distinct sources and merge the collections so that the final one is a set of objects ordered by 'dateCreated'. Context Users can ask questions in groups. A question can be either general or related to a specific video-game. If the question asked in a group is video-game related, this question also appears in the video-game's questions page. Currently, I have two general questions and one specific to one video-game. Hence, when fetching the

Cypher query to find nodes that have 3 relationships

我只是一个虾纸丫 提交于 2019-12-20 02:17:09
问题 I figured out how to write this query when I am looking for 2 relationships, but not sure how to add more relationships to the query. Assume you have a book club database with 'reader' and 'book' as nodes. The 'book' nodes have a 'genre' attribute (to define that the book is a Fiction, Non-Fiction, Biography, Reference, etc.) There is a Relationship "HasRead" between 'reader' nodes and 'book' nodes where someone has read a particular book. If I want to find readers that have read both Fiction

Cypher: Use WHERE clause or MATCH property definition for exact match?

你。 提交于 2019-12-19 19:43:18
问题 In Neo4j (version 3.0), the following queries return the same results: 1. MATCH (a:Label) WHERE a.property = "Something" RETURN a 2. MATCH (a:Label {property: "Something"}) RETURN a While playing with some large datasets, I noticed (and verified using EXPLAIN and PROFILE ) that for some instances, queries like the second one performs better and faster. While other instances exist where both versions performed equally, I didn't yet see one where the first version performed better. The neo4j

Cypher MATCH query speed

非 Y 不嫁゛ 提交于 2019-12-19 10:23:59
问题 I have Neo4j installed on a windows machine with 12 processors and 64GB ram. I did not change any of the memory settings that Neo4j allows for. My database has 3.8m nodes, 210,000 of which are labeled as Geotagged and a total of 650,000 relationships. I am trying to run the following query and I am wondering if this is a really intensive query that will likely take quite a while. Messages.csv is my relationship file. The relationships have already been created, but as I could not figure out

SET label based on data within LOAD CSV

爷,独闯天下 提交于 2019-12-19 09:59:15
问题 I'm using Neo4j 2.2.0 and importing data (in the form of a nodes file and relationships file) via LOAD CSV. The nodes will all be imported under the "Person" label, however I want to add the "Geotag" label to some of them if their latitude and longitude fields in the nodes file are being empty. So, for example, the below nodes file (ignore the extra line in between rows) "username","id","latitude","longitude" "abc123","111111111","33.223","33.223" "abc456","222222222","","" I would like to

Cypher zip collections

纵饮孤独 提交于 2019-12-19 09:53:48
问题 If I have two collections, how might I zip them together? with [1,2,3] as nums, ['a', 'b', 'c'] as letters ... wat do? ... return zipped // [{a: 1}, {b: 2}, {c: 3}] 回答1: It may not be possible to dynamically assign map keys (e.g., using the items in letters ). But this query will return something similar to what you want (using collections instead of maps): WITH [1,2,3] as nums, ['a', 'b', 'c'] as letters RETURN EXTRACT(i IN RANGE(0, LENGTH(nums) - 1) | [letters[i], nums[i]]) AS result; The

Neo4j Cypher - String to Integer

两盒软妹~` 提交于 2019-12-19 08:55:05
问题 Here the value in property r.weight is a string. i have tried following possibilities to convert it into a integer, INT(r.weight) Integer.parseInt(r.weight) convert(INT,r.weight) but nothing works. Is there a proper function to do so? reduce(total = 0, r in relationships(p): total + INT(r.weight)) Note : Its not a possible duplicate of Gremlin type conversion Version : 1.9.5 回答1: As stated in the comments above there is no easy way to do this with Cypher in 1.9.x. As a workaround you could