.. comment all inline tags to start with _how_mapex_ .. index:: Domain Model; Common examples of mappings ########################### Common examples of mappings ########################### .. include:: /pages/common/pageunderconstruction.txt :start-line: 3 ========================= List of reviewed elements ========================= .. contents:: :local: :depth: 2 :backlinks: top .. important:: DomainModel mappings should usually follow the CoreModel approach. ----------------------------------------------------------------- “Common” attributes : Id, Name, Description, SameAs, ClassifiedAs ----------------------------------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mapping of the Id attribute as an IdentifierSelect ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **CoreModel**: the target entity has an Id attribute. .. figure:: /images/howto/Domain_model_to_ARM_mapping/idcoremodel1.png :scale: 100% **CoreModel**: the target entity does not have an Id attribute. .. figure:: /images/howto/Domain_model_to_ARM_mapping/idcoremodel2.png :scale: 100% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mapping of the Description/Name attribute as a DescriptorSelect ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **CoreModel**: the target entity has a Description/Name attribute. .. figure:: /images/howto/Domain_model_to_ARM_mapping/namecoremodel1.png :scale: 100% Another way of doing it: .. figure:: /images/howto/Domain_model_to_ARM_mapping/namecoremodel2.png :scale: 100% **CoreModel**: the target entity does not have a Description/Name attribute. .. figure:: /images/howto/Domain_model_to_ARM_mapping/descriptorselectcoremodel.png :scale: 100% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mapping of the SameAs attribute as a Proxy ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **CoreModel**: the target entity does not have a SameAs attribute. .. figure:: /images/howto/Domain_model_to_ARM_mapping/sameascoremodel.png :scale: 100% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mapping of the Definition attribute as a ProxyItemSelect ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. figure:: /images/howto/Domain_model_to_ARM_mapping/ProxyItemSelect.png :scale: 100% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mapping of the ClassifiedAs attribute as a Classification ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **CoreModel**: the target entity does not have a ClassifiedAs attribute. .. figure:: /images/howto/Domain_model_to_ARM_mapping/classifiedascoremodel.png :scale: 100% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mapping of the Class attribute as a ClassSelect ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. figure:: /images/howto/Domain_model_to_ARM_mapping/ClassSelect.png :scale: 100% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mapping of the default value /ignore and NULL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "/IGNORE/" to clearly define that this is a dummy data. **CoreModel**'s examples: .. figure:: /images/howto/Domain_model_to_ARM_mapping/mappingOfDefaultValues.png :scale: 100% We use /IGNORE when a mandatory attribute in the ARM is being replaced by an assignment in the core model. /IGNORE indicates that the expected value will be find in an assignment. **NULL** means that an attribute is not set at all . It shall not be a mandatory attribute. When we have a mandatory attribute in the ARM which has no equivalent in the core model, we need to figure out how to give it a default value in the mapping. If we cannot, it means that we are missing something in the model and we shall modify either the core or the ARM . There is a preference for an update of the CoreModel or an agreement on a default mapping value. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Example of the use of dummy instances with Initial_view_definition_context ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. figure:: /images/howto/Domain_model_to_ARM_mapping/Initial_view_definition_context.png :scale: 100% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Location of a constraint block ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * A constraint block should be located in the CTC package of the related SELECT. * If the constraint block is not related to a SELECT, the constraint block specific to a CTC should be in the CTC Package. * We don't create a sub-package in the CTC for "Constraint" in the Domain Model layer (unlike the CoreModel). ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use of constraint's outputs ^^^^^^^^^^^^^^^^^^^^^^^^^^^ **CoreModel**'s example: .. figure:: /images/howto/Domain_model_to_ARM_mapping/constraintOutput.png :scale: 100% “Rules” : * the ouput of a constraint represents the entity (see n°1), * represent entities by a block, when there is a need to access to specific attributes (see n°2), * if the constraint's ouput is a “template”, drag and drop it into the view (see n°3). Fore more information on constraints, see :ref:`how_dmcore_create_constraint` and :ref:`how_dmcore_use_constraint` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Questions on specific mappings from their review ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In the **DomainModel**, the mapping of PlannedActivity: .. figure:: /images/howto/Domain_model_to_ARM_mapping/plannedActivity.png :scale: 100% We do not assign a property using its name. In the **DomainModel**, the mapping of PropertyDefinitionAssignment: .. figure:: /images/howto/Domain_model_to_ARM_mapping/propertyDefinitionAssignment.png :scale: 100% We do not assign a Unit but a Class with tha same Name. -------------------- Inverse relationship -------------------- .. figure:: /images/howto/Domain_model_to_ARM_mapping/inverse.png :scale: 100% From the example on a BlockDefinitionDiagram that shows InterfaceSpecification and InterfaceSpecificationVersion with the part property versions shown as an association between them do the following: .. todo:: #. Right click on the Association and select Specification #. In the left hand pane click on the + sign beside the Roles #. Select the unnamed role represented by a circle #. Enter the name of the inverse attribute as the name of the role #. Click on the Owned by field (should be association at present) and change that to Block (accept the change to navigability) #. Specify the multiplicity #. set the Is Read Only to true #. click OK --------------------------------------------------------- How to represent IDENTICAL MAPPING in parametric diagrams --------------------------------------------------------- .. figure:: /images/howto/Domain_model_to_ARM_mapping/ExternalItem.jpg :scale: 100% The proposed mapping will map the ExternalItem to an External_representation_item, then in the mapping of ExternalRepresentationItem we use this mapping (identical!) and add the name property. .. figure:: /images/howto/Domain_model_to_ARM_mapping/ExternalRepresentationItem.jpg :scale: 100% --------------------------------------------------------- How to do a mapping of a single/combined classification --------------------------------------------------------- See :ref:`how_dmcore_combined_classification` and :ref:`how_dmcore_single_classification` --------------------------------------------- Circular relationships in parametric diagrams --------------------------------------------- e.g. Representation and Representation_context representation_in_context attribute is an inverse (not stereotyped, set as read-only) so no need to map it ! .. index:: Mapping; How to - Enumeration .. _how_mapex_enum: -------------------------- How to map an enumeration -------------------------- For example, a TwistDirection will have a counterpart enumeration in the ARM. In which case we follow a similar pattern to Select types. Create a value property on the Domain Enumeration of type ARM:enumeration (yes enumerations can have properties ;-) call this "value" [1] and public. For each enumeration literal in the domain model set the slot for the value property to be the corresponding enumeration literal from the ARM When using the enumeration in another mapping use the value property (containing the ARM enumeration) to bind in the parametric diagram. If there is no correspondence between domain and ARM then we have to extend this approach. .. index:: Mapping; How to - Select .. _how_mapex_select: ------------------------------ How to create a select mapping ------------------------------ Two types of SELECT's mapping: In both cases, no parametric diagrams 1) one port defined (but no parametric diagram) every member goes out with the same types and we have one output port, knowing that each member of the SELECT should be mapped in its own parametric diagram. ==> when SELECT contains only Block Types eg.: DateTimeAssignmentSelect .. figure:: /images/howto/Domain_model_to_ARM_mapping/SelectMappingEx1.png :scale: 100% 2) No output ports There are few of them (from the common attributes) but used everywhere. ==> when SELECT is hybrid: contains Block Types and Primitive Types eg.: ClassSelect .. figure:: /images/howto/Domain_model_to_ARM_mapping/SelectMappingEx2.png :scale: 100% #. create an output port for the SELECT in the DomainModel, typed as the SELECT object in the target ARM; #. for each of the specializations in the DomainModel's SELECT type, provide a SELECT mapping as a parametric diagram (inside the concerned Block), that shows how the target ARM specialization is mapped to that port. .. sectionauthor:: |Aminata Mbengue| .. include:: /keywords.rst