实体和关系集 [英] Entity and Relationship Set

查看:407
本文介绍了实体和关系集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对实体集和关系集感到困惑。我知道实体和关系。实体集和关系集是否有任何清晰的示例显示这些术语的实际用例?

I am confused about "entity set" and "relationship set". I am aware of "entity" and "relationship". Is there any clear example for entity set and relationship set which shows the real use cases of these terms?

 ___________            /\           ___________ 
|           |          /  \         |           |
|  Teacher  |-------- /Tea \--------|  Student  |
|___________|         \che /        |___________|
                       \s /                      
                        \/                       

在上图中,教师和学生是实体,教学是一种关系。

In the above diagram Teacher and Student are entities and Teaches is a relationship.

推荐答案

最初是在实体关系建模中:实体是一件事。某些事物之间的关系或某些事物之间的关联是单个(具体的或概念的)事物。两者都可以具有属性。实体或关系/关联类型/集合/类别是实体或关系/关联的集合。类型/集合/类对应于一个关系,并且每个实体或关系/关联都包含一行作为元素/成员的行。实体或关系/关联被称为其元素/成员的类型/集合/类的实例。

Originally in Entity-Relationship Modeling: An entity is an individual thing. A relationship between/among or an association of/on/between/among some things is an individual (concrete or conceptual) thing. Either can have properties. An entity or relatinship/association type/set/class is a collection of entities or relationships/associations. A type/set/class corresponds to a relation and contains a row per entity or relationship/association that is an element/member. An entity or relationship/association is called an instance of the type/set/class of which it is an element/member.

但是,实体被用作速记实体类和关联表示关联类。当然,这令人困惑。然后将实体实例用于实体,将类实例用于类。更令人困惑。这意味着我们可以看到实体或关系集合/类实例表示实体或关系。啊。但是实体或关联的类型习惯于表示可以被称为潜在的事物的集合/集合,具有实体和关系/关联的集合/类意味着实际可以做的那些潜在元素/成员对应于当前情况/状态下的事物。 (就像关系的类型行一样,它表示所有可能存在的元组的集合,而关系是一组实际存在的元组的集合。或者类似于类vs范围。)Ughnnnn。您只需弄清楚作者是如何使用术语的。

However, "entity" gets used as shorthand for "entity class" and "association" gets used for "association class". Which, of course, is confusing. Then "entity instance" gets used for "entity" and "class instance" gets used for "class". Even more confusing. This means that we can see entity or relationship "set/class instance" meaning entity or relationship. Ugh. But entity or association "type" gets used to mean a set/collection of what could be called potential things with entity and relationship/association set/class meaning those potential elements/members of a type that actually do correspond to a thing in the current situation/state. (Like a relation's row "type" meaning the set of all potentially present tuples vs a relations being a set of actually present tuples. Or like class vs extent.) Ughnnnn. You just have to figure out how an author is using terms.

许多关于E-RM或变体的介绍或产品也错误地使用关系来表示外键 。

Many presentations of or products supporting E-RM or variants also incorrectly use "relationship" to mean "foreign key".

Boo是老师,是实体(实例)的一个实例,当且仅当Boo是老师时。

Gee是学生是实体(实例)的一个示例,当且仅当Gee是一名学生。

Boo教导Gee是一种关系/关联(实例),当且仅当Boo教导Gee。

教师是包含所有此类实体(实例)的实体类型/集合/类别。

学生是包含所有此类实体(实例)的实体类型/集合/类别。

教导是一种关系/关联类型/集合/类别,包含所有此类关系/关联(实例)。

矩形表示实体类型/集合/类别。

菱形

矩形&表示关系/关联类型/集合/类。菱形对应于关系

(具有参与者事物的属性以及拥有/拥有/关联的财产事物的属性)。

从菱形到矩形的线表示实体类型的参与/关系/关联类型/集合/类的关系/关联中的集合/类
(以及从关系/关联关系到参与者实体关系的外键)。

Boo is a Teacher is an example of an entity (instance) if and only if Boo is a teacher.
Gee is a Student is an example of an entity (instance) if and only if Gee is a student.
Boo teaches Gee is a relationship/association (instance) if and only if Boo teaches Gee.
Teacher is an entity type/set/class, containing all such entities (instances).
Student is an entity type/set/class, containing all such entities (instances).
Teaches is a relationship/association type/set/class, containing all such relationships/associations (instances).
A rectangle denotes an entity type/set/class.
A diamond denotes a relationship/association type/set/class.
Rectangles & diamonds correspond to relations
(with attributes for participant things plus owned/possessed/associated property things).
A line from a diamond to a rectangle represents the participation of an entity type/set/class in the relationships/associations of the relationship/association type/set/class
(and a foreign key from a relationship/association relation to a participant entity relation).

具有讽刺意味的是,所有这些变化和术语的混淆都是指首先不需要的概念。 E-RM在实体事物,关系/关联事物和财产事物之间,以及作为事物的财产和与之建立关系/联系之间,进行了不必要的区分。直接进行关系建模可以避免所有这些情况。 每个查询每个超键与某种类型的事物是1:1对应的。但是E-R建模和变体只是不了解关系模型。

Ironically all this variation and confounding of terminology is in reference to concepts that are unnecessary in the first place. E-RM makes unnecessary distinctions between "entity" things, "relationship/association" things and "property" things, and between being a property of and being in a relationship/association with. Directly modeling relationally avoids all that. Every superkey of every query is in 1:1 correspondence with some kind/type of thing. But the E-R Modeling & variants just don't understand the Relational Model.

请参见答:实体关系模型和关系模型之间有什么区别?

这篇关于实体和关系集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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