spring-data-neo4j

Spring with Neo4j, GraphRepository<?> vs handmade interface

北城以北 提交于 2019-12-03 16:27:58
I found out that there is an interface called GraphRepository. I have a repository for users implementing a homemade interface that does its job, but I was wondering, shouldn't I implement GraphRepository instead ? Even if it will be quite long to implement and some methods will be useless, I think it is a standard and I already re-coded a lot of methods that are defined in this interface. So should I write "YAGNI" code or not respect the standard ? What is your advice ? you don't need to actually implement GraphRepository but extend it. the principals of Spring-Data is that all the boiler

Depth in custom Cypher queries with OGM always 0?

吃可爱长大的小学妹 提交于 2019-12-03 15:51:22
I'm currently evaluating OGM / Spring Data Neo4j for a use case and came upon the following problem: When executing a custom Cypher query either via Spring Data @Query annotation or directly via the Neo4j Session , the result contains only the nodes directly queried for and not the related nodes (relationships are null in the resulting node objects). I.e. the depth for these queries seems to be 0 and not 1, as I would have expected from the docs. How can I execute a custom Cypher query via OGM or Spring Data Neo4j that has depth 1? The default depth 1 refers to findOne/findAll/.. methods from

Integrating mongodb with neo4j, is there any API that will link them?

[亡魂溺海] 提交于 2019-12-03 08:51:37
问题 I am working on a recommendation engine. The user data is collected (Their friendship, locations, likes,education,...) and is already stored in mongodb. I need to recommend relevant products to these users. I am planning on using neo4j for the recommender engine for obvious reasons (ease of traversal between nodes, path information,..). The problem is that I have to first convert the mongodb data into neo4j nodes/relationships, process the data and send the results back to the mongodb

Effectively clear Neo4j database

情到浓时终转凉″ 提交于 2019-12-02 17:56:21
问题 This is my previous question Clear Neo4j Embedded database Right now I understand that I don't need to shutdown database, I only need to wipe all data inside of this database. I use the following method: public static void cleanDb(Neo4jTemplate template) { template.query("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r", null); } but it's not work properly on a large data sets. Also, with a new version of Spring Data Neo4j I can't use Neo4jHelper.cleanDb(db); Is any ways to correctly and

Join result set

左心房为你撑大大i 提交于 2019-12-02 16:31:30
问题 I want mutual count of my friends with friendship status. I have created nodes for each user and created relationship with properties between them. I have found my desired result as per following queries. In this test case my login userid=1, and I want to search those users which is started from letter 'dh'. so, my query is as follows. 1st Query : which is returned all users with specific given keyword. -------------------------------------------------------------------- START other=node(*)

Is it possible to override Neo4j lock behavior for relationships?

谁说我不能喝 提交于 2019-12-02 15:21:40
问题 See: http://neo4j.com/docs/stable/transactions-locking.html "When creating or deleting a relationship a write lock will be taken on the specific relationship and both its nodes" Suppose I need to create many relationships within a transaction. I don't care about locking on the nodes that are connected to those relationships. In particular, for other concurrent transactions: 1) Updating properties on those nodes does not interfere with my operation 2) Creating or removing other relationships

SDN BeforeSaveEvent<T> capture events before save entities != T

天大地大妈咪最大 提交于 2019-12-02 09:40:59
问题 Currently I've centralized the Id creation of each NodeEntity in a BeforeSave Application Event. Something like that: @Inject IdentifierFactory identifierFactory; @Bean ApplicationListener<BeforeSaveEvent> beforeSaveEventApplicationListener() { return new ApplicationListener<BeforeSaveEvent>() { @Override public void onApplicationEvent(BeforeSaveEvent event) { if (event.getEntity() instanceof IdentifiableEntity) { IdentifiableEntity entity = (IdentifiableEntity) event.getEntity(); if (entity

Spring data wth ne04j error…error while retrieving paths

99封情书 提交于 2019-12-02 09:12:37
问题 I was using spring data with neo4j. I used @Query annotation to place the query in the repository, the query was as follows @Query(value = "START me=node({0}), friend=node({1}) " + "MATCH p=shortestPath(me-[:ACTIVEFRIEND*..]->friend)" + " RETURN p") public Iterable<EntityPath<User, User>> getShortestPathBetween(User a, User b); In the controller I am accessing it as Iterable<EntityPath<User, User>> shortestPathBetween = this.queryService.getShortestPathBetween(user, friend); for (EntityPath

Grails @Autowire in Java class not working

廉价感情. 提交于 2019-12-02 07:42:38
I have some Java code that I want to turn into a Bean that can be used within Grails controllers & services via dependency injection. The code is based on that here (which works fine when run as a standalone Java application). Specifically, I have: // WannabeABeanDB.java package hello; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.Transaction; import org.neo4j.graphdb.factory.GraphDatabaseFactory; import org.neo4j.kernel.impl.util.FileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org

SDN 4 - InProcessServer broken in snapshot build

你离开我真会死。 提交于 2019-12-02 07:13:44
问题 Since about a week ago, running tests with InProcessServer on 4.0.0.BUILD-SNAPSHOT results in the following exception: Caused by: java.lang.NoClassDefFoundError: org/neo4j/ogm/testutil/TestServer at org.springframework.data.neo4j.server.InProcessServer.<init>(InProcessServer.java:25) ~[spring-data-neo4j-4.0.0.BUILD-SNAPSHOT-tests.jar:na] at com.ninjasquare.server.test.integration.IntegrationTestConfig.neo4jServer(IntegrationTestConfig.java:43) ~[test-classes/:na] Swithing the test dependency