eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[UML] Support pre and postconditions for UML::activities #1443

Open eclipse-ocl-bot opened 1 month ago

eclipse-ocl-bot commented 1 month ago

| --- | --- | | Bugzilla Link | 458576 | | Status | NEW | | Importance | P3 normal | | Reported | Jan 27, 2015 15:11 EDT | | Modified | May 21, 2015 08:21 EDT | | Depends on | 457627 | | Reporter | Klaas Gadeyne |

Description

Created attachment 250276\ Demonstrates the bug/feature request

Version: OCL Examples and Editors SDK 3.4.3.v20141123-1844

From OCL spec 2.4, Section 7.3.4 \ The OCL expression can be part of a Precondition or Postcondition, corresponding to «precondition» and «postcondition» stereotypes of Constraint associated with an Operation or other behavioral feature. The contextual instance self then is an instance of the type that owns the operation or method as a feature.

Consider the papyrus model in attach [*]\ It contains a class that has both an ownedOperation and an ownedActivity.\ Trying to specify a preCondition for the activity results in the following parsing error (for the operation this works fine)

Error "Parsing error for model::Class1::Activity1::Act1PreCondition::realInput <> 0.0:\ No containing resource for realInput <> 0.0" realInput <> 0.0 model::Class1::Activity1::Act1PreCondition EMF Problem

[*] I'm guessing this is an MDT/OCL problem, not a papyrus one. Feel free to redirect if necessary :-)

:compression: ActivityPreConditionTest.zip

eclipse-ocl-bot commented 1 month ago

By Ed Willink on Jan 27, 2015 17:28

Two errors with fuller messages on current code:

"Parsing error for model::Class1::Activity1::Act1PreCondition::realInput <> 0.0: Failed to load 'platform:/resource/Activity/Bug458576/BehaviorPrePostConditions.uml.oclas' : org.eclipse.ocl.pivot.uml.internal.es2as.UML2ASDeclarationSwitch cannot be cast to org.eclipse.ocl.pivot.Element"

No pivot for model::Class1::Operation1::Op1PreCondition::realInput <> 0.0

eclipse-ocl-bot commented 1 month ago

By Ed Willink on Jan 27, 2015 17:49

Simple unhelpful response. Activity diagrams are not yet supported.

The problem is that parsed Constraints use the normalized pivot representation, but not all UML elements have Pivot counterparts. There is a DynamicBehavior that tries to catch leftovers but it doesn't distinguish Constraint children as a result the Pivot constraints are orphans causing lack of context.

Bug 457627 provides a much more promising way forward.

eclipse-ocl-bot commented 1 month ago

By Klaas Gadeyne on May 20, 2015 11:00

Hi Ed,

(In reply to Ed Willink from comment #2)

Simple unhelpful response. Activity diagrams are not yet supported.

unhelpful but informative :-)\

The problem is that parsed Constraints use the normalized pivot representation, but not all UML elements have Pivot counterparts. There is a DynamicBehavior that tries to catch leftovers but it doesn't distinguish Constraint children as a result the Pivot constraints are orphans causing lack of context.

Regarding this, I have a question which is maybe slightly out-of-context of this bug, but then again quite related:

Given the fact that uml::activity generalizes uml::class, it is 'theoretically' possible [*][**] to add attributes (not parameters) to activities and to create invariants for these activities which are not pre and post-conditions.

In that sense, a 'first step' towards constraints for UML activities could be to map them on the Pivot counterparts for a UML class, right? This would still not allow to support pre- and postconditions, but 'class invariants' would be possible in this way.

Bug 457627 provides a much more promising way forward.

[*] The SysML 1.4 specification is a lot more explicit about this for instance by defining the AdjunctProperty stereotype\ [**] However, the OCL specification does not mention this possibility explicitly