1. BIS总结
在 BIS Repository 中所有信息的定义可囊括为:Elements、ElementAspects、Models 和 Relationships。
BIS 是使用 EC Information Modeling 语言表示的。考虑到读者比较熟悉 ECObjects,所以在BIS中增加了额外的约束条件、命名规则以及其他限制。参见Schema。
下面的大多数概念都定义为 "BisCore" 领域中的 ECClasses,该模式的别名为 "bis",因此我们编写"类名"(ClassName)来表示 BisCore 中定义的 ECClass。
1.1. Elements
数字化的 Element 对象指的是现实世界中某些物体或实体,例如泵、粱、合同、公司等。Element 是包含在 Models 里面的,并且使用 ECProperties 进行定义。
- CodeSpec:链接
- CodeScope:链接
- CodeValue:链接
- FederationGuid:全局唯一的 GUID;
- UserLabel:Element 的别名;
- JsonProperties:保存特定实例的临时数据,key-value 形式且大小写敏感;
UserProps:保存用户自定义属性内容;
Element 子类型
- GeometricElement:表示现实世界的物体,可以采用几何形状进行表达;
- InformationContentElement: 用来支持或追踪 Element 的信息,例如文档、记录等;
- RoleElement:在 BIS 将特定应用的领域分解起到重要作用;
1.1.1. 示例
1.2. ElementAspects
ElementAspect 是 Element 中的一组 ECProperties,始终贯穿 Element 的全生命周期。ElementAspect 实例由单个 Element 拥有,不被其他 Element 所共享,因此不能成为任何"传入"关系的目标。每个 Element 和 ElementUniqueAspects 最多有一个实例,每个 Element 可能具有 ElementMultiAspects。
1.3. Models
Model 是 Element 的容器,为包含的元素提供上下文内容以及建模视角。主要有:
模型子类(subclass)
模型的专业划分可能会限制包含 Element 的类型
划分的颗粒度
对象作为一个整体或可继续拆分
域(Domain)规则
有些规则由代码执行,用户无法自定义
1.4. Relationships
BisCore 已定义许多的 ECRelationship 类,用于关联 Model、Element 和 ElementAspect。常用的 Relationship 有:ElementOwnsChildElements, ElementOwnsChildElements, ElementOwnsUniqueAspect / ElementOwnsMultiAspects, ModelContainsElements。
1.4.1. 关系 (Relationships) 继承
Relationship 继承关系有 Abstract,Concrete 和 Sealed类型。
- Abstract: 无法被实例化,例如 ElementRefersToElements;
- Concrete: 可以被继承或被实例化,例如 ElementOwnsUniqueAspect;
- Sealed: 无法被继承,例如 ModelContainsElements。
1.4.2. 关系 (Relationships) 延展
定义对象全生命周期所指向的目标,主要包括两种类型:Embedding, Referencing:
- Embedding: 指嵌入,控制着一些对象的生命周期,类似于父-子关系,当父对象被删除时,所有子对象也会被删除。例如 ElementOwnsChildElements;
- Referencing: 指参考,指向一些对象,但不控制它的全生命周期,例如 ElementRefersToElements。
延展的方向主要有:
- Forward: 默认的方向,从源(Source)到目标(Target),例如元素包含子元素关系(ElementOwnsChildElements );
- Backward: 从目标(Target)到源(Source),例如模型建模成元素(ModelModelsElement)。
关系的多重性 (Relationship multiplicity): 采用 <lower>..<upper>
进行表达,且 lower 介于 0
和 *
之间,upper介于 1
和 *
之间。用来表达一对一,一对多,多对一,多对多等关系。
例如:
<ECRelationshipClass typeName="ElementOwnsChildElements" strength="embedding" modifier="None">
<Source multiplicity="(0..1)" roleLabel="owns child" polymorphic="true">
<Class class="Element"/>
</Source>
<Target multiplicity="(0..*)" roleLabel="is owned by parent" polymorphic="true">
<Class class="Element"/>
</Target>
</ECRelationshipClass>
1.5. BIS 示例
BisCore 可解释为 BIS domain schemas
Author: 丁嘉树