Replace Section 8.1.13 with the following text to be placed
before the current 8.1.12.
8.1.12 Mapping Overloading
Invocation of a mapping selects a disjunction of one or more
candidate mappings at compile time. At run-time, the
first matching candidate mapping is selected and
invoked. The disjunction may be specified explicitly using the
disjuncts keyword or implicitly by an overloaded
mapping.
8.1.12.1 Explicit Disjuncts
In the following example, the explicit disjunction defines convertFeature
as a disjuncting mapping name that may be invoked on
a UML::Feature with a Boolean argument. convertAttribute,
convertConstructor and convertOperation are
candidate mapping names.
mapping UML::Feature::convertFeature(asUpper: Boolean) : JAVA::Element
disjuncts convertAttribute, convertOperation, convertConstructor {}
mapping UML::Attribute::convertAttribute(asUpper: Boolean) : JAVA::Field {
name := if asUpper then name.toUpper() else name endif;
}
mapping UML::Operation::convertConstructor(asUpper: Boolean) : JAVA::Constructor
when {self.name = self.namespace.name;} {
name := if asUpper then name.toUpper() else name endif;
}
mapping UML::Operation::convertOperation(asUpper: Boolean) : JAVA::Constructor
when {self.name <> self.namespace.name;} {
name := if asUpper then name.toUpper() else name endif;
}
The explicit disjuncts causes the mapping
invocation to successively assess the implicit and explicit
predicates of convertAttribute, convertConstructor
and convertOperation to identify the first match. If
no match is found the mapping invocation returns null.
The explicit predicates are provided by arbitrary constraints
specified in when clauses. Implicit predicates are
provided by the type signatures; each source and argument must
conform to the type of the disjuncting mapping. An
abstract mapping has a false implicit predicate; an
abstract mapping cannot be executed.
The candidate return type must be covariant, that
is the same as, or derived from that of, the disjuncting
return type to ensure that no result incompatibility arises.
Since the argument types contribute to implicit predicates,
the candidate argument types may be supertypes or
subtypes of the disjuncting mapping. The number of candidate
and disjuncting argument types must be the same.
An explicit candidate mapping is identified by its
mapping identifier which identifier may contribute to more
than one disjunction.
8.1.12.2 Implicit Disjuncts
An implicit disjunction groups overloaded mappings. One
mapping overloads another when the overloading source type
extends the overloaded source type and when the overloading
and overloaded mappings have same name and argument count.
When UML::Attrbute and UML::Operation
extend UML::Feature, the previous example may be
simplified to use an implicit disjunction.
mapping UML::Feature::convertFeature(asUpper: Boolean) : JAVA::Element {}
mapping UML::Attribute::convertFeature(asUpper: Boolean) : JAVA::Field {
name := if asUpper then name.toUpper() else name endif;
}
mapping UML::Operation::convertFeature(asUpper: Boolean) : JAVA::Constructor
when {self.name = self.namespace.name;} {
name := if asUpper then name.toUpper() else name endif;
}
mapping UML::Operation::convertFeature(asUpper: Boolean) : JAVA::Constructor
when {self.name <> self.namespace.name;} {
name := if asUpper then name.toUpper() else name endif;
}
he explicit disjuncts provides distinct names and so
facilitates explicit calls direct to the candidate
mappings. The implicit disjuncts requires no disjuncting
declaration and so faciltates extension by addition of further
contributions.
8.1.12.3 Disjunct candidates
All mappings with the required name, argument and matching or
derived source type are candidate mappings for the
invocation of a disjuncting mapping. This includes
mappings inherited from extended transformations. The candidate
mappings referenced in a disjuncting mapping may
introduce new names and consequently a further disjunction of
candidate mappings; the explicit disjunct is
transitive.
For instance invocation of convertFeature for a Property
in the explicit disjuncts example should consider a Property::convertOperation(Boolean)
inherited from an extended transformation since the explicit
disjunct adds convertOperation to the transitive
candidates. Conversely, the implicit disjunct example
considers only candidates whose signature is convertFeature(Boolean).
For non-strict evaluation, a deterministic evaluation order
for evaluation of the predicates of the candidates as guards
is established by sorting using the following proritized
criteria. A distinction by an earlier criteria overrules all
later criteria.
- directly invoked explicitly disjuncted candidate mappings
are evaluated in declaration order
- mappings in the current transformation are evaluated
before those in an extended transformation, then mappings in
an extended transformation before those in an extended
extended transformation, and so forth
- mappings for a more derived type are executed before those
for a less derived type
- mappings are prioritized by alphabetical mapping name
order
- mappings are prioritized by alphabetical context type name
order
- mappings are prioritized by alphabetical context type
containing package name order, then by containing package
containing package name order, and so forth
The ordering above ensures that an extending transformation
can occlude a mapping in an extended transformation and that a
mapping for a derived type occludes that for a base type. An
implementation may use static analysis of the predicates to
eliminate occluded candidates completely and to provide
reduced candidate lists according to the source type of the
mapping invocation.
For strict evaluation, the same ordering applies but the
first candidate for which the source type conforms is selected
without evaluating the predicate as a guard. The predicate is
instead evaluated as a pre-condition giving a null
return when not satisfied.
In the QVTo model and Fig 8.3. Add