0

here is my scenario. I have a pre-defined data type structure for books. Just take it as an example for the sake of simplicity. The structure looks like the image below. It's a Labeled Property Graph and the information is self-explained. This data type structure is fixed, I cannot change it. I just use it.

DTR Example

When there is 1 book, let's call it Harry Potter, in the system, it might look like below:

DTR 1 book

So, the book has its own property (ID, Name,...) and also contains a field type MandatoryData. By looking at this graph, we can know all information about the book.

The problem happens when I have 2 books in the system, which looks like this:

DTR 2 Books

In this case, there is another book called Graph DB, with those information as highlighted.

The problem of this design is: we don't know which information belong to which book. For example, we cannot distinguish the publishedYear anymore.

My question is: how to solve or avoid this problem? Should I create 1 MandatoryData for each book? Could you propose me any design?

I'm using Neo4j and Cypher. Thank you for your help!

asked Nov 22, 2017 at 14:55
1
  • 1
    Hi. You said "The problem of this design is: we don't know which information belong to which book. For example, we cannot distinguish the publishedYear anymore." But in the graph model you have nodes and vertexes only. The information in one node does not belong to any other node. If you want any information to actually belong to the node, store it as an attribute in the node. Commented Dec 4, 2017 at 9:02

1 Answer 1

4

Should I create 1 MandatoryData for each book?

Yes.

If you cannot get rid of MandatoryData object, you should have one such object per book.

Otherwise I would simplify the model and move any mandatory attributes to the Book object, which will reduce ne04j database size. Modeling relationships which are always 1:1 is possible, but not optimal. You can improve query performance by keeping the data in one object.

answered Dec 4, 2017 at 9:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.