cypher

Check whether nodes exist in a neo4j graph

戏子无情 提交于 2019-12-22 13:32:33
问题 NOTE I let this become several questions instead of the simple one I asked, so I am breaking the follow-ups off into their own question here. ORIGINAL QUESTION I'm receiving a list of IDs that I am first testing whether any of them are in my graph, and if they /are/ I am processing those nodes further. So, for example... fids = get_fids(record) # [100001, 100002, 100003, ... etc] ids_in_my_graph = filter(id_is_in_graph, fids) # [100002] def id_is_in_graph(id): val = False query = """MATCH

Check whether nodes exist in a neo4j graph

♀尐吖头ヾ 提交于 2019-12-22 13:31:31
问题 NOTE I let this become several questions instead of the simple one I asked, so I am breaking the follow-ups off into their own question here. ORIGINAL QUESTION I'm receiving a list of IDs that I am first testing whether any of them are in my graph, and if they /are/ I am processing those nodes further. So, for example... fids = get_fids(record) # [100001, 100002, 100003, ... etc] ids_in_my_graph = filter(id_is_in_graph, fids) # [100002] def id_is_in_graph(id): val = False query = """MATCH

unable to delete node labels in neo4j

梦想的初衷 提交于 2019-12-22 13:06:52
问题 I have created 2 labels Person,Movies by : CREATE (ee:Person { name: "test", id: "1" }) CREATE (m:Movie { name: "movie_1", id: "2" }) When I Run : START n=node(*) OPTIONAL MATCH (n)-[r]-() DELETE n,r; But The Label still exists. How can I delete the label? 回答1: So, you don't actually delete labels you remove them (e.g. remove m:Movie). delete is used to remove nodes and/or relationships from the database. The following cypher example will match your movie node, remove the existing label, add

“Injection” concerns for Cypher over REST

时间秒杀一切 提交于 2019-12-22 12:27:33
问题 I was wondering if there is a concern for query injection when I query over REST? Parameterizing the query definitely makes things more cleaner but I was also able to query with string concatenation to manipulate properties and labels. I find the latter approach being more flexible because at times I can't query the way I want it following the paradigm of parameters. (Can I parameterize labels and properties on CREATE or SET? (REST and transaction)) If there is no worries of some sort of

Run Cypher for Apache Spark examples (CAPS)

早过忘川 提交于 2019-12-22 11:22:40
问题 I know that this a wide question, but it would be helpful for neo4j users those who aren't in a field of scala programming. I am in need to use Cypher for Apache Spark Project in order to create a Neo4j graph from a data-frame and then storing it into Neo4j. I tried to integrate the project in eclipse, but with no luck , i get a wired error, so i couldn't get the help of an IDE. What i need is a way to run the Scala example classes of this maven project ?? In another scala maven project a

ConstraintViolationTransactionFailureException when deleting all nodes from Neo4j

倾然丶 夕夏残阳落幕 提交于 2019-12-22 10:33:49
问题 When attempting to delete all nodes from my Neo4j graph database, which I have successfully done many times in the past on smaller datasets, I consistently ran across Error: undefined - undefined after running this query MATCH (n) DETACH DELETE n I figured the number of nodes I was attempting to delete at once may be too large (>100000), so I then tried this query MATCH (n) OPTIONAL MATCH (n)-[r]-() WITH n,r LIMIT 10000 DELETE n,r and many variations of it, acting on mostly what I read in

How to translate SQL queries to cypher in the optimal way?

戏子无情 提交于 2019-12-22 09:36:49
问题 I am new in neo4j using version 3.0. I have a huge transactional dataset that I converted to a graph model. I need to translate the below SQL query into cypher. create table calc_base as select a.ticket_id ticket_id, b.product_id, b.product_desc, a.promotion_flag promo_flag, sum(quantity) sum_units, sum(sales) sum_sales from fact a inner join dimproduct b on a.product_id = b.product_id where store_id in (select store_id from dimstore) and b.product_id in (select product_id from fact group by

How to translate SQL queries to cypher in the optimal way?

血红的双手。 提交于 2019-12-22 09:32:02
问题 I am new in neo4j using version 3.0. I have a huge transactional dataset that I converted to a graph model. I need to translate the below SQL query into cypher. create table calc_base as select a.ticket_id ticket_id, b.product_id, b.product_desc, a.promotion_flag promo_flag, sum(quantity) sum_units, sum(sales) sum_sales from fact a inner join dimproduct b on a.product_id = b.product_id where store_id in (select store_id from dimstore) and b.product_id in (select product_id from fact group by

Cypher SORT performance

偶尔善良 提交于 2019-12-22 08:32:14
问题 I'm trying to accomplish a pretty common task. I have a substantial dataset in a Neo4J database and, from a RESTful web service, i want to return the data in chunks of 25 nodes. My model is quite simple: (:Tenant {Hash:''})-[:owns]->(:Asset {Hash:'', Name:''}) I have unique constraints on the Hash properties on both labels. If i wanted to obtain the 101th data page, my cypher query would look like this: MATCH (:Tenant {Hash:'foo'})-[:owns]->(a:Asset) RETURN a ORDER BY a.Hash SKIP 2500 LIMIT

Passing optional parameters to @Query of a Spring Data Repository method

早过忘川 提交于 2019-12-22 07:47:06
问题 I work with Spring Data and Neo4j in my current project and have the following situation: @RestController @RequestMapping(value = SearchResource.URI) public class PersonResource { public static final String URI = "/person"; @Autowired PersonRepository personRepository; @GetMapping public Collection<Person> findPersons( @RequestParam(value = "name", required = false) String name, @RequestParam(value = "birthDate", required = false) Long birthDate, @RequestParam(value = "town", required = false