0

I engineered an ERD diagram using Barker's notation. The problem was to make a database for system of water pipes where one node is connected to another using a section (pipe), each node can have unlimited number of pipes connected, but the pipe must have only two nodes that it's connected to. Each node that is situated in certain location can have zero or more devices attached. enter image description here

My other idea was to create one to many relation (section can be assigned to many nodes). Is my diagram correct?

UPDATE:

After comments I changed the relations (embedded location in node as well).

Here is the output:

enter image description here

0

I think your model could be better. As it is it allows a section to be related to many node_sections rather than to maximum of 2. You could either:

  • write a digit 2 on the diagram to show that there is a maximum cardinality at that end of the relationship; or

  • drop node_section and have two 1:m relationships directly between node and section. If your pipe network has a fixed direction of flows then call the relationships source and sink, otherwise call them end1 and end2.

  • This is an interesting answer. However, does the Barker notation allow for an explicit cardinality to be used ? – Christophe May 22 at 17:53
  • It's a notation, not holy writ, make what use of it you wish, extend it where it is useful to do so, ignore features that are unimportant to you. – High Performance Mark May 22 at 17:56
  • When using the second option, am I allowed to not explicitly set primary key for section? Either way it will get PF keys from both nodes that it's connected to. – Adrian Setniewski May 23 at 10:40
  • You tell us: can a section exist independently of nodes ? If so it needs a PK which is not just the FKs of the nodes it connects, if not, not so much. – High Performance Mark May 23 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.