Category : neo4j

I have a list of dictionaries I have created in python. It looks like this: [{name: ‘Bob’}, {name: ‘Teresa’}, {name: ‘Bob’}, {name: ‘Teresa’}] Here’s my cypher query to take this list and merge into Neo4j that I’m expecting only 2 new nodes are created, Bob and Teresa nodes. WITH $batch AS batch UNWIND batch as ..

Read more

So I am trying to automate query input into Neo4j browser. Since the area where the text is written into is not an input field, rather in <span> tags as below: I would add in the the cypher command MATCH (n) RETURN n LIMIT 10 through python like this: driver.execute_script(‘return document.getElementsByClassName("view-line")[0].outerHTML='<div style="top:0px;height:23px;" class="view-line"><span><span class="mtk4">MATCH</span><span class="mtk15">&nbsp;</span><span ..

Read more

I’m running a pretty simple cypher query to get a mutual directed relation: MATCH (this {name: "me"})-[r1]->(channel)<-[r2]-(target) RETURN *. The thing is that the python driver won’t give me any of the attributes on relations, but if I specify them in the RETURN it works fine, e.g. RETURN r1.bananas. How can I get return * ..

Read more

I’m try to run gds.alpha.allShortestPaths.stream in a py2neo.Graph instance That is my code: cypherCode = """CALL gds.alpha.allShortestPaths.stream({ nodeQuery: ‘MATCH (n:AUTHOR) RETURN id(n) AS id’, relationshipQuery: ‘MATCH (n:AUTHOR)-[r:COAUTHORS]-(p:AUTHOR) RETURN id(n) AS source, id(p) AS target’ }) YIELD sourceNodeId, targetNodeId, distance return sourceNodeId, targetNodeId, distance """ r = graph.run(cypherCode) I’m using relationshipQuery: ‘MATCH (n:AUTHOR)-[r:COAUTHORS]-(p:AUTHOR) RETURN id(n) AS ..

Read more

I’m about to run a query in neo4j with a parameter, but it always returns me an error. > query= ("MATCH (p1:Item),(p2:Item) where p1.value=$name > RETURN p1.value AS from, p2.value AS to, > gds.alpha.similarity.euclideanDistance((p1.embeddingNode2vec), > (p2.embeddingNode2vec)) AS similarity order by similarity desc limit > 40", name=references[2]) the p1.value the first element in the references list. ..

Read more

I’m playing with py2neo and now the I’m looking for the most convenient manner to find all children of a specific node using recursion. What I’m looking for is the following idea: MATCH (:LabelA {id:"C"})-[:to*]->(m:LabelA) RETURN n; This is what it would look like in cypher. I know this query can be run with graph.run() ..

Read more

I want to develop a python script which perform the following: Load json UsersFile for User in UsersFile, create a node ## example of User {‘UserName’: ‘lolipop’, ‘UserId’: ‘544’, ‘groups’: [‘winners’, ‘losers’]} I tired something like, (but I getting errors): import json from neo4j import GraphDatabase uri = "neo4j://localhost:7687" driver = GraphDatabase.driver(uri, auth=("neo4j", "123")) UsersFile ..

Read more