neo4j

Graph Modeling boolean value - relationship property, or node property or none at all?

泪湿孤枕 提交于 2020-07-10 08:41:10
问题 Context A business has many Partners. Each partner could offer multiple Services to their customers. Some Partners offer All Services, some offer a few. The business can always sell a Product to that Partner, and which Product can be sold depends on whether the Partner offers a particular Service or not. So business could sell Product A to Partner A offering Service A. They could offer Product B to Partner A if they don't offer Service B. Question - if Partners, Products, Services are nodes,

Py2Neo not creating Datetime data type correctly?

淺唱寂寞╮ 提交于 2020-07-09 19:18:26
问题 I trying build out some functions to populate my new Neo4j graph and I am having a hard time getting dates to populate as the correct data type in Neo4j using Py2Neo v4 and Neo4j 3.4.7. According to the Neo4j docummention there are Datetime data types... and spatial points which I want to get too as well I can not for the life of me find any documentation in Py2Neo for using either spatial points or temporal points. I found that there was back in v2 of Py2Neo a plugin for these data types but

Py2Neo not creating Datetime data type correctly?

試著忘記壹切 提交于 2020-07-09 19:18:25
问题 I trying build out some functions to populate my new Neo4j graph and I am having a hard time getting dates to populate as the correct data type in Neo4j using Py2Neo v4 and Neo4j 3.4.7. According to the Neo4j docummention there are Datetime data types... and spatial points which I want to get too as well I can not for the life of me find any documentation in Py2Neo for using either spatial points or temporal points. I found that there was back in v2 of Py2Neo a plugin for these data types but

Extract subgraph from Neo4j graph with Cypher

谁说我不能喝 提交于 2020-07-07 11:42:25
问题 Suppose I have a collection of 5 nodes in Neo4j, such that each node in the collection is connected to at least one other node in the collection. I want to extract the subgraph formed by the collection of nodes and their interactions from Neo4j. Currently, I'm using a really primitive method that involves attempting to find a match from each node in the system to every other node: MATCH p=(n)-[]->(m) WHERE id(n) IN [3,4,5,6,7] AND id(m) IN [3,4,5,6,7] RETURN relationships(p); However, this

Extract subgraph from Neo4j graph with Cypher

送分小仙女□ 提交于 2020-07-07 11:42:09
问题 Suppose I have a collection of 5 nodes in Neo4j, such that each node in the collection is connected to at least one other node in the collection. I want to extract the subgraph formed by the collection of nodes and their interactions from Neo4j. Currently, I'm using a really primitive method that involves attempting to find a match from each node in the system to every other node: MATCH p=(n)-[]->(m) WHERE id(n) IN [3,4,5,6,7] AND id(m) IN [3,4,5,6,7] RETURN relationships(p); However, this

Py2Neo Issue with Batch Transactions - AttributeError: 'Node' object has no attribute 'upper'

徘徊边缘 提交于 2020-06-29 07:05:22
问题 Following asking a previous question, I've tried to use batch transactions with Py2Neo to speed things up. I've adapted my code quite a bit, but seem unable to build and execute a batch of transactions. The matching works fine, it's only the transaction piece at the bottom which I'm having issues with - I thought I would include my entire code, just in case though. The current error I'm getting is as follows: AttributeError Traceback (most recent call last) <ipython-input-5-953d29f58a36> in

Cypher query for moving nodes from one list structure to another

瘦欲@ 提交于 2020-06-29 03:42:09
问题 We have following structure where User is starting point and nodes with numbers are labeled Invitation where its value specify their property id . I am looking for a way to create a query which moves node from list pointed by VALID_INVITATIONS relationship to another list pointed by INVALID_INVITATIONS. Moved node should be set first in new list. I came up with working solution but because of lack of knowledge and experience in Cypher I kindly ask you, the community for help and improvements

How to delete all indexes in neo4j?

眉间皱痕 提交于 2020-06-25 05:02:09
问题 I want to delete all indexes that exist using cypher in a bulk can it be done? I am using neo4j 3.4.7. DROP INDEX ON :Label(attributename) Does it replace existing indexes if I create the same index in a later stage? 回答1: A quick way to drop all indexes and constraints is to use the APOC procedure apoc.schema.assert, as follows: CALL apoc.schema.assert({},{},true) YIELD label, key RETURN * The procedure is mainly for ensuring that the DB has the indexes and constraints passed in the first 2

Add constraints to neo4j node based on node property value

五迷三道 提交于 2020-06-23 16:31:28
问题 I am adding constraints to a neo4j database using Cypher constraints and want to create a constraint which only applies to a subset of a node type. I can create a constraint that a foo field must exist on Entity with CREATE CONSTRAINT ON (e:Entity) ASSERT EXISTS (e.foo) but instead, I want to constrain only nodes with a given field. e.g CREATE CONSTRAINT ON (e:Entity {constrain_flag:true) ASSERT EXISTS (e.foo) For example, I may have two nodes like (e:Entity { foo: 'bar' , constrain_flag:

neo4j find parent node is relationship exists

不打扰是莪最后的温柔 提交于 2020-06-09 05:38:27
问题 I am trying to develop a product like a google drive. This is the second phase now. I am stuck in making cypher query and I need help. a user A can share a file/folder with a group or another user B. case 1: user A, shared the folder which consists of other subfolders. user B would see the shared folder. however, now user A shared a subfolder, and again user B should see only the root folder. case 2: user A, shared the only subfolder then, user B will only see a shared subfolder basically I