cypher

neo4j: What is the syntax to set cypher query parameters in the browser interface?

天大地大妈咪最大 提交于 2019-12-18 02:03:52
问题 I am trying to run queries from the neo4j browser to reproduce results from my neo4j-javascript-driver client. What is the syntax for defining query parameters in the neo4j b I recently attended a neo4j training session in NYC where the trainer (David Fauth) did this, unfortunately, I did not take notes on it, since I figured that I could read-up on this online...but no success. 回答1: In neo4j-browser you need type for example: :params {nodes: [{name: "John", age: 18}, {name: "Phill", age: 23}

neo4j LOAD CSV returns Couldn't Load external resource - neo4j lost in directory

血红的双手。 提交于 2019-12-17 20:24:47
问题 Since I use Neo4j 3.0.1, this cypher query: USING PERIODIC COMMIT 500 LOAD CSV WITH HEADERS FROM >"file:///home/user/Documents/links.csv" AS csvLine ... returns Couldn't load the external resource at: file:/home/user/Documents/neo4j-community-3.0.1/import/home/user/Documents/links.csv Neo4j is located on my machine (Ubuntu 14.04), in the "Documents" folder, as the "links.csv" file. (with a 2.xx version of neo4j this exact query was working perfectly) I don't undersand why neo4j3.0 try to

Multiple unrelated queries in Neo4j Cypher?

折月煮酒 提交于 2019-12-17 18:18:33
问题 Does http://localhost:7474/browser/ not support multiple unrelated queries? This code: MATCH (a {cond:'1'}), (b {cond:'x'}) CREATE a-[:rel]->b MATCH (a {cond:'2'}), (b {cond:'y'}) CREATE a-[:rel]->b MATCH (a {cond:'3'}), (b {cond:'z'}) CREATE a-[:rel]->b causes an error: WITH is required between CREATE and MATCH But since my queries aren't related, I don't think I shall need a WITH . How do I do the above without having to enter it one-line-at-a-time? 回答1: In recent releases developers added

Cypher Neo4J - CASE Expression with MERGE

天涯浪子 提交于 2019-12-17 12:20:10
问题 I'm trying to implement the logic in Cypher where, based on a particular condition ( CASE Statement), I would create some nodes and relationships; the code is as below MATCH (g:Game)-[:PLAYER]->(u:User)-[r1:AT]->(b1:Block)-[:NEXT]->(b2:Block) WHERE g.game_id='G222' and u.email_id = 'xyz@example.com' and b1.block_id='16' SET r1.status='Skipped', r1.enddate=20141225 WITH u, b2,b1, g, r1 SET b1.test = CASE b2.fork WHEN 'y' THEN MERGE (u)-[r2:STAGE {startdate:20141225, enddate:'99999999', status:

How to reset / clear / delete neo4j database?

╄→尐↘猪︶ㄣ 提交于 2019-12-17 09:16:09
问题 We can delete all nodes and relationships by following query. MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r But newly created node get internal id as ({last node internal id} + 1) . It doesn't reset to zero. How can we reset neo4j database such as newly created node will get id as 0? From 2.3, we can delete all nodes with relationships, MATCH (n) DETACH DELETE n 回答1: Shut down your Neo4j server, do a rm -rf data/graph.db and start up the server again. This procedure completely wipes your

Return node if relationship is not present

旧时模样 提交于 2019-12-17 05:45:10
问题 I'm trying to create a query using cypher that will "Find" missing ingredients that a chef might have, My graph is set up like so: (ingredient_value)-[:is_part_of]->(ingredient) (ingredient) would have a key/value of name="dye colors". (ingredient_value) could have a key/value of value="red" and "is part of" the (ingredient, name="dye colors") . (chef)-[:has_value]->(ingredient_value)<-[:requires_value]-(recipe)-[:requires_ingredient]->(ingredient) I'm using this query to get all the

Find Longest Path in Graph

让人想犯罪 __ 提交于 2019-12-14 03:43:54
问题 I have been trying hard to find out longest path in a complex network. I have been through many questions in StackOverflow and Internet, but none could help me. I have written a CQL as start n=node(*) match p = (n)-[:LinkTo*1..]->(m) with n,MAX(length(p)) as L match p = (n)-[:LinkTo*1..]->(m) where length(p) = L return p,L I don't get any solution. Neo4J would keep running for the answer, and I also tried executing it in Neo4J Cloud Hosting. I didn't any solution even there, but got an error

Use vars from before WITH statement in RETURN statement in Neo4j Cypher

廉价感情. 提交于 2019-12-14 02:55:45
问题 I'm starting with Neo4j (v2.1.5) and I'm having an issue with the following Cypher query: MATCH (actor:Person{name:"Tom Cruise"})-[role:ACTED_IN]->(movies)<-[r:ACTED_IN]-(coactors) WITH coactors, count(coactors) as TimesCoacted RETURN coactors.name, avg(TimesCoacted) ORDER BY avg(TimesCoacted) DESC It is based on the mini movie graph which comes with Neo4j installation. Everything works fine, it shows all coactors which coacted in movies with Tom Cruise and how many times they coacted

Neo4j - convert node attribute storage from string to number?

走远了吗. 提交于 2019-12-14 02:53:36
问题 I have a Neo4j database that was initially created from a Perl script using the Rest::Neo4p Perl module. For some unknown reason, one of the attributes on the nodes was created as a string, even though the values for said attribute on all of the nodes are numeric (verified through a Cypher regex search of that attribute). Is there an easy way to convert the attribute's storage type from string to a number short of recreating the database? Perhaps a Cypher query that would create a new

How make the relationship splitting the score of soccer in cypher

送分小仙女□ 提交于 2019-12-13 22:30:32
问题 In EPL match, the results between two teams is 2-6, so how to make the relationship and show that the high goals scored team won the match. Here is an attempt to load the CSV data. LOAD CSV WITH HEADERS FROM "file:///EPL_dataset_for_2018_19_assignment.csv" as row MERGE (team1:EPL_Teams{name:row.Team1}) MERGE (team2:EPL_Teams{name:row.Team2}) MERGE (round:Round{name:row.Round}) MERGE (date:Date{name:row.Date}) MERGE (score1:Scores{name:row.HT}) MERGE (score2:Scores{name:row.FT}) 回答1: You can