spring-data-neo4j-4

Neo4j SDN4 entity inheritance and indexes

纵饮孤独 提交于 2019-12-25 01:35:30
问题 I have a following Cypher query: PROFILE MATCH (childD:Decision) WITH childD ORDER BY childD.createDate DESC SKIP 0 LIMIT 10 MATCH (childD:Decision)-[ru:CREATED_BY]->(u:User) OPTIONAL MATCH (childD:Decision)-[rup:UPDATED_BY]->(up:User) RETURN ru, u, rup, up, childD AS decision, [ (childD)-[rdt:BELONGS_TO]->(t:Tag) | t ] AS tags Right now on my Neo4j database (~23k Decision nodes) this query works ~50 ms and I don't understand or it uses index on childD.createDate field. This is PROFILE output

Creating Relationships in Neo4J using Spring-Data

落爺英雄遲暮 提交于 2019-12-24 14:09:48
问题 I want to create a relationship in neo4j where a Person has a list of friends. I can do this in two ways using spring-data. a) Create a class Person with a List repesenting friends and annotate the same with @Relationship. @NodeEntity(label="Person") public class Person { @GraphId private Long id; private String firstName; private String lastName; private String email; @Relationship(type = "FRIEND_WITH") List<Person> friends; } b) Create the Person object without any List and create the

Neo4j: Native Java API(or equivalent cypher query) in Spring Data Neo4j

感情迁移 提交于 2019-12-24 11:35:19
问题 I was experimenting with Neo4j embedded-db in the past few days for a DEMO and was thoroughly impressed with the Native Java API's for indexing, lucene queries and even managed to do fuzzy search. I then decided to take this POC to production with Spring Data Neo4j 4.0 but ran into issues with Cypher queries and fuzzy search. My domain class "Team" looks like this: @NodeEntity public class Team { @GraphId Long nodeId; /** The team name. */ @Indexed(indexType = IndexType.FULLTEXT,indexName =

SDN 4 : How to cause SDN 4 to use MERGE rather than CREATE

試著忘記壹切 提交于 2019-12-24 03:50:07
问题 Prior to migrating my project to SDN 4, I used my own custom REST client code which generated Cypher statements of the form: MERGE (n:LABEL1:LABEL2 {prop1:"val"...}) ON CREATE SET ... ON MATCH SET ... This had the desired effect of creating nodes which needed to be created, and updating existing nodes where necessary. However, using .save(...) on the SDN 4 Neo4jTemplate, only CREATE Cypher statements appear to be generated, resulting in duplicate nodes, where what is desired is new nodes are

Spring Data Neo4j 4returning cached results?

丶灬走出姿态 提交于 2019-12-24 00:03:43
问题 I'm not sure if this is a Neo4j question or a Spring Data question. I'm fairly new to Neo4j, so I just want to make sure I'm doing things right. I'm using spring-data-neo4j:4.0.0.RELEASE with a neo4j-community-2.3.1 DB instance. The situation is that I am getting more nodes that I'm expecting back from DB queries. If I create a graph consisting of 3 different types of nodes: (NodeA)-[:NodeAIncludesNodeB]->(NodeB)-[:NodeBIncludesNodeC]->(NodeC) and then I run a query to get a single NodeA node

Spring OAuth 2 + Spring Data Neo4j multi-tenancy

不问归期 提交于 2019-12-23 17:51:23
问题 I'm going to implement multi-tenancy support in my Spring OAuth 2 + Spring Data Neo4j project. I have configure my OAuth2 Authorization Server with a few different clients with a different clientId . Also, I have added a base TenantEntity to my Spring Data Neo4j models: @NodeEntity public abstract class TenantEntity extends BaseEntity { private String tenantId; public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } } All of my

Neo4j OGM how to delete relationship

南笙酒味 提交于 2019-12-23 05:41:15
问题 I have two neo4j-OGM node entities connected with property-less relationship like so: @NodeEntity public class User { @Relationship(type = RelationshipNames.USER_DEVICES, direction = Relationship.UNDIRECTED) private Set<Device> devices; } @NodeEntity public class Device { @Relationship(type = RelationshipNames.USER_DEVICES, direction = Relationship.UNDIRECTED) private User user; } When I add a device to a user and then perform save, i get this graph: Later on, when i both remove the device

Neo4j OGM how to delete relationship

本秂侑毒 提交于 2019-12-23 05:41:15
问题 I have two neo4j-OGM node entities connected with property-less relationship like so: @NodeEntity public class User { @Relationship(type = RelationshipNames.USER_DEVICES, direction = Relationship.UNDIRECTED) private Set<Device> devices; } @NodeEntity public class Device { @Relationship(type = RelationshipNames.USER_DEVICES, direction = Relationship.UNDIRECTED) private User user; } When I add a device to a user and then perform save, i get this graph: Later on, when i both remove the device

SDN4/OGM Cypher query and duplicates at Result

和自甴很熟 提交于 2019-12-23 03:24:07
问题 I have a following Cypher query: MATCH (parentD)-[:CONTAINS]->(childD:Decision) WHERE parentD.id = 1 OPTIONAL MATCH (childD)-[sortValue1:HAS_VALUE_ON]->(sortCharacteristic1:Characteristic) WHERE sortCharacteristic1.id = 1 WITH * MATCH (childD)-[ru:CREATED_BY]->(u:User) OPTIONAL MATCH (childD)-[rup:UPDATED_BY]->(up:User) WITH ru, u, rup, up, childD , sortValue1 ORDER BY sortValue1.value ASC SKIP 0 LIMIT 100 RETURN ru, u, rup, up, childD AS decision, [ (parentD)<-[:DEFINED_BY]-(entity)<-[

Spring boot integration test fails with Neo4j

安稳与你 提交于 2019-12-23 02:19:21
问题 I am new to spring boot. I use Spring Boot 1.5.1 GA and Neo4j starter of spring boot. I tried to create my very first integration test to whether I can insert a new object into the graph database. Here is my test class: package hu.bookandwalk; import static org.junit.Assert.assertEquals; import java.time.LocalDateTime; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.neo4j.ogm.testutil.TestServer; import org