neo4j

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

Should we use the Neo4J internal id?

守給你的承諾、 提交于 2019-12-17 17:09:42
问题 We are currently working with a Neo4j database, and we need some kind of id to identify nodes. For example we have functions like CurrentUserHasAccess(NodeId) On other Stackoverflow posts I read that it's a bad idea to use the internal neo4j-identifier, because it can change over time. However I think that's not an issue when we do not use this id to link data. However I cannot seem to find any official sources about this topic. I would like to use this ID because then we do not need to worry

Is there a equivalent to commit in bulbs framework for neo4j

安稳与你 提交于 2019-12-17 16:52:29
问题 I am building a data-intensive Python application based on neo4j and for performance reasons I need to create/recover several nodes and relations during each transaction. Is there an equivalent of SQLAlchemy session.commit() statement in bulbs? Edit: for those interested, an interface to the Bulbs have been developped that implements that function natively and otherwise functions pretty much just like SQLAlchemy: https://github.com/chefjerome/graphalchemy 回答1: The most performant way to

Can Neo4j store a dictionary in a node?

心已入冬 提交于 2019-12-17 13:23:37
问题 I an working on c# and use neo4jclient. I know neo4jclient can create a node if I pass a class object to it (I have tried it) Now in my class I want to add a dictionary property, this doesn't work. My code: GraphClient client = getConnection(); client.Cypher .Merge("(user:User { uniqueIdInItsApp: {id} , appId: {appId} })") .OnCreate() .Set("user = {newUser}") .WithParams(new { id = user.uniqueIdInItsApp, appId = user.appId, newUser = user }) .ExecuteWithoutResults(); The User contains a

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:

Neo4j Spatial 'WithinDistance' Cypher query returns empty while REST call returns data

回眸只為那壹抹淺笑 提交于 2019-12-17 09:49:49
问题 I have what appears to be a correctly configured spatial layer and index and can successfully query a node using findGeometriesWithinDistance REST API call. POST /db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance {"layer":"geom","pointX":15.0,"pointY":60.0,"distanceInKm":100.0} However, when querying using cypher, I get no results (I have tried reversing the order of 60.0 and 15.0 without luck): START n=node:geom('withinDistance:[60.0, 15.0, 500.0]') return n; Cyper returns: ==>

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

Avoid duplicate entires when Inserting Excel or CSV-like entries into a neo4j graph

只谈情不闲聊 提交于 2019-12-14 03:05:59
问题 I have the following .xslx file: My software regardless tis language will return the following graph: My software iterates line by line and on each line iteration executes the following query MERGE (A:POINT {x:{xa},y:{ya}}) MERGE (B:POINT {x:{xb},y:{yb}}) MERGE (C:POINT {x:{xc},y:{yc}}) MERGE (A)-[:LINKS]->(B)-[:LINKS]->(C) MERGE (C)-[:LINKS]->(A) Will this avoid by inserting duplicate entries? 回答1: According to this question, yes it will avoid writing duplicate entries. The query above will