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

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

问题描述

我不太确定如何读取ER图中的三元关系. 可以说这是给定的三元关系. 我能从中得到什么解释?

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

动手操作帐户和用户: 一对帐户"和用户"可以与M个项目关联.

动手实现帐户和项目: 一对Account和Project可以与M个用户关联.

动手做项目和用户: 一对Project和User可以与一个帐户关联.

这些对是一直保持一对一关系还是可以有几对?

解决方案

最新答案,但可能会为将来的读者服务.

假设三元关系具有参与实体A,B和C(对于度> 3,它会变得很毛茸茸).

读取关系的方法是始终将3个参与实体中的2个隔离开,并查看它们与第三个实体的关系.您需要对所有可能的配对进行此操作.

更准确地说:您每次配对的2个实体,对于每个实体,都应视为其中一个",而要回答的问题是,第三个实体中的多少个"可以对应于该对. /p>

抽象示例

"One of A and one of B can {have/associate with/belong to} X? of C".我们需要利用我们对业务模型的了解来回答X?应该是1还是N.这是在连接三元关系和实体C的边上分配给三元关系的基数.

该短语必须针对所有可能的组合(不是排列,因为配对的顺序无关紧要)进行重构.因此,要回答问题How many pairs are there?,简单的数学运算将以2组为一组的3件事组合的可能方法是:

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

因此,使用我们的业务模型可以回答的所有可能短语为:

  • 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

具体示例

我正在借用这张发现的图片在线. >

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

  • 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

因此,三元关系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天全站免登陆