neo4j

How to create unique constraint involving multiple properties in Neo4J

瘦欲@ 提交于 2019-12-28 16:32:18
问题 I know I can create a unique constraint on a single property with Cypher like CREATE CONSTRAINT ON (p:Person) ASSERT p.name IS UNIQUE . But I was wondering whether it is possible to create a unique constraint which involves multiple properties. If so, how? 回答1: neo4j (2.0.1) does not currently support a uniqueness constraint that covers multiple properties simultaneously. However, I can think of a workaround that might be acceptable, depending on your use cases. Let's say you want properties

How to create unique constraint involving multiple properties in Neo4J

雨燕双飞 提交于 2019-12-28 16:32:07
问题 I know I can create a unique constraint on a single property with Cypher like CREATE CONSTRAINT ON (p:Person) ASSERT p.name IS UNIQUE . But I was wondering whether it is possible to create a unique constraint which involves multiple properties. If so, how? 回答1: neo4j (2.0.1) does not currently support a uniqueness constraint that covers multiple properties simultaneously. However, I can think of a workaround that might be acceptable, depending on your use cases. Let's say you want properties

Extract subgraph in neo4j

白昼怎懂夜的黑 提交于 2019-12-28 13:59:50
问题 I have a large network stored in Neo4j. Based on a particular root node, I want to extract a subgraph around that node and store it somewhere else. So, what I need is the set of nodes and edges that match my filter criteria. Afaik there is no out-of-the-box solution available. There is a graph matching component available, but it works only for perfect matches. The Neo4j API itself defines only graph traversal which I can use to define which nodes/edges should be visited: Traverser exp =

Lazy/Eager loading/fetching in Neo4j/Spring-Data

徘徊边缘 提交于 2019-12-28 12:28:13
问题 I have a simple setup and encountered a puzzling (at least for me) problem: I have three pojos which are related to each other: @NodeEntity public class Unit { @GraphId Long nodeId; @Indexed int type; String description; } @NodeEntity public class User { @GraphId Long nodeId; @RelatedTo(type="user", direction = Direction.INCOMING) @Fetch private Iterable<Worker> worker; @Fetch Unit currentUnit; String name; } @NodeEntity public class Worker { @GraphId Long nodeId; @Fetch User user; @Fetch

Lazy/Eager loading/fetching in Neo4j/Spring-Data

可紊 提交于 2019-12-28 12:28:12
问题 I have a simple setup and encountered a puzzling (at least for me) problem: I have three pojos which are related to each other: @NodeEntity public class Unit { @GraphId Long nodeId; @Indexed int type; String description; } @NodeEntity public class User { @GraphId Long nodeId; @RelatedTo(type="user", direction = Direction.INCOMING) @Fetch private Iterable<Worker> worker; @Fetch Unit currentUnit; String name; } @NodeEntity public class Worker { @GraphId Long nodeId; @Fetch User user; @Fetch

No qualifying bean of type 'java.lang.Class<org.springframework.data.repository.Repository<?, ?>>'

 ̄綄美尐妖づ 提交于 2019-12-25 18:41:18
问题 Application depends on a number of spring data projects including Neo4j, Solr and Jpa. I recently had to update spring-data-solr to Snapshot-3.0.0.M1 (to eliminate another dependency conflict). I think one of the transitive dependency is causing a conflict with neo4j. If I remove spring-neo4j from project, error (see below) seem to go away. I have a attached a sample project that recreates the issue. Run Test Class AccountServiceJpaTester.testSaveAccount() Download sample project from here

NeoClientPHP Issue when retrieving data from Neo4J

别说谁变了你拦得住时间么 提交于 2019-12-25 16:58:27
问题 Currently, I am still learning the Neo4J Graph Database and plan to migrate my current RDBMS into Graph Database. So I was searching the methodology of how to connect Neo4J in PHP/Codeigniter until i found out that Neoxygen-NeoClient was the answer. After I installed it using composer then i planning to test it. I created a new page called connection.php and placed in a root folder. Unfortunately right now i'm having some problem when to get data from Neo4J in my localhost and And below is

Neo4j List Consecutive

有些话、适合烂在心里 提交于 2019-12-25 16:46:54
问题 I am currently working with a football match data set and trying to get Cypher to return the teams with the most consecutive wins. At the moment I have a collect statement which creates a list i.e. [0,1,1,0,1,1,1] where '0' represents a loss and '1' represents a win. I am trying to return the team with the most consecutive wins. Here is what my code looks like at the moment: MATCH(t1:TEAM)-[p:PLAYS]->(t2:TEAM) WITH [t1,t2] AS teams, p AS matches ORDER BY matches.time ASC UNWIND teams AS team

JSON object parsing : multiple rows with multiple nodes in a REST API neo4j cypher response

北城余情 提交于 2019-12-25 16:39:54
问题 When playing around with JSON Neo4j response over REST API, i am trying to break my head to understand how to should i access a value returned, when my result is having one column and 2 rows . Each row in turn contains multiple nodes. the query (gives me a travel plan) : MATCH (a:LandMark {name:'Acharya College' }),(d:AirPort {name:'Frankfurt International Airport'}) MATCH p1 = allShortestPaths((a)-[:STOPS_AT*]-(d)) WITH p1, FILTER(j IN NODES(p1) WHERE(j in nodes(p1)) ) AS buses RETURN buses

How to create an index on a property of a relation

前提是你 提交于 2019-12-25 16:27:10
问题 I need a query to fetch all properties of a relation that are not empty, e.g. MATCH ()-[r:TYPE]-() WHERE r.attr <> "" RETURN r.attr I would guess that CREATE INDEX ON :TYPE(attr) creates an Index on a Node with the label TYPE and not on a relation property? Or is it not necessary to create an index on a relation property? I am using neo4j 2.2.3. 回答1: Indexes on relationships are only possible by using manual indexes. Bevor creating those I strongly recommend rethinking your graph model.