在sap的table是属性描述中
有些sap自己的概念
这也是基于所谓的SERM(structured entity relationship management)
1.Entity
这个和通常认为的实体是一致的
通俗的说可以理解为sap tables的基本表
实体和实体之间可能有多中关系
多对多关系在逻辑上存在
但是不会直接在实体与实体的实现中存在
通常是引入relation
2.relation
简单的关系
来自二元关联
relation 体现实体之间的关系
这里又可以拆分成 : 继承 ?聚合 / 组合
引入OO的概念
继承可能对应 one to many
(当然也可以反向)
聚合
是一种较强烈的相关关系
例如
电脑
和
鼠标
整体
包含部分 ?但是部分可以超脱整体的life span
组合
是特殊的聚合
例如人
和 ?眼睛?
通常来说
眼睛不能离开人而单独存在
而所谓的普通关系
例如人
和
电脑
他们就是两个基本的实体
但是他们之间的联系
人
使用
电脑
关于
继承
和
聚合
继承仅仅是针对parent object
聚合中包含更多的object
(这也是设计模式中提倡多组合
少继承的一个特征 ?组合带来更大的延展性和方便扩展)
3.sap的serm中不存在many to many
一般是通过relation表(即中间表的形式实现了多对多)
Not that the Structured Entity Relationship Model (SERM) does not allow m:n relationships (that is, many-to-many relationships). Therefore, entity types in SERM can be arranged from left to right, from independent to dependent entity type.
鉴于这个特征
也就提出了一个数量关系的要求
从顺序上看?
Independent to dependent ?: 独立 -> 依赖
用个人的话来外键指向的表作为Independent ?(当做实体)
包含外键的表
作为关系 ?是有依赖关系的
通常来说sap的检查表通常都是Independent的
数量?A:B
A?
用来表示外键指向的表 ?被依赖的 ?(可以简单理解为实体 ?实际中不一定是实体)
有两个取值 ?
1 ?被依赖方必须存在
C ?可能存在
B ?表示数量关系
被依赖
对
依赖方
1 ? one to one
C ?max one
N ?at least one
CN any
简单里姐实体和关系表中的关系
实体总是1 ?!!!
?
?
Relationships? In SAP
2014年4月7日
0:21
?
?
?Relationships???
Relationships?between two entity types are defined by specifying the two entity types involved, that is, the source entity type (the existentially independent entity type) and the target entity type (the existentially dependent entity type). The relationship is oriented; from the independent entity type to the dependent entity type. Relationships have these characteristics:
●??????Category
●??????Cardinality
●??????Their business significance
The relationship?Offers?exists between the entity types?Faculty?(source entity type) and?Courses?(target entity type).
Category
A relationship category can be hierarchical, aggregating, referential, or external.
Hierarchical:
There is a hierarchical relationship category between two entity types when the following apply:
●??????The target entity type is existentially dependent on the source entity type, that is, the life span of a characteristic of the target entity type is shorter than or equal to the life span of the characteristic of the source entity type.
●??????The target entity type is generated from the source entity type, that is, the source entity type influences the characteristic values directly.
●??????The target entity type represents a semantic refinement, that is, the target entity type is a classification of the source entity type which describes the source entity type more precisely.
The key of the source entity type becomes part of the key of the target entity type. You may not change the relationship between two entities.
The relationship?Offers?with the cardinality 1:CN exists between the entity types?Faculty?(source entity type) and?Courses?(target entity type).
The source entity type?Faculty?has the attributes?Faculty number?(key attribute) and?Faculty name.
The target entity type?Courses?has the attributes?Faculty number?(key attribute),?Course number?(key attribute),?Number of the course instructor?and?Course name.
Since, with this category of relationship, the source entity identifies the associated target entity by means of a part of the key attributes, a change to a relationship would mean that the target entity would be deleted and a new target entity would be created.
?
?
Aggregating:
There is an aggregating relationship category between two entity types when the following apply:
●??????The target entity type is existentially dependent on the source entity type, that is, the life span of a characteristic of the target entity type is shorter than or equal to the life span of the characteristic of the source entity type.
●??????The target entity type is generated from the source entity type, that is, the source entity type influences the characteristic values directly.
●??????At least one other source entity type, different from the first one, is involved in the formation of the target entity type.
The keys of the source entity types become part of the canonic key of the target entity type.
The aggregating and the hierarchical relationship categories differ from one another only in the third characteristic.
?
?
Referential:
There is a referential relationship category when the following apply:
●??????The target entity type is existentially dependent on the source entity type.
●??????The source entity type determines the context of the target entity type, that is, an attribute group of the start entity type is present in the target entity type, but this does not generate the target entity type.
The key attributes of the source entity type are included in the target entity type as non-key-attributes. The relationship between two entities may not be changed.
The relationship?Teaches?with cardinality 1:CN exists between the entity types?Professor?(source entity type) and?Courses?(target entity type).
The source entity type?Professor?has the attributes?Number?(key attribute),?Name,?Address, and?Salary class.
The target entity type?Courses?has the attributes?Faculty number?(key attribute),?Course number?(key attribute),?Number of the course instructor?and?Course name.
A distinction is made between strong and weak existential dependence. Strong existential dependence requires there to be an assignment to exactly one characteristic of the source entity type for each characteristic of the target entity type. If this condition applies only to one (time-dependent) subset of the target entity type, the existential dependence is said to be weak.
Weak existential dependence can occur in aggregating and referential relationship categories but not in hierarchical relationship categories.
This results in the following situation:
Classification of relationship categories
?? |
? ? ? strong existential dependence |
weak existential dependence |
generating |
hierarchical aggregating |
conditional-aggregating |
context |
referential |
conditional-referential temporary-referential |
?
?
External:
A relationship between an entity type within a data model and an entity type outside the data model is described as an ‘external‘ relationship.
Cardinality
The cardinality (n : m) describes the relationship with respect to the number of dependent entities (entities of the target entity type) and independent entities (entities of the source entity type) in the relationship.
The possible values for the left and right sides of the cardinality have the following significance:
n = 1
For each dependent entity, there is precisely one independent entity.
n = C
Dependent entities can exist that do not refer to an entity of the source entity type.
m = 1
For each entity of the source entity type, there is exactly one dependent entity.
m = C
For each entity of the source entity type, there is a maximum of one dependent entity.
m = N
For each entity of the source entity type, there is at least one dependent entity.
m = CN
For each entity of the source entity type, there are any number of dependent entities.
Not that the Structured Entity Relationship Model (SERM) does not allow m:n relationships (that is, many-to-many relationships). Therefore, entity types in SERM can be arranged from left to right, from independent to dependent entity type.
The cardinality C:x (x = 1, C, CN, N) should be used only for relationships of the category ‘referential‘. However, this cardinality is also possible for relationships of the category ‘aggregating‘.
Hierarchical relationships do?not?allow this cardinality, since all dependent entities must refer to an entity of the source entity type.
?
?
From <http://help.sap.com/saphelp_em70/helpdata/en/22/bd17a8460a11d188fe0000e8323d3a/content.htm>
?
?