ER 图表:三元关系 - 如何正确阅读? [英] ER-Diagram: Ternary Relationship - How to read properly?

查看:50
本文介绍了ER 图表:三元关系 - 如何正确阅读?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不太确定如何阅读 ER 图中的三元关系.假设这是给出的三元关系.我可以从中解释什么?

它说你必须把你的手放在 2 个实体集上,然后像这样阅读.

实际帐户和用户:一对 Account 和 User 可以关联 M 个项目.

实际帐户和项目:一对 Account 和 Project 可以关联 M 个用户.

动手项目和用户:一对项目和用户可以关联 1 个帐户.

这些对是否总是一对一的关系,或者有多少对?

解决方案

迟到的答案,但可能为未来的读者服务.

假设三元关系有参与实体 A、B 和 C(对于 > 3 的程度,它变得非常多毛).

读取关系的方法是始终从 3 个参与实体中分离出 2 个,并查看它们与第三个实体之间的关系.并且您需要对所有可能的配对执行此操作.

更准确地说:您每次配对的 2 个实体,需要被视为每个实体的其中之一",要回答的问题是第三个实体中的多少"可以对应于这一对.

抽象例子

A 中的一个和 B 中的一个可以{拥有/关联/属于}C 的 X?".我们需要使用我们的商业模式知识来回答 X? 应该是 1 还是 N.这是分配给连接三元关系与实体 C 的边上的三元关系的基数.

对于所有可能的组合(不是排列,因为配对的顺序无关紧要),必须对该短语进行改造.因此,要回答有多少对?这个问题,简单的数学表明将 3 个事物组合成 2 个一组的可能方法是:

3!/(2!*(3-2)!) = 3.

因此,使用我们的商业模式可以回答的所有可能的短语是:

  • A 中的一个和 B 中的一个可以{拥有/关联/属于}?X?
  • A 中的一个和 C 中的一个可以{拥有/关联/属于}?Y?B
  • B 中的一个和 C 中的一个可以{拥有/关联/属于}?Z?A

具体例子

我借用了这张我在

导致这种形象的商业模式的现实是:

  • 1 位医生和 1 个特定患者可以记录 M 次治疗
  • 1 位医生记录了 N 位患者的 1 次特定治疗
  • 1 位患者记录了 1 位医生的 1 次特定治疗

所以三元关系log是参与实体Treatment-Patient-Physician(按此顺序)之间的M-N-1关系.

Im not quite sure how to read ternary relationships within a ER-Diagram. Lets say this is the ternary relationship that is given. What can I interpret out of that?

It says that you have to put your hand on 2 entity sets and then read it like that.

Hand on Account and User: A pair of Account and User can be associated with M projects.

Hand on Account and Project: A pair of Account and Project can be associated with M users.

Hand on Project and User: A pair of Project and User can be associated with 1 Account.

Are the pairs always in a one to one relationship or how many pairs can there be?

解决方案

Late answer, but might serve future readers.

Assume the ternary relationship has participating entities A, B and C (for degree > 3 it gets pretty hairy).

The way to read the relationship is to always isolate 2 out of the 3 participating entities and see how they relate towards the third one. And you need to do this for all possible pairs.

More precisely: the 2 entities that you pair each time, need to be considered as "one of" for each one of them and the question to answer is "how many" of the third one can correspond to this pair.

Abstract example

"One of A and one of B can {have/associate with/belong to} X? of C". We need to use our knowledge of our business model to answer if X? should be 1 or N. This is the cardinality to assign to the ternary relationship on the edge that connects the ternary relationship with the entity C.

This phrase has to be reformed for all possible combinations (not permutations, since the order of pairing doesn't matter). So to answer the question How many pairs are there?, simple math dictates that the possible ways to combine 3 things in groups of 2 is:

3!/(2!*(3-2)!) = 3.

So all the possible phrases to answer using our business model are:

  • One of A and one of B can {have/associate with/belong to} ?X? of C
  • One of A and one of C can {have/associate with/belong to} ?Y? of B
  • One of B and one of C can {have/associate with/belong to} ?Z? of A

Specific example

I'm borrowing this image I found online.

The realities of our business model that led to this image are:

  • 1 Physician with 1 specific Patient can log M Treatments
  • 1 Physician logs 1 specific Treatment for N Patients
  • 1 Patient is logged 1 specific Treatment by 1 Physician

So the ternary relationship log is an M-N-1 relationship between the participating entities Treatment-Patient-Physician (in this order).

这篇关于ER 图表:三元关系 - 如何正确阅读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆