9. Core Package
Overview
The Core package provides basic constructs for creating and describing meta-model classes in all specific KDM packages. Classes of the Core package determine the structure of KDM models, define fundamental modeling constraints and determine the reflective API to KDM instances.
Organization of the Core Package
The KDM uses packages to control complexity and bring together logically interrelated classes. The Core package define a set of meta-model elements which have the purpose of defining the fundamental patterns and constraints implemented by all other KDM packages.
The KDM Core packages consists of the following 4 class diagrams:
CoreEntities Class Diagram
The CoreEntity class diagram defines key abstractions shared by all KDM models.
The classes and associations of the CoreEntities class diagram are shown in See – CoreEntities Class Diagram..
Element Class (abstract)
An element is an atomic constituent of a model. In the meta-model, an Element is the top meta-element in the KDM class hierarchy. Element is an abstract meta-model element.
ModelElement Class (abstract)
A model element is an element that represents some aspect of the existing system.
In the meta-model, a ModelElement is the base for all meta-elements of KDM. All other meta-elements are either direct or indirect subclasses of ModelElement. ModelElement is an abstract meta-model element.
A ModelElement can be extended through the lightweight extension mechanism.
Semantics
The ModelElement is a common class for all meta-model elements that represent some element of the existing software system. The subclasses of Element that are not the subclasses of the ModelElement class are the auxiliary elements of the KDM infrastructure.
Each subclass of the ModelElement meta-model element can be extended through the light-weight extension mechanism defined in the kdm package.
KDMEntity Class (abstract)
A KDM entity is a named model element that represents an artifact of existing software system.
In the meta-model, KDMEntity is a subclass of ModelElement. Each KDM package defines specific KDM entities that are direct or indirect subclasses of KDMEntity. A KDMEntity can be either an atomic element, a container for some KDMEntities or a group of some KDMEntities.
Associations
Operations
Semantics
An entity is a thing of significance, about which information needs to be known or held. A KDM entity is an abstraction of some element of an existing software system, that has a distinct, separate existence, a self-contained piece of data that can be referenced as a unit. Each KDM package defines several entity types representing specific abstractions related to a certain viewpoint on existing software systems.
CoreRelations Class Diagram
The Core class diagram defines key meta-model associations of KDM models.
The classes and associations of the CoreRelations class diagram are shown in See – CoreRelations Class Diagram..
KDMRelationship Class (abstract)
A KDM relationship is a model element that represents semantic association between two entities.
In the meta-model, KDMRelationship is a subclass of ModelElement. Each KDM package defines some specific KDM relations that are either direct or indirect subclasses of KDMRelationship. Specific subclasses of KDMRelationship are typed associations between some specific subclasses of KDMEntity.
Associations
Operations
Semantics
A relationship is represents an association, linkage, or connection between entities which describes their interaction, the dependence of one upon the other, or their mutual interdependence. A KDM relationship represents some semantic association between elements of an existing software system. Each KDM package defines several relationship types representing specific abstractions related to a certain viewpoint on existing software systems. All KDM relationships are binary.
KDMEntity (additional properties)
Operations
Constraints
The set of ownedRelations for a given KDMEntity should be the same as the set of KDMRelations for which the from property is the given KDMEntity.
Semantics
This property defines the so called “encapsulated relationship” pattern. From the infrastructure perspective, the ownedRelation association is required to manage relationship elements. KDM relationships are owned by the entity which is the origin of the relationship. From the meta-model perspective, each relationship is a self-contained association class with to- and from- properties.
AggregatedRelations Class Diagram
The AggregatedRelations class diagram defines the key analysis mechanism of KDM. AggregatedRelationship are part of the “meta-level” interface to KDM models, along with interface defined by KDMEntity, and KDMRelationship.
Overall management and lifecycle of the Aggregated Relationships is determined by the operations of the KDMEntity class.
The classes and associations of the AggregatedRelations class diagram are shown in See – AggregatedRelations Class Diagram..
AggregatedRelationship Class
The set of aggregated relationships for a given entity represents all primitive relationships between the entities that are transitively owned by the given entity as well as the entity itself. This is a concrete class, because an AggregatedRelationship can be instantiated, and exchanged. AggregatedRelations are meant to be built on demand (and exchanged too, if necessary). The lifecycle of the Aggregated Relationships can be explicitly managed by the operations of the KDMEntity class.
Associations
Constraints
- To- and from-endpoints should be distinct.
- The density should be greater than or equal to 1.
- The density should be the same as the number of primitive relations represented by the given aggregated relationship.
- The to- and from- endpoints of each relation should be the same as in the aggregated relationship.
Semantics
AggregatedRelations are determined by how atomic elements are owned by containers (or referenced by groups) in the following way:
- AggregatedRelationship between two entities (no owned elements) represents the set of regular KDM relationships between these two entities (such that the first entity is the from-endpoint of the relationship, and the second entity is the to-endpoint of the relationship).
- AggregatedRelationship between an entity and a container (or group) represents the set of all regular KDM relationships such that the given entity is the from-endpoint and the to-endpoint is any entity that is owned by the given container (directly or indirectly).
- AggregatedRelationship between a container (or group) and an entity represents the set of all regular relationships such that the to-endpoint is the given entity and the from-endpoint is any entity that is owned by the given container (directly or indirectly).
- AggregatedRelation between two containers represents the set of all regular KDM relations such that the from-endpoint is an entity owned by the first container and the to-endpoint is an entity owned by the other container.
A regular KDM relationship is represented by a subtype of KDMRelationship class. It has a concrete type, and an implied density of 1. An AggregatedRelationship represents a set of regular KDM relationships. It has density of greater or equal than 1 and no concrete type (as it may represent regular KDM relationships of different types). An AggregatedRelationship cannot be constructed between two entities if there are no regular KDM relationships between them (according to the definition above).
The relation “x in* C” means that x is in container C or in some sub-container of C, transitively.
For relation R, let R’ be the corresponding aggregated relation.
Given containers C1 and C2 and the relation R, let
P = {(x,y) : x in* C1 and y in* C2 and x R y}
That is, P is the set of pairs such that x is in* C1 and y is in* C2 and x R y.
C1 and C2 are related by the aggregated relation R’ if and only if there is at least one pair in the set P.
The density of C1 R’ C2 is then simply |P|, the size of the set P.
– AggregatedRelations illustrated
See – AggregatedRelations illustrated. Illustrates Containers and aggregated relations. It uses the following notation. UML package symbols represent KDM Containers, UML associations represent KDMRelations. An arrow at the end of an association indicates, the direction of the relation (there should be at least one arrow; arrows at both ends indicate two relations, one in each direction).Numbers at the ends of associations represent the density of the corresponding KDM relationship. The KDM density has a different interpretation that UML multiplicity: since KDM represents an existing application, the exact relations and their number is what the model captures. KDM model is not a model that represents constraints, like the ones used during the design phase, rather, this is a model that captures precise knowledge about the application. So, the KDM densities are exact.
Aggregated relations are collections of more primitive relations, which at the end are some basic code fact, for example “procedure x calls procedure y”. Such basic fact has density 1. The primitive code relation represents some basic fact about the existing application. Now, when there are two or more such facts, for example “procedure x in module A calls procedure y in module B” and “procedure z in module A calls procedure y in module B”, there is an aggregated relation between modules A and B with density 2 (2=1+1). In this case, the aggregated relation represents the collection of the two primitive relations between modules A and B.
KDMEntity (additional properties)
Operations
Datatypes Class Diagram
The Datatypes class diagram collects together utility data types for the Core package. Each class at the Datatypes class diagram is a subclass of MOF DataType class. The classes of the Datatypes class diagram are shown in See – Datatypes Class Diagram..
Boolean Type (datatype)
The meta-model uses the Boolean type to represent some KDM attributes, KDM operations, and their parameters.