This section describes the transformation definition for transforming PIMs in UML to models of Web components. The definition is identical to the rules used in section 5.3.1. The source language is the simplified UML, defined in the metamodel in Figure 10-1. The target language is the Web model described in section 5.3. The metamodel for Web components used is depicted in Figure 10-4. The rules depend on the UML to EJB transformation rules. This is because the generated Web components depend on the EJB components, similar to the fact that EJB Entity Components depend on the Tables of the relational model.
As already explained in section 5.3.1. the UML to Web transformation rules are very similar to the UML to EJB transformation rules. This is also the reason why both transformation definitions use the same query operations defined in section 10.2.1.
-
Each class that is not the part of a composite aggregation is mapped to a Web component. Classes that are composite parts of other classes do not conform to this rule and are transformed by the next rule. This rule formalizes rule 1 in section 5.3.1.
Transformation ClassToWebComponent (UML, Web) { source class : UML::Class; target webComponent : Web::WebComponent; rootDataClass : Web::WebDataClass; dataSchema : Web::WebDataSchema; servingAttribute : Web::WebServingAttribute; source condition not class.feature->exists(end : UML::AssociationEnd end.otherEnd.composition); target condition servingAttribute.class = webComponent and servingAttribute.type = rootDataClass and rootDataClass.package = dataSchema; unidirectional; mapping class.name <~> webComponent.name; class.name <~> rootDataClass.name; class.name <~> servingAttribute.name; class.name <~> dataSchema.name; class.getAllContained(Set(UML::Class){}).operations() <~> webComponent.feature; class.feature->select(oclKindOf(UML::Attribute) or oclKindOf(UML::AssociationEnd)) <~> rootDataClass.feature; class <~> webComponent.usedComponent; }
-
The following transformation defines the mapping from a UML class to a Web data class. The source condition states that this transformation can only be applied when the UML class is part of a composite aggregation. This rule formalizes a part of rule 2 in section 5.3.1.
Transformation ClassToDataClass (UML, Web) { source class : UML::Class; target nonRootClass : Web::WebDataClass; source condition class.feature->exists(end : AssociationEnd end.otherEnd.composition); unidirectional; mapping class.name <~> nonRootClass.name; class.feature->select(oclKindOf(UML::Attribute) or oclKindOf(UML::AssociationEnd)) <~> rootDataClass.feature; class.getOuterMostContainer() <-> nonRootClass.package; }
-
Each association is transformed into a Web association. This rule formalizes rule 3 in section 5.3.1.
Transformation AssociationToDataAssociation (UML, Web) { source assoc : UML::Association; target dataAssoc : Web::WebDataAssociation; source condition assoc.end->exists(composition); unidirectional ; mapping assoc.name <~> dataAssoc.name; assoc.end <~> dataAssoc.end; assoc.getOuterMostContainer() <~> dataAssoc.package; }
-
This rule formalizes a part of rule 4 in section 5.3.1.
Transformation AssociationClassToDataClass (UML, Web) { source associationClass : UML::AssociationClass; target nonRootClass : Web::WebDataClass; source condition class.feature.->exists(end : AssociationEnd end.otherEnd.composition); unidirectional ; mapping associationClass.name <~> nonRootClass.name; associationClass.feature->select(oclKindOf(UML::Attribute) or oclKindOf(UML::AssociationEnd)) <~> rootDataClass.feature; associationClass.getOuterMostContainer() <~> nonRootClass.package; }
-
The following rule formalizes rule 5 in section 5.3.1. This is a straightforward transformation from UML attribute to Web attribute.
Transformation UMLAttributeToWebAttribute (UML, Web) { source umlAttribute : UML::Attribute; target webAttribute : Web::WebAttribute; unidirectional ; mapping umlAttribute.name <~> webAttribute.name; umlAttribute.type <~> webAttribute.type; }
-
This rule defines a transformation from a UML association end to a Web association end. The condition of this rule states that it is only applicable if the transformed association end is not crossing a Web data schema. In this case, the type of the Web association end is a Web data class. This rule formalizes a part of rule 3 in section 5.3.1.
Transformation UMLAssociationEndToWebAssociationEnd(UML, Web) { source umlAssociationEnd : UML::AssociationEnd; target webAssociationEnd : Web::WebAssociationEnd; source condition umlAssociationEnd.association.oclIsTypeOf(Association) and umlAssociationEnd.class.getOuterMostContainer() = umlAssociationEnd.type.getOuterMostContainer(); unidirectional ; mapping umlAssociationEnd.name <~> webAssociationEnd.name; umlAssociationEnd.upper <~> webAssociationEnd.upper; umlAssociationEnd.lower <~> webAssociationEnd.lower; umlAssociationEnd.composition <~> webAssociationEnd.composition; umlAssociationEnd.type <~> webAssociationEnd.type.oclAsType(Web::WebDataClass); }
-
This rule also defines a transformation from a UML association end to a Web association end. The condition of this rule states that it is only applicable if the transformed association end is crossing a Web data schema. In this case, the type of the Web association end is an EJB key class. This rule formalizes a part of rule 3 in section 5.3.1.
Transformation UMLAssociationEndToWebAssociationEnd(UML, Web) { source umlAssociationEnd : UML::AssociationEnd; target webAssociationEnd : Web::WebAssociationEnd; source condition umlAssociationEnd.association.oclIsTypeOf(Association) and not umlAssociationEnd.class.getOuterMostContainer() = umlAssociationEnd.type.getOuterMostContainer(); unidirectional ; mapping umlAssociationEnd.name <~> webAssociationEnd.name; umlAssociationEnd.upper <~> webAssociationEnd.upper; umlAssociationEnd.lower <~> webAssociationEnd.lower; umlAssociationEnd.composition <~> webAssociationEnd.composition; umlAssociationEnd.type <~> webAssociationEnd.type.oclAsType(EJB::EJBKeyClass); }
-
The following rule transforms association ends from an association class into associations in the Web data schemas. This is because we need two associations per association class to implement them in the Web model, which does not support association classes in the metamodel. This rule formalizes a part of rule 4 in section 5.3.1.
Transformation UMLAssociationClassEndToWebAssociation(UML, Web) { source umlAssociationEnd : UML::AssociationEnd; target webAssociation : Web::WebAssociation; webAssociationEnd1 : Web::WebAssociationEnd; webAssociationEnd2 : Web::WebAssociationEnd; source condition umlAssociationEnd.upper <> 1 and umlAssociationEnd.association.oclIsTypeOf(AssociationClass) and umlAssociationEnd.association.getOuterMostContainer() = umlAssociationEnd.type.getOuterMostContainer(); target condition webAssociationEnd1.lower = 0 and webAssociationEnd1.upper = * and webAssociationEnd2.lower = 1 and webAssociationEnd2.upper = 1 and webAssociationEnd1.composition = false and webAssociationEnd1.association = webAssociation and webAssociationEnd2.association = webAssociation; unidirectional ; mapping umlAssociationEnd.type.name <~> webAssociationEnd2.name; umlAssociationEnd.composition <~> webAssociationEnd2.composition; umlAssociationEnd.type <~> webAssociationEnd2.type.oclAsType(Web::WebDataClass); umlAssociationEnd.type <~> webAssociationEnd1.class.oclAsType(Web::WebDataClass); umlAssociationEnd.association.name <~> webAssociationEnd1.name; umlAssociationEnd.association <~> webAssociationEnd1.type.oclAsType(Web::WebDataClass); umlAssociationEnd.association <~> webAssociationEnd2.class.oclAsType(Web::WebDataClass); }
-
If we cross different Web data schemas, we only need an association end pointing out of the Web data schema to an EJB key class. This rule formalizes a part of rule 4 in section 5.3.1.
Transformation UMLAssociationClassEndToWebAssociation(UML, Web) { source umlAssociationEnd : UML::AssociationEnd; target webAssociationEnd2 : Web::WebAssociationEnd; source condition umlAssociationEnd.upper<>1 and umlAssociationEnd.association.oclIsTypeOf(UML::AssociationClass) and not umlAssociationEnd.association.getOuterMostContainer() = umlAssociationEnd.type.getOuterMostContainer(); target condition webAssociationEnd2.lower = 1 and webAssociationEnd2.upper = 1; unidirectional ; mapping umlAssociationEnd.type.name <~> webAssociationEnd2.name; umlAssociationEnd.composition <~> webAssociationEnd2.composition; umlAssociationEnd.type <~> webAssociationEnd2.type.oclAsType(EJB::EJBKeyClass); umlAssociationEnd.association <~> webAssociationEnd2.class.oclAsType(Web::WebDataClass); }
-
An Operation in UML becomes a Web action in the Web model. This rule formalizes a part of rule 6 in section 5.3.1.
Transformation UMLOperationToBusinessMethod(UML, Web) { source umlOperation : UML::Operation; target webAction : Web::WebAction; unidirectional ; mapping umlOperation.name <~> webAction.name; umlOperation.parameter <~> webAction.parameter; }
-
UML Parameters are transformed into Web Parameters. This rule formalizes another part of rule 6 in section 5.3.1.
Transformation UMLParameterToWebParameter(UML, Web) { source umlParameter : UML::Parameter; target webParameter : Web::WebParameter; unidirectional ; mapping umlParameter.name <~> webParameter.name; umlParameter.type <~> webParameter.type; }
Analogous to the UML to EJB transformation, we need to transform UML data types to Web data types. This transformation is not defined here, but there should be a number of (predefined) transformations at the lowest level of UML to Web data types. The definition below simply states that there must be such a transformation from UML to Web data types.