cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Folder File Structure using neo4j

Hi

We have a new requirement for our project. We need to create a folder/file structure.

Now we are doing brainstorming to support this change.

As you can see, john is a member of both a tower and a group.

a genome contains the root virtual folder and which consists of more folders and files

user can be a member of multiple groups and we maintain a relationship (CAN_ACCESS_DIR) between group1 and a folder (DCL) or file.

case 1 :
if there is no relationship (CAN_ACCESS_DIR) between group1 and DCL folder then we need to skip it and show the next folder (only) which has a relationship (CAN_ACCESS_DIR) with group example in this case
root, mongo.pdf, java

(First level relation match only)

Dump 1: https://1drv.ms/u/s!Asa15xOcdKEhhIIBHxtLk4t7YaLuxg

case 2:
if group1 has a relationship (CAN_ACCESS_DIR) with DCL folder then we don't need to skip. we only need to return root, mongo.pdf and DCL folder (First level relation match only)

Dump 2: <https://1drv.ms/u/s!Asa15xOcdKEhhIIArOGkR3KuSqlpHw >


Thanks
Sumit

4 REPLIES 4

It would be great if someone can guide me please

What is your actual question? And what have you tried so far (Cypher queries) for these aspects?

We are trying to create a google drive like system. Each individual user is going to have their own folder/file structure. They can share folder/file with a single user or a group.

As you can see, John is a member of group1 with relationship [:MEMEBER_OF_GROUP].

Group1 can access both JAVA, JAVA2, golang & python with relationship [:CAN_ACCESS_DIR]

If I run a cypher query like

With CAN_ACCESS_DIR relationship I will get 4 outputs

JAVA
JAVA2
python
golang

I need to find the root (JAVA) of JAVA2 and check if it has been shared (CAN_ACCESS_DIR) with a same group or a user. If yes, then we will send only JAVA folder. If not then send only JAVA2 folder.
JAVA2 folder is the child of JAVA folder [CONTAINS].

Example in google drive if I share a folder which consist of lots of sub folders. And user shared a root folder as well as subfolder. Other user only sees the root folder shared with him. He can view all the subfolder.

I am finding difficulty in writing such query. We are new to neo4j and just started new journey. It would also be great if you can review our structure and help us in achieving it.

Please refer some advance cypher tutorial / books/ docs which would be beneficial for me and my team.

match (u:user) where u.name = "John"
match (t:tower) where t.name = "Genome"
match (d:directory) where d.name = "Root"
match (u)-[:MEMBER_OF_GROUP]->(g:group)
match (d)-[:CONTAINS*0..]->(s) where (s)<-[:CAN_ACCESS_DIR]-(g)<-[:MEMBER_OF_GROUP]-(u)
return s

Looking forward to hearing from you @michael.hunger Thanks

guys please help me out