neo4j

Neo4j Cypher Get Relationship Direction

最后都变了- 提交于 2020-01-03 15:35:43
问题 I have following cypher query which returns all (in and out) relationships of an specific node: START s=node(1) MATCH s<-[r]->(t) RETURN type(r) as RelationshipType, ....... Now I want to find out the direction of each relationship. Is there an command like " RETURN RelationshipDirection(r) " ?? :) Thanks. 回答1: Per neo4j 2.0, you can use startnode(r) See http://docs.neo4j.org/chunked/snapshot/query-functions-scalar.html#functions-startnode STARTNODE returns the starting node of a relationship

neo4j merge 2 or multiple duplicate nodes

主宰稳场 提交于 2020-01-03 10:24:17
问题 I am feeding my neo4j db manually using cypher, so prone to error like creating duplicate nodes: The duplicate nodes will have each relationships to other nodes. Is there a built-in function to merge these nodes? Or should I do it manually? Sounds possible, but complicated with cypher script: Get the relationships of each duplicate node Recreate them (with their properties) with the correct node (given node id) Remove relationships to the duplicate nodes and finally remove the duplicate nodes

Do having multiple labels for a node in Neo4j make any sense?

旧城冷巷雨未停 提交于 2020-01-03 09:44:08
问题 Following this post from Neo4j's google group I have to say that I don't see any benefits when using this multiple-label-thing but rather, on the contrary, IMHO it just adds complexity for what a uniqueness constraint is. It could also tempt the user to introduce inheritance into the data model which would cause frustration since that's not possible at all... 回答1: Labels have not the notion of just representing a type, they are rather roles which are viable in different contexts. So in one

how to disable log in spring data neo4j

不问归期 提交于 2020-01-03 09:06:13
问题 I am getting unwanted query log from spring neo4j like following 25-08-2018 23:47:07.597 [restartedMain] INFO o.n.o.d.bolt.request.BoltRequest.executeRequest - Request: MATCH (n:`OntoCategory`) WHERE n.`name` = { `name_0` } WITH n RETURN n,[ [ (n)-[r_h1:`HasSynonym`]->(o1:`OntoSynonyms`) | [ r_h1, o1 ] ] ], ID(n) with params {name_0=Breakfast Items} 25-08-2018 23:47:07.610 [restartedMain] INFO o.n.o.d.bolt.request.BoltRequest.executeRequest - I am using following logging properties in my

Can I create a node in neo4j with specified id?

我们两清 提交于 2020-01-03 08:28:08
问题 I want to hold relationships in neo4j but (maybe, I've not decided yet) to keep the objects in different DB (sort of Redis). And if to do so, it would be good to sync IDs in storage db and in neo4j. So, can I create a node in neo4j passing the ID to it? PS project in PHP and accessing neo4j via REST API. 回答1: You normally can't, only if you use the BatchImporter, http://docs.neo4j.org/chunked/snapshot/indexing-batchinsert.html, you can specify the IDs to use. 回答2: Otherwise it is sensible to

should everything connect with node 0 in neo4j

此生再无相见时 提交于 2020-01-03 07:25:09
问题 In neo4j should all nodes connect to node 0 so that you can create a traversal that spans across all objects? Is that a performance problem when you get to large datasets? If so, how many nodes is too much? Is it ok not to have nodes connect to node 0 if I don't see a use case for it now, assuming I use indexes for finding specific nodes? 回答1: There is no need or requirement to connect everything to the root node. Indexes work great in finding starting points for your traversal. If you have

Custom repository implementation for Neo4j doesn't work

邮差的信 提交于 2020-01-03 05:52:06
问题 This is similar to what is discussed at Unable to use two Neo4j Instances with Spring boot/Spring data neo4j but I don't have two databases. I have downloaded the spring-data neo4j sample java application from the git repo and want to execute a dynamic query instead of executing a static query via repository interface. I am facing an issue of null transaction manager. Here's my interface : public interface SearchRepositoryCustom { Iterable<Movie> searchByCriteria(); } Here's my custom repo

Neo4j: Split string and get position

六月ゝ 毕业季﹏ 提交于 2020-01-03 05:23:22
问题 I need to split a field in different values and store each value in a different node. For each created node I want to store the position. Example: Sentence Words My car is red My;car;is;red Using: FOREACH (w IN SPLIT(line.TWords, ";") | MERGE (wd:Word {word: w}) I can split the field and store the different words, but I'd like to store the position on the relationship. My car is red -[HAS_WORD {position:1}]-> My My car is red -[HAS_WORD {position:2}]-> car My car is red -[HAS_WORD {position:3

Errors of the Cineasts examples of Spring data neo4j

独自空忆成欢 提交于 2020-01-03 05:07:09
问题 I imported the cineast maven project to eclipse, but I face a configuration problem... cvc-complex-type.4: Attribute 'base-package' must appear on element 'neo4j:config' Below are the configuration files which have this error. ApplicationContext.xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:neo4j="http

Errors of the Cineasts examples of Spring data neo4j

亡梦爱人 提交于 2020-01-03 05:07:04
问题 I imported the cineast maven project to eclipse, but I face a configuration problem... cvc-complex-type.4: Attribute 'base-package' must appear on element 'neo4j:config' Below are the configuration files which have this error. ApplicationContext.xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:neo4j="http