Home » Modeling » UML2 » packagedElement opposite?
|
Re: packagedElement opposite? [message #476195 is a reply to message #476022] |
Mon, 24 September 2007 16:32 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi,
OCL (and hence, by extension, QVT) can navigate association ends that aren't
navigable and even some that don't have names.
For OCL, the implicit opposite of Package::packagedElement is
PackageableElement::package which, because "package" is a reserved word in
OCL, would be referenced as _package. (The name "package" is obtained by
taking the name of the class at the unnamed end -- Package -- and changing
the initial letter to lower case.)
I would expect, then, that in QVT you should be able to do:
enforce domain forward comp : uml::Component {
_package = boundPackage,
name = 'Business Component'
};
"owner" is derived, so it makes sense that it not me modifiable, but
packagedElement is not derived, so the implied opposite "package" would
likewise be modifiable.
Cheers,
Christian
exquisitus wrote:
> I wonder why there is no opposite (and changeable) feature of
> "packagedElement" im UML2.
> This makes it very hard to use this UML2 metamodel in e.g. QVT
> transformations, in contrast to UML1.x.
>
> E.g. I can use "packagedElement" like this
>
>
> enforce domain forward boundPackage: uml::Package {
> packagedElement = comp : uml::Component {
> name = 'Business Component'
> }
> };
>
>
>
> to insert a component into a package.
>
>
> However this would be the ideal solution (only one
> ObjectTemplateExpression):
>
>
> enforce domain forward comp : uml::Component {
> owner = boundPackage,
> name = 'Business Component'
> };
>
> Though the QVT "workaround" is not so dramatic in this example, in other
> examples I have to use additionally new relation domains and
> when-conditions, so inexistent opposite features is really annoying when
> programming QVT.
>
>
> Is it a good idea to perhaps modify the UML.ecore, add the opposite
> "owner" feature on myself, regenerate model code and still expect that
> the UML2 Tools editors can work with it (well I already tried, but my
> Eclipse crashed)? However I do not aim an official UML2 specification
> change..
>
>
> Or any other idea?
|
|
| |
Re: packagedElement opposite? [message #476220 is a reply to message #476219] |
Tue, 25 September 2007 22:19 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi,
The UML metamodel defines the Package --> PackageableElement relationship as
a directed association. The Package end is named "packagedElement" and the
PackageableElement end is not navigable and has no name.
OCL handles this kind of situation by:
- being able to navigate non-navigable association ends
- being able to refer to unnamed association ends via an implicit name
The implicit name of the unnamed end is taken from the classifier at the
opposite end (in this case, "Package") and changing the initial letter to
lower case, thus "package".
Ecore (and EMOF) does not have an association concept, so this capability of
OCL does not apply to EssentialOCL nor to OCL on Ecore. It does apply to
UML, and the MDT UML2 API is generated from UML.merged.uml, not from
UML.ecore. In other words, UML2's metamodel is UML, not Ecore. So, this
should work once MDT OCL implements support for unnamed ends in the M3
milestone.
HTH,
Christian
exquisitus wrote:
>
>> Hi,
>>
>> OCL (and hence, by extension, QVT) can navigate association ends that
>> aren't navigable and even some that don't have names.
>>
>> For OCL, the implicit opposite of Package::packagedElement is
>> c::package
>
> Where do you have the information that "package" is the opposite of
> packagedElement? I do not find an opposite in UML.ecore (there is no
> eOpposite attribute).
|
|
|
Re: packagedElement opposite? [message #624948 is a reply to message #476022] |
Mon, 24 September 2007 16:32 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi,
OCL (and hence, by extension, QVT) can navigate association ends that aren't
navigable and even some that don't have names.
For OCL, the implicit opposite of Package::packagedElement is
PackageableElement::package which, because "package" is a reserved word in
OCL, would be referenced as _package. (The name "package" is obtained by
taking the name of the class at the unnamed end -- Package -- and changing
the initial letter to lower case.)
I would expect, then, that in QVT you should be able to do:
enforce domain forward comp : uml::Component {
_package = boundPackage,
name = 'Business Component'
};
"owner" is derived, so it makes sense that it not me modifiable, but
packagedElement is not derived, so the implied opposite "package" would
likewise be modifiable.
Cheers,
Christian
exquisitus wrote:
> I wonder why there is no opposite (and changeable) feature of
> "packagedElement" im UML2.
> This makes it very hard to use this UML2 metamodel in e.g. QVT
> transformations, in contrast to UML1.x.
>
> E.g. I can use "packagedElement" like this
>
>
> enforce domain forward boundPackage: uml::Package {
> packagedElement = comp : uml::Component {
> name = 'Business Component'
> }
> };
>
>
>
> to insert a component into a package.
>
>
> However this would be the ideal solution (only one
> ObjectTemplateExpression):
>
>
> enforce domain forward comp : uml::Component {
> owner = boundPackage,
> name = 'Business Component'
> };
>
> Though the QVT "workaround" is not so dramatic in this example, in other
> examples I have to use additionally new relation domains and
> when-conditions, so inexistent opposite features is really annoying when
> programming QVT.
>
>
> Is it a good idea to perhaps modify the UML.ecore, add the opposite
> "owner" feature on myself, regenerate model code and still expect that
> the UML2 Tools editors can work with it (well I already tried, but my
> Eclipse crashed)? However I do not aim an official UML2 specification
> change..
>
>
> Or any other idea?
|
|
| |
Re: packagedElement opposite? [message #625008 is a reply to message #476219] |
Tue, 25 September 2007 22:19 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi,
The UML metamodel defines the Package --> PackageableElement relationship as
a directed association. The Package end is named "packagedElement" and the
PackageableElement end is not navigable and has no name.
OCL handles this kind of situation by:
- being able to navigate non-navigable association ends
- being able to refer to unnamed association ends via an implicit name
The implicit name of the unnamed end is taken from the classifier at the
opposite end (in this case, "Package") and changing the initial letter to
lower case, thus "package".
Ecore (and EMOF) does not have an association concept, so this capability of
OCL does not apply to EssentialOCL nor to OCL on Ecore. It does apply to
UML, and the MDT UML2 API is generated from UML.merged.uml, not from
UML.ecore. In other words, UML2's metamodel is UML, not Ecore. So, this
should work once MDT OCL implements support for unnamed ends in the M3
milestone.
HTH,
Christian
exquisitus wrote:
>
>> Hi,
>>
>> OCL (and hence, by extension, QVT) can navigate association ends that
>> aren't navigable and even some that don't have names.
>>
>> For OCL, the implicit opposite of Package::packagedElement is
>> c::package
>
> Where do you have the information that "package" is the opposite of
> packagedElement? I do not find an opposite in UML.ecore (there is no
> eOpposite attribute).
|
|
|
Goto Forum:
Current Time: Thu Apr 25 05:56:29 GMT 2024
Powered by FUDForum. Page generated in 0.04068 seconds
|