Bug 163556 - Profiles definition
Summary: Profiles definition
Status: VERIFIED FIXED
Alias: None
Product: MDT.UML2
Classification: Modeling
Component: Core (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: M6   Edit
Assignee: Kenn Hussey CLA
QA Contact:
URL:
Whiteboard: Community Support
Keywords: contributed, plan
Depends on:
Blocks:
 
Reported: 2006-11-06 11:44 EST by Chokri Mraidha CLA
Modified: 2013-02-25 11:28 EST (History)
7 users (show)

See Also:
Kenn.Hussey: kepler+


Attachments
model changes (239.84 KB, patch)
2007-03-25 15:29 EDT, James Bruck CLA
no flags Details | Diff
Non-ui changes (26.24 KB, patch)
2007-03-25 23:18 EDT, James Bruck CLA
no flags Details | Diff
model only changes (239.88 KB, patch)
2007-03-26 12:23 EDT, James Bruck CLA
no flags Details | Diff
merged patch. (58.43 KB, patch)
2007-03-26 16:44 EDT, James Bruck CLA
Kenn.Hussey: iplog+
Details | Diff
changes to package operation (4.64 KB, patch)
2007-04-03 18:05 EDT, James Bruck CLA
Kenn.Hussey: iplog+
Details | Diff
UI enhancements. (28.13 KB, patch)
2007-04-04 23:17 EDT, James Bruck CLA
no flags Details | Diff
UI enhancements with ecore updates (33.05 KB, patch)
2007-04-05 00:12 EDT, James Bruck CLA
Kenn.Hussey: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chokri Mraidha CLA 2006-11-06 11:44:09 EST
Add option to profile definition which would indicate whether dependencies should or should not be made to the metadata from other profiles (the default would be not to). It would be useful to add arguments to the Profile#define() method that would allow a diagostic chain and/or options to be specified.
Comment 1 Kenn Hussey CLA 2007-01-26 17:11:24 EST
Note that automatic migration of profile data may need to be revisited to account for the fact that the metadata for classifiers could be in referenced profiles. One approach to consider would be to change the metadata for existing instances instead of creating new instances and copying the data - this should improve footprint and performance of profile migration significantly.
Comment 2 Dusko CLA 2007-03-07 11:30:27 EST
Please note that stereotypes are special case. Here is an example. Create two profiles "P1" (with stereotype "S1") and "P2" (with stereotype "S2"). Add property "a" of type "S1" (essentially create association between "S2" and "S1") to "S2".

Currently, define(...) call on "P2" will create EClass for "S1" and use that as type of "a". That makes "a" useless because applying S1 to some element is going to create stereotype application (dynamic EObject) using EClass for S1 defined in P1, not one from P2. You essentially cannot reference those objects because they are of wrong type. That implies that metadata for stereotypes should always be referenced and not recreated. The current situation limits such associations to stereotypes in the same profile. Note: Even for the classifiers I don't think it would do to have a single Boolean parameter. The option should be more fine grained.

Also, this problem cannot be fixed only on the Profile#define(...) side - there is issue on the profile migration side as well (Package#applyProfile(...). Lets assume that above example works or that "S1" and "S2" are from the same profile. Now apply "S1" to an element in model "M1". Apply "S2" to an element in model "M2". Set value of "a" in the second stereotype application to reference "S1" stereotype application in the model "M1". Make some change to profile(s) and re-define them. Migrate the profile in "M1". That migration is going to remove existing stereotype application object and re-create it, with new ID. The reference in "M2" is broken and cannot be fixed. Even if you go there and migrate profile (call applyProfile) it will remain broken.
Comment 3 James Bruck CLA 2007-03-07 12:18:44 EST
It sounds as if passing a new option to define() to indicate whether we should referenced vs. recreated is not fine grain enough.  From my understanding we would need the ability to tag specific objects in existing profile/models as having the ability of being referenced vs. recreated.

Are we all in agreement on that?
I can still update the define(..) method to pass options for robustness but I question whether adding a new option as mentioned above is really sufficient.


Also,
The applyStereotype() would probably have to be changed to not remove existing setreotype applications but rather, change the Eclass to point to the new one and remove unapplicable values thereby preserving existing ID's.

I think we all agree on that.
Comment 4 Dave Carlson CLA 2007-03-20 13:51:41 EDT
Copying part of a discussion thread from UML2 newsgroup.  Profile migration should allow for changes to extension metaclass and not attempt to copy all "base_*" properties.

It would be very helpful if the log message were more concise and more helpful than a complete NPE stack trace.  E.g. a message:

<stereotype::property> does not exist in profile: <name> version <x>.

I migrated the profile version for a relatively small model, and my log file contained 340K of completely redundant (and mostly useless) stack traces for the same null pointer... 

> In my profile, I 
> modified a stereotype that previously extended Classifier, so that it 
> instead extends both Class and DataType.  The reason is that UML editors 
> (e.g. RSA 7) offer the stereotype on too many other Classifiers where it 
> is not applicable.  This change causes a NullPointerException when 
> migrating a model from the previous version of the profile (the 
> base_Classifier eReference is missing).  I expected this to be OK because 
> the base_Class and base_DataType properties in the new Stereotype version 
> are filled when the stereotype is created.
>
> This raises a question about the expected/desirable behavior when 
> migrating to a new profile version.  Should properties removed from the 
> stereotype be silently ignored when copying data to the new stereotype, 
> instead of throwing NPE?
>
Comment 5 James Bruck CLA 2007-03-25 15:29:06 EDT
Created attachment 61933 [details]
model changes

Changes to the metamodel to accomodate new profile#define signature.
This is the first of several patches.
Comment 6 James Bruck CLA 2007-03-25 23:18:17 EDT
Created attachment 61947 [details]
Non-ui changes

Partial solution.  Does not include changes to Stereotype copier or dialog changes.
Comment 7 James Bruck CLA 2007-03-26 12:23:19 EDT
Created attachment 61988 [details]
model only changes
Comment 8 Christian Damus CLA 2007-03-26 16:01:03 EDT
On the subject of Profile::define() options, can we add one also to suppress the creation of validation operations, e.g.,

   xyz(diagnostics : EDiagnosticChain,
       context : Map<EJavaObject,EJavaObject>) : EBoolean

from ownedRule Constraints of a Stereotype (or other Classifiers in profiles)?

I think sensible defaults for this option may be:
  - suppress constraints for dynamic profiles (EOperations aren't useful
    in dynamic EMF)
  - enable constraints for static profiles (developer can fill in the
    constraint method bodies)
Comment 9 James Bruck CLA 2007-03-26 16:44:42 EDT
Created attachment 62022 [details]
merged patch.

missing changes to stereotype copier, but including ui changes.
Comment 10 James Bruck CLA 2007-03-27 17:27:18 EDT
The last patch will have to be redone with new merged changes.  Please hold off adopting just yet.
Comment 11 James Bruck CLA 2007-04-03 18:05:53 EDT
Created attachment 62842 [details]
changes to package operation

1. preserve the id of the stereotype application
2. consider any profile when looking for definition.

does not include improved error recovery.
Comment 12 James Bruck CLA 2007-04-04 23:17:03 EDT
Created attachment 63000 [details]
UI enhancements.
Comment 13 James Bruck CLA 2007-04-05 00:12:55 EDT
Created attachment 63001 [details]
UI enhancements with ecore updates
Comment 14 Kenn Hussey CLA 2007-04-05 01:09:30 EDT
Changes to add an options dialog for profile definition and new options to process comments/documentation have been committed to CVS. Further changes will be done for M7.
Comment 15 Kenn Hussey CLA 2007-04-17 15:42:18 EDT
A change has been committed to ensure that XMI identifiers are preserved during stereotype application migration.
Comment 16 Kenn Hussey CLA 2007-05-08 16:09:13 EDT
The remainder of the work for this feature (i.e. adding the option to specify whether metadata dependencies should be copied and addressing the related profile migration issues) is deferred to a future release.
Comment 17 Kenn Hussey CLA 2007-05-23 15:41:23 EDT
Regarding comment #4, target properties that cannot be found (e.g. because they have been removed or renamed) during profile migration are now silently ignored as a result of the changes for bug 178250.
Comment 18 James Bruck CLA 2007-10-05 10:54:21 EDT
P659 of the spec talks about this issue.

It mentions ...
Stereotypes can participate in associations. The opposite class can be another stereotype, a non-stereotype class that is
owned by a profile, or a metaclass of the reference metamodel. For these associations there must be a property owned by
the Stereotype to navigate to the opposite class. The opposite property must be owned by the Association itself rather than
the other class/metaclass.
Comment 19 Kenn Hussey CLA 2013-02-24 19:26:58 EST
The changes for a new profile definition option to support "foreign definitions" have been committed and pushed to the 'master' branch in git.

These changes will support even the scenarios described by Dusko in comment #2, provided that both the referring and referenced models/profiles are loaded into the same resource set and modified/saved at the same time; the NPEs that Dave complained about in comment #4 have also been replaced by IllegalStateExceptions with appropriate messages.

Of course, one must be careful with this option, as it allows creation of dependencies between different (versions of) profile metadata in different profiles. Particular care must be used when creating generalization relationships that span profiles and when defining and applying new versions of classes and stereotypes independently of models and/or profiles that may be referencing them.
Comment 20 Kenn Hussey CLA 2013-02-25 11:28:30 EST
An integration build containing these changes is now available.