spring-data-neo4j-4

Creating a node in neo4j with one unique property other than ID

人盡茶涼 提交于 2019-12-10 18:54:31
问题 My Project is based on Spring boot + Neo4j . I am trying to create a new Privilege node , but don't want to duplicate Privilege. Now I have a UserRole node which is holds List<Privilege> . Now I want that when I create a Privilege , it check first is another Privilege exists with same privilegeName property. Below are my domain classes. UserRole Class @NodeEntity public class UserRole { public UserRole(User user, Role role) { this.user = user; this.role = role; } /** For Jackson Parsing **/

Add relation to another node in SDN4 + REST

三世轮回 提交于 2019-12-10 13:56:22
问题 I have built a simple SDN4 + REST API: One endpoint, named player, which contains a set of properties. Each player has a Set<Player> friends property. GET, POST, PUT, DELETE and PATCH are working like charm on /player/{id} The problem here is /player/{id}/friends. I don't find out how to add a friend to a player, here is what I've tried so far: Before the Test: curl http://localhost:8080/api/player/1/friends : { } The Test curl -i -X PATCH -H "Content-Type:application/json" -d '{"id":1, "name

Clear Neo4j Embedded database

北慕城南 提交于 2019-12-10 11:14:23
问题 With a new version of Spring Data Neo4j I can't use Neo4jHelper.cleanDb(db); So, what is the most effective way to completly clear Embedded Neo4j database in my application? I have implemented my own util method for this purpose, but this method is slow: public static void cleanDb(Neo4jTemplate template) { template.query("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r", null); } How to properly clear/delete database ? UPDATED This is the similar question How to reset / clear / delete neo4j

Load an object in Neo4j OGM 1.1.3 ogm depth of 2 very slow

柔情痞子 提交于 2019-12-08 21:57:28
问题 I get a timeout while querying for depth 2 using session.load() .I'm working with Neo4j OGM 1.1.3 (Attempting to migrate from Spring Data Neo4j 3.4). Trying to load a Node object class Node { Long id; String name; @Relationship(type="NodeToCategory") Category category; @Realtionship(type="NodeToChildNode") Node node } class Category { Long id; String name; String color; Date createdAt; } The category that is connected to my node is very popular (20,000 nodes have the same category) and when I

Spring boot integration test fails with Neo4j

懵懂的女人 提交于 2019-12-08 19:54:30
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.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest

Spring Data Neo4j 4 - How to implement Composite Attribute at Class?

五迷三道 提交于 2019-12-08 06:09:07
问题 I am looking for Composite Attribute example but can not find it everywhere. I have simple class : @NodeEntity public class MyClass{ @GraphId Long id; Double diameter; //Property diameter should be from composite attribute (inDiameter and outDiameter) } MyClass have property diameter, it should be value from inDiameter or outDiameter (can use both as value with some condition) And I have the other class like this: @NodeEntity public class MyClass2{ @GraphId Long id; String name; //Property

Clear Neo4j Embedded database

我与影子孤独终老i 提交于 2019-12-06 07:01:38
With a new version of Spring Data Neo4j I can't use Neo4jHelper.cleanDb(db); So, what is the most effective way to completly clear Embedded Neo4j database in my application? I have implemented my own util method for this purpose, but this method is slow: public static void cleanDb(Neo4jTemplate template) { template.query("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r", null); } How to properly clear/delete database ? UPDATED This is the similar question How to reset / clear / delete neo4j database? but I don't know how to programmatically shutdown Embedded Neo4j and how to start it after

Is it possible to dynamically construct a neo4j cypher query using the GraphRepository pattern

半世苍凉 提交于 2019-12-06 02:12:01
问题 CONTEXT : I am developing a java Spring Boot system backed by a neo4j database. I access the database using the "ClassRepo extends GraphRepository" structure. Writing queries is a simple case of hard coding in my precise query and replacing a specified part of it with a supplied parameter (in this case courseName). @Query("MATCH (node:Course) WHERE node.name = {courseName} RETURN node LIMIT 1") Course findByName(@Param("courseName") String name); This has all worked fine for me, allowing me

Neo4j 3.0 and spring data

可紊 提交于 2019-12-05 19:45:08
I would like to use the new bolt protocol to connect my spring application to neo4j 3.0 database. Is bolt protocol already implemented in spring data? Yes, these versions support Bolt: Neo4j OGM 2.0.2, which can be used with SDN 4.1.1.RELEASE (you will need to explicitly include this Neo4j OGM version). Or the current SDN snapshot 4.2.0.BUILD-SNAPSHOT which depends on the latest Neo4j OGM snapshot. The Bolt Driver dependency is also required: <dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j-ogm-bolt-driver</artifactId> <version>2.0.2</version> </dependency> Configuration for the

spring-boot upgrade from 1.3.2 to 1.3.3: logback issue

别来无恙 提交于 2019-12-04 23:54:22
We've hit an issue when upgrading from spring-boot 1.3.2 to the recently released 1.3.3. Our application has been making use of the following dependencies, each the latest, without issue: <neo4j.version>2.3.2</neo4j.version> <sdn.version>4.0.0.RELEASE</sdn.version> <sdn.rest.version>3.4.0.RELEASE</sdn.rest.version> <neo4j.ogm.version>1.1.5</neo4j.ogm.version> Today I upgraded our spring-boot and Spring Data Neo4j -based application, which starts and works well with spring-boot 1.3.2.RELEASE, by changing the pom.xml from: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring