Home » Modeling » UML2 » Static Profiles with OCL Integration possible?
Static Profiles with OCL Integration possible? [message #478476] |
Tue, 02 June 2009 14:30 |
Timothy Marc Messages: 547 Registered: July 2009 |
Senior Member |
|
|
Hey all,
i've created a static profile with success and now, i've tried to enable
the automatically OCL integration for the profile. Well, by using the
origin UML model as input for the Genmodel of the profile, the necessary
OCL statements are generated, but when i apply the profile to a model
and violate the constraint, the violation won't be found.
I've done this with a normal ecore instance (not an UML profile) and it
worked as it should be, so that i'm sure, that depends on the profile
nature of the model. Will the OCL integration by recognized by the
default UML tree editor?
Here is the generated code:
public boolean weightening(DiagnosticChain diagnostics, Map<Object,
Object> context) {
if (WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(MiscellaneousProfilePackage.Literals.WEIGH T);
try {
WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EOCL_INV =
helper.createInvariant(WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EO CL_EXP);
}
catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if
(!EOCL_ENV.createQuery(WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EO CL_INV).check(this))
{
if (diagnostics != null) {
diagnostics.add
(new BasicDiagnostic
(Diagnostic.ERROR,
MiscellaneousProfileValidator.DIAGNOSTIC_SOURCE,
MiscellaneousProfileValidator.WEIGHT__WEIGHTENING,
EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic ",
new Object[] { "weightening", EObjectValidator.getObjectLabel(this,
context) }),
new Object [] { this }));
}
return false;
}
return true;
}
Regards Timothy
|
|
|
Re: Static Profiles with OCL Integration possible? [message #478479 is a reply to message #478476] |
Tue, 02 June 2009 20:40 |
Timothy Marc Messages: 547 Registered: July 2009 |
Senior Member |
|
|
Okay,
rowing back @all :-)
I think, i mixed two things. I've forgotten, that the UML2 project
itselt has no relationship to the OCL project. The usage of OCL in the
way, i've posted before, is only done during the code generation of the
EMF framework...
Sorry, i think, i had to go earlier to bed ;-)
Regards Timothy
Timothy Marc schrieb:
> Hey all,
>
> i've created a static profile with success and now, i've tried to enable
> the automatically OCL integration for the profile. Well, by using the
> origin UML model as input for the Genmodel of the profile, the necessary
> OCL statements are generated, but when i apply the profile to a model
> and violate the constraint, the violation won't be found.
>
> I've done this with a normal ecore instance (not an UML profile) and it
> worked as it should be, so that i'm sure, that depends on the profile
> nature of the model. Will the OCL integration by recognized by the
> default UML tree editor?
>
> Here is the generated code:
>
> public boolean weightening(DiagnosticChain diagnostics, Map<Object,
> Object> context) {
> if (WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
> OCL.Helper helper = EOCL_ENV.createOCLHelper();
> helper.setContext(MiscellaneousProfilePackage.Literals.WEIGH T);
> try {
> WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EOCL_INV =
> helper.createInvariant(WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EO CL_EXP);
> }
> catch (ParserException pe) {
> throw new
> UnsupportedOperationException(pe.getLocalizedMessage());
> }
> }
> if
> (!EOCL_ENV.createQuery(WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EO CL_INV).check(this))
> {
> if (diagnostics != null) {
> diagnostics.add
> (new BasicDiagnostic
> (Diagnostic.ERROR,
> MiscellaneousProfileValidator.DIAGNOSTIC_SOURCE,
> MiscellaneousProfileValidator.WEIGHT__WEIGHTENING,
>
> EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic ", new
> Object[] { "weightening", EObjectValidator.getObjectLabel(this, context)
> }),
> new Object [] { this }));
> }
> return false;
> }
> return true;
> }
>
> Regards Timothy
|
|
|
Re: Static Profiles with OCL Integration possible? [message #627657 is a reply to message #478476] |
Tue, 02 June 2009 20:40 |
Timothy Marc Messages: 547 Registered: July 2009 |
Senior Member |
|
|
Okay,
rowing back @all :-)
I think, i mixed two things. I've forgotten, that the UML2 project
itselt has no relationship to the OCL project. The usage of OCL in the
way, i've posted before, is only done during the code generation of the
EMF framework...
Sorry, i think, i had to go earlier to bed ;-)
Regards Timothy
Timothy Marc schrieb:
> Hey all,
>
> i've created a static profile with success and now, i've tried to enable
> the automatically OCL integration for the profile. Well, by using the
> origin UML model as input for the Genmodel of the profile, the necessary
> OCL statements are generated, but when i apply the profile to a model
> and violate the constraint, the violation won't be found.
>
> I've done this with a normal ecore instance (not an UML profile) and it
> worked as it should be, so that i'm sure, that depends on the profile
> nature of the model. Will the OCL integration by recognized by the
> default UML tree editor?
>
> Here is the generated code:
>
> public boolean weightening(DiagnosticChain diagnostics, Map<Object,
> Object> context) {
> if (WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
> OCL.Helper helper = EOCL_ENV.createOCLHelper();
> helper.setContext(MiscellaneousProfilePackage.Literals.WEIGH T);
> try {
> WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EOCL_INV =
> helper.createInvariant(WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EO CL_EXP);
> }
> catch (ParserException pe) {
> throw new
> UnsupportedOperationException(pe.getLocalizedMessage());
> }
> }
> if
> (!EOCL_ENV.createQuery(WEIGHTENING__DIAGNOSTIC_CHAIN_MAP__EO CL_INV).check(this))
> {
> if (diagnostics != null) {
> diagnostics.add
> (new BasicDiagnostic
> (Diagnostic.ERROR,
> MiscellaneousProfileValidator.DIAGNOSTIC_SOURCE,
> MiscellaneousProfileValidator.WEIGHT__WEIGHTENING,
>
> EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic ", new
> Object[] { "weightening", EObjectValidator.getObjectLabel(this, context)
> }),
> new Object [] { this }));
> }
> return false;
> }
> return true;
> }
>
> Regards Timothy
|
|
|
Goto Forum:
Current Time: Thu Apr 25 09:54:05 GMT 2024
Powered by FUDForum. Page generated in 0.03036 seconds
|