Re: Model tree in relational database with property inheritance

From: <edprochak_at_gmail.com>
Date: Sat, 5 Jan 2019 12:04:58 -0800 (PST)
Message-ID: <deec0968-8c9b-4e00-bd52-cce855f22605_at_googlegroups.com>


On Saturday, January 5, 2019 at 5:30:01 AM UTC-5, yashba..._at_gmail.com wrote:
> Hi Everybody,
> I have to implement a directory kind of structure with relational databases.

WHY?
> Just like normal file system the directories and the files inside them
> will have permissions associated with them.
> Moreover, permissions will be inherited from the parent and priority
> will be given to permission defined on the file/directory itself or
> the nearest ancestor. Also, if permission is defined for some parent
> directory then it will not be copied into database again for each
> child unless we want to override parent permission for specific child.
>
> Priority of Operations in order of frequency:
>
> 1. Get the tree structure of files/folders for which user has access.
> 2. Check if user has access to a particular file. (In this case, permission has to be taken from file id itself if specified, otherwise we have to search for nearest ancestor).
> 3. Add a new file.
> 4. Add a new folder.
>
> I was banging my head with Adjacency lists, Materialized paths
> and Nested sets.
> Unable to come to a good solution which optimizes both read and write.

Is this for a class?
If this is a class assignment, we'll try to guide you, but not provide a solution.
I can see that this might be useful (I have an application in mind), but it would help if you describe your application. This might be the wrong solution to your application.

Have you tried writing an Entity Relationship Diagram to model this before trying to implement it?

What is the initial input? Are you sucking in a real file system? Or building this from the input calls (3 and 4 in the list of operations)?

Ed Received on Sat Jan 05 2019 - 21:04:58 CET

Original text of this message