From 12cb8f6e2e979c5ca3791d0f9520b379f4d3a1a5 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Tue, 10 Feb 2026 18:21:36 +0100 Subject: [PATCH 01/26] #683 CifContext: add `isActivityRequirement` method --- .../tno/synthml/uml/profile/cif/CifContext.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java index 729c946ef..89f5cb4cc 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java @@ -21,15 +21,18 @@ import org.eclipse.uml2.uml.Constraint; import org.eclipse.uml2.uml.ControlFlow; import org.eclipse.uml2.uml.DataType; +import org.eclipse.uml2.uml.DurationConstraint; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Enumeration; import org.eclipse.uml2.uml.EnumerationLiteral; +import org.eclipse.uml2.uml.InteractionConstraint; import org.eclipse.uml2.uml.IntervalConstraint; import org.eclipse.uml2.uml.Model; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.OpaqueBehavior; import org.eclipse.uml2.uml.PrimitiveType; import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.TimeConstraint; import com.github.tno.synthml.uml.profile.util.PokaYokeTypeUtil; @@ -276,6 +279,16 @@ public static boolean isPrimitiveTypeConstraint(Constraint constraint) { return constraint.getContext() instanceof PrimitiveType; } + public static boolean isActivityRequirement(Constraint constraint) { + return constraint.getContext() instanceof Activity activity + // It is the correct type of constraint. + && !(constraint instanceof DurationConstraint) && !(constraint instanceof InteractionConstraint) + && !(constraint instanceof IntervalConstraint) && !(constraint instanceof TimeConstraint) + // It is neither a precondition nor a postcondition. + && !activity.getPreconditions().contains(constraint) + && !activity.getPostconditions().contains(constraint); + } + default boolean hasAbstractActivities() { return getDeclaredElements().stream().anyMatch(e -> e instanceof Activity a && a.isAbstract()); } From 58705a86aa483d562c0b97d0353ce85016f1e35f Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Tue, 10 Feb 2026 18:22:13 +0100 Subject: [PATCH 02/26] #683 PokaYokeProfileValidator: allow activity requirement constraints UmlToCifTranslator: translate activity requirements --- .../pokayoke/transform/uml2cif/UmlToCifTranslator.java | 8 ++++++++ .../profile/validation/PokaYokeProfileValidator.java | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java index e7aba0374..025ab1ea9 100644 --- a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java +++ b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java @@ -1656,10 +1656,18 @@ private List createDisableEventsWhenDoneRequirements() { private List translateRequirements() { List cifInvariants = new ArrayList<>(); + // Translate class requirements. for (Constraint umlConstraint: activity.getContext().getOwnedRules()) { cifInvariants.addAll(translateRequirement(umlConstraint)); } + // Translate activity requirements. + for (Constraint umlConstraint: activity.getOwnedRules()) { + if (CifContext.isActivityRequirement(umlConstraint)) { + cifInvariants.addAll(translateRequirement(umlConstraint)); + } + } + return cifInvariants; } diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index 8761f5afb..9f56bb403 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -544,8 +544,12 @@ private void checkValidActivity(Activity activity) { .filter(IntervalConstraint.class::isInstance).map(IntervalConstraint.class::cast) .collect(Collectors.toCollection(LinkedHashSet::new)); - if (!members.equals(Sets.union(preAndPostconditions, intervalConstraints))) { - error("Activity should contain only precondition, postcondition, and interval constraint members.", + Set activityRequirements = activity.getOwnedRules().stream() + .filter(r -> CifContext.isActivityRequirement(r)).map(Constraint.class::cast) + .collect(Collectors.toCollection(LinkedHashSet::new)); + + if (!members.equals(Sets.union(Sets.union(preAndPostconditions, intervalConstraints), activityRequirements))) { + error("Activity should contain only precondition, postcondition, constraints and interval constraint members.", UMLPackage.Literals.NAMESPACE__MEMBER); } @@ -1003,7 +1007,7 @@ private void checkValidConstraint(Constraint constraint) { if (CifContext.isActivityPrePostconditionConstraint(constraint)) { checkValidActivityPrePostconditionConstraint(constraint); - } else if (CifContext.isClassConstraint(constraint)) { + } else if (CifContext.isClassConstraint(constraint) || (CifContext.isActivityRequirement(constraint))) { checkValidClassConstraint(constraint); } else if (CifContext.isOccurrenceConstraint(constraint)) { checkValidOccurrenceConstraint((IntervalConstraint)constraint); From 6fe4ef63e0418538e367d2b5f1b98ef32fe7778f Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Tue, 10 Feb 2026 18:23:15 +0100 Subject: [PATCH 03/26] #683 PokaYokeProfileValidator: rename method --- .../uml/profile/validation/PokaYokeProfileValidator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index 9f56bb403..4789a33c3 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -1008,7 +1008,7 @@ private void checkValidConstraint(Constraint constraint) { if (CifContext.isActivityPrePostconditionConstraint(constraint)) { checkValidActivityPrePostconditionConstraint(constraint); } else if (CifContext.isClassConstraint(constraint) || (CifContext.isActivityRequirement(constraint))) { - checkValidClassConstraint(constraint); + checkValidClassOrActivityConstraint(constraint); } else if (CifContext.isOccurrenceConstraint(constraint)) { checkValidOccurrenceConstraint((IntervalConstraint)constraint); } else if (CifContext.isPrimitiveTypeConstraint(constraint)) { @@ -1062,7 +1062,7 @@ private void checkValidActivityPrePostconditionConstraint(Constraint constraint) } } - private void checkValidClassConstraint(Constraint constraint) { + private void checkValidClassOrActivityConstraint(Constraint constraint) { // Check that the constraint has the right stereotype applied. List stereotypes = constraint.getAppliedStereotypes(); From 212a07b2a8557aa3b6c9751b16a6de15a1af688e Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 11 Feb 2026 10:38:38 +0100 Subject: [PATCH 04/26] #683 PokaYokeUmlProfileUtil, PokaYokeProfileValidator: rename stereotype --- .../uml/profile/util/PokaYokeUmlProfileUtil.java | 11 +++++------ .../profile/validation/PokaYokeProfileValidator.java | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java index d740993cb..48b3172be 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java @@ -82,7 +82,7 @@ public class PokaYokeUmlProfileUtil { private static final String ST_FORMAL_CONSTRAINT = SynthMLPackage.Literals.FORMAL_CONSTRAINT.getName(); - public static final String ST_CLASS_REQUIREMENT = SynthMLPackage.Literals.REQUIREMENT.getName(); + public static final String ST_REQUIREMENT = SynthMLPackage.Literals.REQUIREMENT.getName(); public static final String ST_SYNTHESIS_PRECONDITION = SynthMLPackage.Literals.SYNTHESIS_PRECONDITION.getName(); @@ -112,8 +112,7 @@ public class PokaYokeUmlProfileUtil { + ST_FORMAL_CONSTRAINT; /** Qualified name for the {@link Requirement} stereotype. */ - public static final String REQUIREMENT_STEREOTYPE = POKA_YOKE_PROFILE + NamedElement.SEPARATOR - + ST_CLASS_REQUIREMENT; + public static final String REQUIREMENT_STEREOTYPE = POKA_YOKE_PROFILE + NamedElement.SEPARATOR + ST_REQUIREMENT; /** Qualified name for the {@link SynthesisPrecondition} stereotype. */ public static final String SYNTHESIS_PRECONDITION_STEREOTYPE = POKA_YOKE_PROFILE + NamedElement.SEPARATOR @@ -529,7 +528,7 @@ public static List getSupportedConstraintStereotypes(Constraint cons } else if (isPostconditionConstraint(constraint)) { return List.of(getStereotype(constraint, ST_POSTCONDITION)); } else if (isClassRequirement(constraint)) { - return List.of(getStereotype(constraint, ST_CLASS_REQUIREMENT)); + return List.of(getStereotype(constraint, ST_REQUIREMENT)); } else { return List.of(); } @@ -592,7 +591,7 @@ public static void setConstraintStereotype(Constraint constraint, Stereotype ste } private static String getQualifiedStereotypeName(String stereotypeName) { - if (ST_CLASS_REQUIREMENT.equals(stereotypeName)) { + if (ST_REQUIREMENT.equals(stereotypeName)) { return REQUIREMENT_STEREOTYPE; } else if (ST_SYNTHESIS_PRECONDITION.equals(stereotypeName)) { return SYNTHESIS_PRECONDITION_STEREOTYPE; @@ -616,7 +615,7 @@ public static void setConstraintExpression(Constraint constraint, String newValu public static String getStereotypeName(Stereotype st) { // Returns a slightly better formatted name for the preconditions. - if (st.getName().equals(ST_CLASS_REQUIREMENT)) { + if (st.getName().equals(ST_REQUIREMENT)) { return "Requirement"; } else if (st.getName().equals(ST_SYNTHESIS_PRECONDITION)) { return "Synthesis precondition"; diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index 4789a33c3..d91e81fc5 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -1072,7 +1072,7 @@ private void checkValidClassOrActivityConstraint(Constraint constraint) { return; } - if (!stereotypes.get(0).getName().equals(PokaYokeUmlProfileUtil.ST_CLASS_REQUIREMENT)) { + if (!stereotypes.get(0).getName().equals(PokaYokeUmlProfileUtil.ST_REQUIREMENT)) { error(String.format("Constraint '%s' must have a requirement stereotype applied.", constraint.getName()), UMLPackage.Literals.CONSTRAINT__SPECIFICATION); return; From 3bb41f9f834f955065b302bbd292868363b73dc3 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 25 Feb 2026 08:19:02 +0100 Subject: [PATCH 05/26] #683 UmlToCifTranslator: update JavaDoc. --- .../tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java index 025ab1ea9..88d404150 100644 --- a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java +++ b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java @@ -1649,7 +1649,8 @@ private List createDisableEventsWhenDoneRequirements() { } /** - * Translates all UML class constraints that are in context to CIF requirement invariants. + * Translates all UML class constraints that are in context and all activity's constraints to CIF requirement + * invariants. * * @return The translated CIF requirement invariants. */ From 0fa177a1cb14cfb07efa77ca4a98722c71969d9a Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 25 Feb 2026 08:21:59 +0100 Subject: [PATCH 06/26] #683 CifContext: move method `isActivityRequirement`. --- .../synthml/uml/profile/cif/CifContext.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java index 89f5cb4cc..7c758373c 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java @@ -267,6 +267,16 @@ public static boolean isActivityPostconditionConstraint(Constraint constraint) { return constraint.getContext() instanceof Activity a && a.getPostconditions().contains(constraint); } + public static boolean isActivityRequirement(Constraint constraint) { + return constraint.getContext() instanceof Activity activity + // It is the correct type of constraint. + && !(constraint instanceof DurationConstraint) && !(constraint instanceof InteractionConstraint) + && !(constraint instanceof IntervalConstraint) && !(constraint instanceof TimeConstraint) + // It is neither a precondition nor a postcondition. + && !activity.getPreconditions().contains(constraint) + && !activity.getPostconditions().contains(constraint); + } + public static boolean isClassConstraint(Constraint constraint) { return constraint.getContext() instanceof Class clazz && !(clazz instanceof Behavior); } @@ -279,16 +289,6 @@ public static boolean isPrimitiveTypeConstraint(Constraint constraint) { return constraint.getContext() instanceof PrimitiveType; } - public static boolean isActivityRequirement(Constraint constraint) { - return constraint.getContext() instanceof Activity activity - // It is the correct type of constraint. - && !(constraint instanceof DurationConstraint) && !(constraint instanceof InteractionConstraint) - && !(constraint instanceof IntervalConstraint) && !(constraint instanceof TimeConstraint) - // It is neither a precondition nor a postcondition. - && !activity.getPreconditions().contains(constraint) - && !activity.getPostconditions().contains(constraint); - } - default boolean hasAbstractActivities() { return getDeclaredElements().stream().anyMatch(e -> e instanceof Activity a && a.isAbstract()); } From a4682056e24760818fe8d47d89ab9eb1975fbe3f Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 25 Feb 2026 08:24:45 +0100 Subject: [PATCH 07/26] #683 CifContext, UmlToCifTranslator, PYProfileValidator: rename method --- .../tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java | 2 +- .../com/github/tno/synthml/uml/profile/cif/CifContext.java | 2 +- .../uml/profile/validation/PokaYokeProfileValidator.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java index 88d404150..7e1d66520 100644 --- a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java +++ b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java @@ -1664,7 +1664,7 @@ private List translateRequirements() { // Translate activity requirements. for (Constraint umlConstraint: activity.getOwnedRules()) { - if (CifContext.isActivityRequirement(umlConstraint)) { + if (CifContext.isActivityRequirementConstraint(umlConstraint)) { cifInvariants.addAll(translateRequirement(umlConstraint)); } } diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java index 7c758373c..47201dd8b 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java @@ -267,7 +267,7 @@ public static boolean isActivityPostconditionConstraint(Constraint constraint) { return constraint.getContext() instanceof Activity a && a.getPostconditions().contains(constraint); } - public static boolean isActivityRequirement(Constraint constraint) { + public static boolean isActivityRequirementConstraint(Constraint constraint) { return constraint.getContext() instanceof Activity activity // It is the correct type of constraint. && !(constraint instanceof DurationConstraint) && !(constraint instanceof InteractionConstraint) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index d91e81fc5..aea62b1d4 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -545,7 +545,7 @@ private void checkValidActivity(Activity activity) { .collect(Collectors.toCollection(LinkedHashSet::new)); Set activityRequirements = activity.getOwnedRules().stream() - .filter(r -> CifContext.isActivityRequirement(r)).map(Constraint.class::cast) + .filter(r -> CifContext.isActivityRequirementConstraint(r)).map(Constraint.class::cast) .collect(Collectors.toCollection(LinkedHashSet::new)); if (!members.equals(Sets.union(Sets.union(preAndPostconditions, intervalConstraints), activityRequirements))) { @@ -1007,7 +1007,7 @@ private void checkValidConstraint(Constraint constraint) { if (CifContext.isActivityPrePostconditionConstraint(constraint)) { checkValidActivityPrePostconditionConstraint(constraint); - } else if (CifContext.isClassConstraint(constraint) || (CifContext.isActivityRequirement(constraint))) { + } else if (CifContext.isClassConstraint(constraint) || (CifContext.isActivityRequirementConstraint(constraint))) { checkValidClassOrActivityConstraint(constraint); } else if (CifContext.isOccurrenceConstraint(constraint)) { checkValidOccurrenceConstraint((IntervalConstraint)constraint); From 19fa69fa9fbf819d22b72c9b377ab269b8acbeb1 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 25 Feb 2026 09:40:28 +0100 Subject: [PATCH 08/26] #683 CifContext: remove `isActivityRequirementConstraint` --- .../tno/synthml/uml/profile/cif/CifContext.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java index 47201dd8b..729c946ef 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java @@ -21,18 +21,15 @@ import org.eclipse.uml2.uml.Constraint; import org.eclipse.uml2.uml.ControlFlow; import org.eclipse.uml2.uml.DataType; -import org.eclipse.uml2.uml.DurationConstraint; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Enumeration; import org.eclipse.uml2.uml.EnumerationLiteral; -import org.eclipse.uml2.uml.InteractionConstraint; import org.eclipse.uml2.uml.IntervalConstraint; import org.eclipse.uml2.uml.Model; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.OpaqueBehavior; import org.eclipse.uml2.uml.PrimitiveType; import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.TimeConstraint; import com.github.tno.synthml.uml.profile.util.PokaYokeTypeUtil; @@ -267,16 +264,6 @@ public static boolean isActivityPostconditionConstraint(Constraint constraint) { return constraint.getContext() instanceof Activity a && a.getPostconditions().contains(constraint); } - public static boolean isActivityRequirementConstraint(Constraint constraint) { - return constraint.getContext() instanceof Activity activity - // It is the correct type of constraint. - && !(constraint instanceof DurationConstraint) && !(constraint instanceof InteractionConstraint) - && !(constraint instanceof IntervalConstraint) && !(constraint instanceof TimeConstraint) - // It is neither a precondition nor a postcondition. - && !activity.getPreconditions().contains(constraint) - && !activity.getPostconditions().contains(constraint); - } - public static boolean isClassConstraint(Constraint constraint) { return constraint.getContext() instanceof Class clazz && !(clazz instanceof Behavior); } From 6b5dc4dd90cb6022f209b7b1f72862832bc6843d Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 25 Feb 2026 09:41:14 +0100 Subject: [PATCH 09/26] #683 PokaYokeUmlProfileUtil: add `isRequirementConstraint` method --- .../uml/profile/util/PokaYokeUmlProfileUtil.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java index 48b3172be..9e2d229d5 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java @@ -563,6 +563,16 @@ public static boolean isUsagePrecondition(Constraint constraint) { return appliedStereotypes.get(0).getName().equals(ST_USAGE_PRECONDITION); } + public static boolean isRequirementConstraint(Constraint constraint) { + List appliedStereotypes = constraint.getAppliedStereotypes(); + + if (appliedStereotypes.isEmpty()) { + return false; + } + + return appliedStereotypes.get(0).getName().equals(ST_REQUIREMENT); + } + private static boolean isPostconditionConstraint(Constraint constraint) { return (constraint.eContainer() instanceof Activity activity) && activity.getPostconditions().contains(constraint); From 8a1f8c159796e49e1aff4d6bacf791ccf2f2752d Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 25 Feb 2026 09:41:45 +0100 Subject: [PATCH 10/26] #683 PokaYokeProfileValidator, UmlToCifTranslator: use new method --- .../tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java | 2 +- .../uml/profile/validation/PokaYokeProfileValidator.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java index 7e1d66520..57469f7f3 100644 --- a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java +++ b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java @@ -1664,7 +1664,7 @@ private List translateRequirements() { // Translate activity requirements. for (Constraint umlConstraint: activity.getOwnedRules()) { - if (CifContext.isActivityRequirementConstraint(umlConstraint)) { + if (PokaYokeUmlProfileUtil.isRequirementConstraint(umlConstraint)) { cifInvariants.addAll(translateRequirement(umlConstraint)); } } diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index aea62b1d4..36e6935db 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -545,7 +545,7 @@ private void checkValidActivity(Activity activity) { .collect(Collectors.toCollection(LinkedHashSet::new)); Set activityRequirements = activity.getOwnedRules().stream() - .filter(r -> CifContext.isActivityRequirementConstraint(r)).map(Constraint.class::cast) + .filter(r -> PokaYokeUmlProfileUtil.isRequirementConstraint(r)).map(Constraint.class::cast) .collect(Collectors.toCollection(LinkedHashSet::new)); if (!members.equals(Sets.union(Sets.union(preAndPostconditions, intervalConstraints), activityRequirements))) { @@ -1007,7 +1007,9 @@ private void checkValidConstraint(Constraint constraint) { if (CifContext.isActivityPrePostconditionConstraint(constraint)) { checkValidActivityPrePostconditionConstraint(constraint); - } else if (CifContext.isClassConstraint(constraint) || (CifContext.isActivityRequirementConstraint(constraint))) { + } else if (CifContext.isClassConstraint(constraint) + || (PokaYokeUmlProfileUtil.isRequirementConstraint(constraint))) + { checkValidClassOrActivityConstraint(constraint); } else if (CifContext.isOccurrenceConstraint(constraint)) { checkValidOccurrenceConstraint((IntervalConstraint)constraint); From ee430c6ff0631da41b4d7b5573fd53f66085a431 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 25 Feb 2026 09:54:18 +0100 Subject: [PATCH 11/26] #683 PokaYokeUmlProfileUtil: rename method. --- .../tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java index 9e2d229d5..3100005ff 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java @@ -527,7 +527,7 @@ public static List getSupportedConstraintStereotypes(Constraint cons getStereotype(constraint, ST_USAGE_PRECONDITION)); } else if (isPostconditionConstraint(constraint)) { return List.of(getStereotype(constraint, ST_POSTCONDITION)); - } else if (isClassRequirement(constraint)) { + } else if (isClassRequirementConstraint(constraint)) { return List.of(getStereotype(constraint, ST_REQUIREMENT)); } else { return List.of(); @@ -578,7 +578,7 @@ private static boolean isPostconditionConstraint(Constraint constraint) { && activity.getPostconditions().contains(constraint); } - private static boolean isClassRequirement(Constraint constraint) { + private static boolean isClassRequirementConstraint(Constraint constraint) { return (constraint.eContainer() instanceof Classifier clazz) && clazz.getOwnedRules().contains(constraint); } From 3127da1320f33126a2ff961d79283ddefbc705fe Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 25 Feb 2026 09:54:51 +0100 Subject: [PATCH 12/26] #683 PokaYokeProfileValidator: create set union before check. --- .../uml/profile/validation/PokaYokeProfileValidator.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index 36e6935db..b5eaa54a1 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -22,6 +22,7 @@ import java.util.Stack; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.eclipse.escet.cif.parser.ast.AInvariant; import org.eclipse.escet.cif.parser.ast.automata.AAssignmentUpdate; @@ -548,7 +549,10 @@ private void checkValidActivity(Activity activity) { .filter(r -> PokaYokeUmlProfileUtil.isRequirementConstraint(r)).map(Constraint.class::cast) .collect(Collectors.toCollection(LinkedHashSet::new)); - if (!members.equals(Sets.union(Sets.union(preAndPostconditions, intervalConstraints), activityRequirements))) { + Set allowedConstraints = Stream.of(preAndPostconditions, intervalConstraints, activityRequirements) + .flatMap(Set::stream).collect(Collectors.toSet()); + + if (!members.equals(allowedConstraints)) { error("Activity should contain only precondition, postcondition, constraints and interval constraint members.", UMLPackage.Literals.NAMESPACE__MEMBER); } From 5aa521f225f1cf1dd33d4c7edac9bc1b69c26756 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 25 Feb 2026 09:56:40 +0100 Subject: [PATCH 13/26] #683 PokaYokeProfileValidator: rename method. --- .../uml/profile/validation/PokaYokeProfileValidator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index b5eaa54a1..6a4a13aa2 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -1014,7 +1014,7 @@ private void checkValidConstraint(Constraint constraint) { } else if (CifContext.isClassConstraint(constraint) || (PokaYokeUmlProfileUtil.isRequirementConstraint(constraint))) { - checkValidClassOrActivityConstraint(constraint); + checkValidRequirementConstraint(constraint); } else if (CifContext.isOccurrenceConstraint(constraint)) { checkValidOccurrenceConstraint((IntervalConstraint)constraint); } else if (CifContext.isPrimitiveTypeConstraint(constraint)) { @@ -1068,7 +1068,7 @@ private void checkValidActivityPrePostconditionConstraint(Constraint constraint) } } - private void checkValidClassOrActivityConstraint(Constraint constraint) { + private void checkValidRequirementConstraint(Constraint constraint) { // Check that the constraint has the right stereotype applied. List stereotypes = constraint.getAppliedStereotypes(); From ab173a05d3c9a02a35e341e38771e7ce4f74ac34 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Wed, 25 Feb 2026 10:03:45 +0100 Subject: [PATCH 14/26] #683 PokaYokeProfileValidator: use scoped context. --- .../uml/profile/validation/PokaYokeProfileValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index 6a4a13aa2..2c9291e94 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -1090,7 +1090,7 @@ private void checkValidRequirementConstraint(Constraint constraint) { } try { - new CifTypeChecker(getGlobalContext(constraint)).checkInvariant(CifParserHelper.parseInvariant(constraint)); + new CifTypeChecker(getScopedContext(constraint)).checkInvariant(CifParserHelper.parseInvariant(constraint)); } catch (RuntimeException e) { error("Invalid invariant: " + e.getLocalizedMessage(), UMLPackage.Literals.CONSTRAINT__SPECIFICATION); } From 549e163c42dfccd18fcc50eba4a11e1ec08dbd56 Mon Sep 17 00:00:00 2001 From: AndreaPuffo <46629578+AndreaPuffo@users.noreply.github.com> Date: Mon, 9 Mar 2026 14:13:42 +0100 Subject: [PATCH 15/26] #683 Apply suggestions from code review Co-authored-by: Dennis Hendriks --- .../tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java | 3 +-- .../uml/profile/validation/PokaYokeProfileValidator.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java index 57469f7f3..fd17ef058 100644 --- a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java +++ b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java @@ -1649,8 +1649,7 @@ private List createDisableEventsWhenDoneRequirements() { } /** - * Translates all UML class constraints that are in context and all activity's constraints to CIF requirement - * invariants. + * Translates all UML class constraints that are in context, as well as all activity's constraints, to CIF requirement invariants. * * @return The translated CIF requirement invariants. */ diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index 2c9291e94..574bbae44 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -549,7 +549,7 @@ private void checkValidActivity(Activity activity) { .filter(r -> PokaYokeUmlProfileUtil.isRequirementConstraint(r)).map(Constraint.class::cast) .collect(Collectors.toCollection(LinkedHashSet::new)); - Set allowedConstraints = Stream.of(preAndPostconditions, intervalConstraints, activityRequirements) + Set allowedMembers = Stream.of(preAndPostconditions, intervalConstraints, activityRequirements) .flatMap(Set::stream).collect(Collectors.toSet()); if (!members.equals(allowedConstraints)) { @@ -1012,7 +1012,7 @@ private void checkValidConstraint(Constraint constraint) { if (CifContext.isActivityPrePostconditionConstraint(constraint)) { checkValidActivityPrePostconditionConstraint(constraint); } else if (CifContext.isClassConstraint(constraint) - || (PokaYokeUmlProfileUtil.isRequirementConstraint(constraint))) + || PokaYokeUmlProfileUtil.isRequirementConstraint(constraint)) { checkValidRequirementConstraint(constraint); } else if (CifContext.isOccurrenceConstraint(constraint)) { From 8cd8aac987d6eeeb1bc91abed5d77439a82d41de Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Mon, 9 Mar 2026 14:23:28 +0100 Subject: [PATCH 16/26] #683 PokaYokeProfileValidator: change variable name after review --- .../uml/profile/validation/PokaYokeProfileValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index 574bbae44..0c90c502b 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -552,7 +552,7 @@ private void checkValidActivity(Activity activity) { Set allowedMembers = Stream.of(preAndPostconditions, intervalConstraints, activityRequirements) .flatMap(Set::stream).collect(Collectors.toSet()); - if (!members.equals(allowedConstraints)) { + if (!members.equals(allowedMembers)) { error("Activity should contain only precondition, postcondition, constraints and interval constraint members.", UMLPackage.Literals.NAMESPACE__MEMBER); } From f689a7794202b19691aa5ac42d4defc042b09556 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Mon, 9 Mar 2026 14:23:58 +0100 Subject: [PATCH 17/26] #683 PokaYokeUmlProfileUtil: move methods. --- .../profile/util/PokaYokeUmlProfileUtil.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java index 3100005ff..dd69ed910 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java @@ -543,6 +543,15 @@ private static boolean isPreconditionConstraint(Constraint constraint) { && activity.getPreconditions().contains(constraint); } + private static boolean isPostconditionConstraint(Constraint constraint) { + return (constraint.eContainer() instanceof Activity activity) + && activity.getPostconditions().contains(constraint); + } + + private static boolean isClassRequirementConstraint(Constraint constraint) { + return (constraint.eContainer() instanceof Classifier clazz) && clazz.getOwnedRules().contains(constraint); + } + public static boolean isSynthesisPrecondition(Constraint constraint) { List appliedStereotypes = constraint.getAppliedStereotypes(); @@ -573,15 +582,6 @@ public static boolean isRequirementConstraint(Constraint constraint) { return appliedStereotypes.get(0).getName().equals(ST_REQUIREMENT); } - private static boolean isPostconditionConstraint(Constraint constraint) { - return (constraint.eContainer() instanceof Activity activity) - && activity.getPostconditions().contains(constraint); - } - - private static boolean isClassRequirementConstraint(Constraint constraint) { - return (constraint.eContainer() instanceof Classifier clazz) && clazz.getOwnedRules().contains(constraint); - } - /** * Set the given stereotype to the given constraint. * From 686be240b375296572f3c30b5dcc7071f648f269 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Mon, 9 Mar 2026 14:27:46 +0100 Subject: [PATCH 18/26] #683 PokaYokeUmlProfileUtil: rename methods. --- .../uml/profile/util/PokaYokeUmlProfileUtil.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java index dd69ed910..926fb43ef 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java @@ -522,12 +522,12 @@ public static Stereotype getConstraintFirstStereotype(Constraint constraint) { * @return A list of supported stereotypes for the given constraint. */ public static List getSupportedConstraintStereotypes(Constraint constraint) { - if (isPreconditionConstraint(constraint)) { + if (isContainedAsActivityPrecondition(constraint)) { return List.of(getStereotype(constraint, ST_SYNTHESIS_PRECONDITION), getStereotype(constraint, ST_USAGE_PRECONDITION)); - } else if (isPostconditionConstraint(constraint)) { + } else if (isContainedAsActivityPostcondition(constraint)) { return List.of(getStereotype(constraint, ST_POSTCONDITION)); - } else if (isClassRequirementConstraint(constraint)) { + } else if (isContainedAsClassOrActivityOwnedRule(constraint)) { return List.of(getStereotype(constraint, ST_REQUIREMENT)); } else { return List.of(); @@ -538,17 +538,17 @@ private static Stereotype getStereotype(Constraint constraint, String stereotype return getPokaYokeProfile(constraint).getOwnedStereotype(stereotypeName); } - private static boolean isPreconditionConstraint(Constraint constraint) { + private static boolean isContainedAsActivityPrecondition(Constraint constraint) { return (constraint.eContainer() instanceof Activity activity) && activity.getPreconditions().contains(constraint); } - private static boolean isPostconditionConstraint(Constraint constraint) { + private static boolean isContainedAsActivityPostcondition(Constraint constraint) { return (constraint.eContainer() instanceof Activity activity) && activity.getPostconditions().contains(constraint); } - private static boolean isClassRequirementConstraint(Constraint constraint) { + private static boolean isContainedAsClassOrActivityOwnedRule(Constraint constraint) { return (constraint.eContainer() instanceof Classifier clazz) && clazz.getOwnedRules().contains(constraint); } From 281f185ecb6e6e620bdd70f47cd460b998274eae Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Mon, 9 Mar 2026 14:29:00 +0100 Subject: [PATCH 19/26] #683 PokaYokeUmlProfileUtil: rename methods UmlToCifTranslator, FlattenUmlActivity: rename methods --- .../tno/pokayoke/transform/flatten/FlattenUMLActivity.java | 2 +- .../tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java | 4 ++-- .../tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/FlattenUMLActivity.java b/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/FlattenUMLActivity.java index ad2d01b8c..ba638527e 100644 --- a/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/FlattenUMLActivity.java +++ b/plugins/com.github.tno.pokayoke.transform.flatten/src/com/github/tno/pokayoke/transform/flatten/FlattenUMLActivity.java @@ -168,7 +168,7 @@ private void transformActivity(Activity childBehavior, CallBehaviorAction callBe // If the activity has any usage preconditions, conjunct them with the incoming guard of the // outgoing edge. Set activityPreconditions = childBehaviorCopy.getPreconditions().stream() - .filter(p -> PokaYokeUmlProfileUtil.isUsagePrecondition(p)) + .filter(p -> PokaYokeUmlProfileUtil.isUsagePreconditionConstraint(p)) .map(up -> PokaYokeUmlProfileUtil.getConstraintBodyExpression(up)) .collect(Collectors.toCollection(LinkedHashSet::new)); activityPreconditions diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java index fd17ef058..4b5246008 100644 --- a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java +++ b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java @@ -791,7 +791,7 @@ private void addActivityPrePostConditionsToEdgeGuards(BiMap eventEd List preOrPostConditions; if (addPreconditions) { preOrPostConditions = node.getActivity().getPreconditions().stream() - .filter(p -> PokaYokeUmlProfileUtil.isUsagePrecondition(p)).toList(); + .filter(p -> PokaYokeUmlProfileUtil.isUsagePreconditionConstraint(p)).toList(); } else { preOrPostConditions = node.getActivity().getPostconditions(); } @@ -1383,7 +1383,7 @@ private Automaton createIntervalAutomaton(String name, List events, int m private Pair, AlgVariable> translatePreconditions() { // Translate the user-specified synthesis preconditions of the activity. List synthesisPreconditions = activity.getPreconditions().stream() - .filter(p -> PokaYokeUmlProfileUtil.isSynthesisPrecondition(p)).toList(); + .filter(p -> PokaYokeUmlProfileUtil.isSynthesisPreconditionConstraint(p)).toList(); List preconditionVars = translateUserSpecifiedPrePostconditions(synthesisPreconditions); // Add the synthesized activity's initial node configuration. diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java index 926fb43ef..536adc7b7 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java @@ -552,7 +552,7 @@ private static boolean isContainedAsClassOrActivityOwnedRule(Constraint constrai return (constraint.eContainer() instanceof Classifier clazz) && clazz.getOwnedRules().contains(constraint); } - public static boolean isSynthesisPrecondition(Constraint constraint) { + public static boolean isSynthesisPreconditionConstraint(Constraint constraint) { List appliedStereotypes = constraint.getAppliedStereotypes(); if (appliedStereotypes.isEmpty()) { @@ -562,7 +562,7 @@ public static boolean isSynthesisPrecondition(Constraint constraint) { return appliedStereotypes.get(0).getName().equals(ST_SYNTHESIS_PRECONDITION); } - public static boolean isUsagePrecondition(Constraint constraint) { + public static boolean isUsagePreconditionConstraint(Constraint constraint) { List appliedStereotypes = constraint.getAppliedStereotypes(); if (appliedStereotypes.isEmpty()) { From 1c52cc86ad90f5140c2b0228354cade0c517cb80 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Mon, 9 Mar 2026 14:49:54 +0100 Subject: [PATCH 20/26] #683 PokaYokeUmlProfileUtil: - make methods public - add occurrence constraint and primitive type constraint methods PokaYokeProfileValidator: use the new methods --- .../uml/profile/util/PokaYokeUmlProfileUtil.java | 15 ++++++++++++--- .../validation/PokaYokeProfileValidator.java | 12 ++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java index 536adc7b7..0bfd62c09 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java @@ -37,6 +37,7 @@ import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.OpaqueExpression; import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.PrimitiveType; import org.eclipse.uml2.uml.Profile; import org.eclipse.uml2.uml.Property; import org.eclipse.uml2.uml.RedefinableElement; @@ -538,20 +539,28 @@ private static Stereotype getStereotype(Constraint constraint, String stereotype return getPokaYokeProfile(constraint).getOwnedStereotype(stereotypeName); } - private static boolean isContainedAsActivityPrecondition(Constraint constraint) { + public static boolean isContainedAsActivityPrecondition(Constraint constraint) { return (constraint.eContainer() instanceof Activity activity) && activity.getPreconditions().contains(constraint); } - private static boolean isContainedAsActivityPostcondition(Constraint constraint) { + public static boolean isContainedAsActivityPostcondition(Constraint constraint) { return (constraint.eContainer() instanceof Activity activity) && activity.getPostconditions().contains(constraint); } - private static boolean isContainedAsClassOrActivityOwnedRule(Constraint constraint) { + public static boolean isContainedAsClassOrActivityOwnedRule(Constraint constraint) { return (constraint.eContainer() instanceof Classifier clazz) && clazz.getOwnedRules().contains(constraint); } + public static boolean isContainedAsActivityOccurrenceConstraint(Constraint constraint) { + return constraint.getContext() instanceof Activity && constraint instanceof IntervalConstraint; + } + + public static boolean isPrimitiveTypeConstraint(Constraint constraint) { + return constraint.getContext() instanceof PrimitiveType; + } + public static boolean isSynthesisPreconditionConstraint(Constraint constraint) { List appliedStereotypes = constraint.getAppliedStereotypes(); diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index 0c90c502b..03d879bbf 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -1009,15 +1009,15 @@ private void checkValidOpaqueBehavior(OpaqueBehavior behavior) { private void checkValidConstraint(Constraint constraint) { checkNamingConventions(constraint, NamingConvention.IDENTIFIER); - if (CifContext.isActivityPrePostconditionConstraint(constraint)) { - checkValidActivityPrePostconditionConstraint(constraint); - } else if (CifContext.isClassConstraint(constraint) - || PokaYokeUmlProfileUtil.isRequirementConstraint(constraint)) + if (PokaYokeUmlProfileUtil.isContainedAsActivityPrecondition(constraint) + || PokaYokeUmlProfileUtil.isContainedAsActivityPostcondition(constraint)) { + checkValidActivityPrePostconditionConstraint(constraint); + } else if (PokaYokeUmlProfileUtil.isContainedAsClassOrActivityOwnedRule(constraint)) { checkValidRequirementConstraint(constraint); - } else if (CifContext.isOccurrenceConstraint(constraint)) { + } else if (PokaYokeUmlProfileUtil.isContainedAsActivityOccurrenceConstraint(constraint)) { checkValidOccurrenceConstraint((IntervalConstraint)constraint); - } else if (CifContext.isPrimitiveTypeConstraint(constraint)) { + } else if (PokaYokeUmlProfileUtil.isPrimitiveTypeConstraint(constraint)) { // The constraints for primitive types are validated in #checkValidPrimitiveType(PrimitiveType) } else { error("Unsupported constraint", UMLPackage.Literals.CONSTRAINT__CONTEXT); From 49a6a8e4663aa5cd9c3c5e6179cc0800039b3ae4 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Mon, 9 Mar 2026 14:52:53 +0100 Subject: [PATCH 21/26] #683 CifContext: remove `isPrimitiveTypeConstraint` UmlToCameoTransformer, Uml2GalTranslator, PokaYokeProfileValidator: use the PokaYokeUmlProfileUtil method --- .../pokayoke/transform/uml2cameo/UMLToCameoTransformer.java | 3 ++- .../tno/pokayoke/transform/uml2gal/Uml2GalTranslator.java | 3 ++- .../com/github/tno/synthml/uml/profile/cif/CifContext.java | 5 ----- .../uml/profile/validation/PokaYokeProfileValidator.java | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cameo/src/com/github/tno/pokayoke/transform/uml2cameo/UMLToCameoTransformer.java b/plugins/com.github.tno.pokayoke.transform.uml2cameo/src/com/github/tno/pokayoke/transform/uml2cameo/UMLToCameoTransformer.java index e9955f0aa..6dd81f388 100644 --- a/plugins/com.github.tno.pokayoke.transform.uml2cameo/src/com/github/tno/pokayoke/transform/uml2cameo/UMLToCameoTransformer.java +++ b/plugins/com.github.tno.pokayoke.transform.uml2cameo/src/com/github/tno/pokayoke/transform/uml2cameo/UMLToCameoTransformer.java @@ -134,7 +134,8 @@ public void transformModel() throws CoreException { CifContext cifContext = ctxManager.getGlobalContext(); - Preconditions.checkArgument(!cifContext.hasConstraints(c -> !CifContext.isPrimitiveTypeConstraint(c)), + Preconditions.checkArgument( + !cifContext.hasConstraints(c -> !PokaYokeUmlProfileUtil.isPrimitiveTypeConstraint(c)), "Only type constraints are supported."); Preconditions.checkArgument(!cifContext.hasAbstractActivities(), "Abstract activities are unsupported."); diff --git a/plugins/com.github.tno.pokayoke.transform.uml2gal/src/com/github/tno/pokayoke/transform/uml2gal/Uml2GalTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2gal/src/com/github/tno/pokayoke/transform/uml2gal/Uml2GalTranslator.java index f59982f8e..6165b03ab 100644 --- a/plugins/com.github.tno.pokayoke.transform.uml2gal/src/com/github/tno/pokayoke/transform/uml2gal/Uml2GalTranslator.java +++ b/plugins/com.github.tno.pokayoke.transform.uml2gal/src/com/github/tno/pokayoke/transform/uml2gal/Uml2GalTranslator.java @@ -149,7 +149,8 @@ public Specification translate(Model model) throws CoreException { // Check transformation preconditions. Preconditions.checkArgument(!cifContext.hasOpaqueBehaviors(), "Opaque behaviors are unsupported."); - Preconditions.checkArgument(!cifContext.hasConstraints(c -> !CifContext.isPrimitiveTypeConstraint(c)), + Preconditions.checkArgument( + !cifContext.hasConstraints(c -> !PokaYokeUmlProfileUtil.isPrimitiveTypeConstraint(c)), "Only type constraints are supported."); Preconditions.checkArgument(!cifContext.hasAbstractActivities(), "Abstract activities are unsupported."); Preconditions.checkArgument(!cifContext.hasParameterizedActivities(), diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java index 729c946ef..259814b9e 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java @@ -28,7 +28,6 @@ import org.eclipse.uml2.uml.Model; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.OpaqueBehavior; -import org.eclipse.uml2.uml.PrimitiveType; import org.eclipse.uml2.uml.Property; import com.github.tno.synthml.uml.profile.util.PokaYokeTypeUtil; @@ -272,10 +271,6 @@ public static boolean isOccurrenceConstraint(Constraint constraint) { return constraint.getContext() instanceof Activity && constraint instanceof IntervalConstraint; } - public static boolean isPrimitiveTypeConstraint(Constraint constraint) { - return constraint.getContext() instanceof PrimitiveType; - } - default boolean hasAbstractActivities() { return getDeclaredElements().stream().anyMatch(e -> e instanceof Activity a && a.isAbstract()); } diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index 03d879bbf..6b5cf629b 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -229,8 +229,8 @@ private void checkGlobalUniqueNames(Model model) { .getReferenceableElementsInclDuplicates(); for (Map.Entry> entry: referenceableElementsInclDuplicates.entrySet()) { // Skip primitive type constraints, that always have the same fixed name. - if (entry.getValue().stream() - .allMatch(t -> t instanceof Constraint constr && CifContext.isPrimitiveTypeConstraint(constr))) + if (entry.getValue().stream().allMatch( + t -> t instanceof Constraint constr && PokaYokeUmlProfileUtil.isPrimitiveTypeConstraint(constr))) { continue; } From 3312f5d91a0bc28fd39d3c7ee3d4ff100d7b6cc8 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Mon, 9 Mar 2026 15:07:42 +0100 Subject: [PATCH 22/26] #683 CifContext: remove `isOccurrenceConstraint` AbstractActivityDependencyOrderer: use the PokaYokeUmlProfileUtil method --- .../activitysynthesis/AbstractActivityDependencyOrderer.java | 4 ++-- .../com/github/tno/synthml/uml/profile/cif/CifContext.java | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/com.github.tno.pokayoke.activitysynthesis/src/com/github/tno/pokayoke/transform/activitysynthesis/AbstractActivityDependencyOrderer.java b/plugins/com.github.tno.pokayoke.activitysynthesis/src/com/github/tno/pokayoke/transform/activitysynthesis/AbstractActivityDependencyOrderer.java index e025fbeb0..9bb29e4dc 100644 --- a/plugins/com.github.tno.pokayoke.activitysynthesis/src/com/github/tno/pokayoke/transform/activitysynthesis/AbstractActivityDependencyOrderer.java +++ b/plugins/com.github.tno.pokayoke.activitysynthesis/src/com/github/tno/pokayoke/transform/activitysynthesis/AbstractActivityDependencyOrderer.java @@ -24,7 +24,7 @@ import org.eclipse.uml2.uml.Interval; import org.eclipse.uml2.uml.IntervalConstraint; -import com.github.tno.synthml.uml.profile.cif.CifContext; +import com.github.tno.synthml.uml.profile.util.PokaYokeUmlProfileUtil; /** * A dependency orderer for abstract activities, which determines the order in which abstract activities should be @@ -113,7 +113,7 @@ protected Set findDirectDependencies(Activity activity) { * otherwise. */ private boolean isBlockingOccurrenceConstraint(Constraint constraint) { - if (CifContext.isOccurrenceConstraint(constraint)) { + if (PokaYokeUmlProfileUtil.isContainedAsActivityOccurrenceConstraint(constraint)) { IntervalConstraint intervalConstraint = (IntervalConstraint)constraint; Interval interval = (Interval)intervalConstraint.getSpecification(); return interval.getMax().integerValue() <= 0; diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java index 259814b9e..0f67bae47 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java @@ -24,7 +24,6 @@ import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Enumeration; import org.eclipse.uml2.uml.EnumerationLiteral; -import org.eclipse.uml2.uml.IntervalConstraint; import org.eclipse.uml2.uml.Model; import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.OpaqueBehavior; @@ -267,10 +266,6 @@ public static boolean isClassConstraint(Constraint constraint) { return constraint.getContext() instanceof Class clazz && !(clazz instanceof Behavior); } - public static boolean isOccurrenceConstraint(Constraint constraint) { - return constraint.getContext() instanceof Activity && constraint instanceof IntervalConstraint; - } - default boolean hasAbstractActivities() { return getDeclaredElements().stream().anyMatch(e -> e instanceof Activity a && a.isAbstract()); } From e6236143cfd9b77346dd5f089252ae36bf510527 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Mon, 9 Mar 2026 15:10:07 +0100 Subject: [PATCH 23/26] #683 CifContext: remove method to check activity pre/post condition constraint PokaYokeProfileValidator: use the PokaYokeUmlProfileUtil methods --- .../tno/synthml/uml/profile/cif/CifContext.java | 17 ----------------- .../validation/PokaYokeProfileValidator.java | 4 ++-- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java index 0f67bae47..1ad3116a2 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/cif/CifContext.java @@ -16,7 +16,6 @@ import java.util.function.Predicate; import org.eclipse.uml2.uml.Activity; -import org.eclipse.uml2.uml.Behavior; import org.eclipse.uml2.uml.Class; import org.eclipse.uml2.uml.Constraint; import org.eclipse.uml2.uml.ControlFlow; @@ -250,22 +249,6 @@ default boolean hasConstraints(Predicate predicate) { return getDeclaredElements().stream().anyMatch(e -> e instanceof Constraint c && predicate.test(c)); } - public static boolean isActivityPrePostconditionConstraint(Constraint constraint) { - return isActivityPreconditionConstraint(constraint) || isActivityPostconditionConstraint(constraint); - } - - public static boolean isActivityPreconditionConstraint(Constraint constraint) { - return constraint.getContext() instanceof Activity a && a.getPreconditions().contains(constraint); - } - - public static boolean isActivityPostconditionConstraint(Constraint constraint) { - return constraint.getContext() instanceof Activity a && a.getPostconditions().contains(constraint); - } - - public static boolean isClassConstraint(Constraint constraint) { - return constraint.getContext() instanceof Class clazz && !(clazz instanceof Behavior); - } - default boolean hasAbstractActivities() { return getDeclaredElements().stream().anyMatch(e -> e instanceof Activity a && a.isAbstract()); } diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index 6b5cf629b..ea20b9d06 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -1033,14 +1033,14 @@ private void checkValidActivityPrePostconditionConstraint(Constraint constraint) return; } - if (CifContext.isActivityPreconditionConstraint(constraint) + if (PokaYokeUmlProfileUtil.isContainedAsActivityPrecondition(constraint) && !(stereotypes.get(0).getName().equals(PokaYokeUmlProfileUtil.ST_SYNTHESIS_PRECONDITION) || stereotypes.get(0).getName().equals(PokaYokeUmlProfileUtil.ST_USAGE_PRECONDITION))) { error(String.format("Constraint '%s' must have a precondition stereotype applied.", constraint.getName()), UMLPackage.Literals.CONSTRAINT__SPECIFICATION); return; - } else if (CifContext.isActivityPostconditionConstraint(constraint) + } else if (PokaYokeUmlProfileUtil.isContainedAsActivityPostcondition(constraint) && !(stereotypes.get(0).getName().equals(PokaYokeUmlProfileUtil.ST_POSTCONDITION))) { error(String.format("Constraint '%s' must have a postcondition stereotype applied.", constraint.getName()), From 0487e953b27ecf2c5c69ee007a3eac221aa9fc57 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Tue, 10 Mar 2026 08:09:52 +0100 Subject: [PATCH 24/26] #638 PokaYokeProfileValidator: update if-clause with new methods --- .../validation/PokaYokeProfileValidator.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java index ea20b9d06..4a31c1ac8 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/validation/PokaYokeProfileValidator.java @@ -1014,11 +1014,16 @@ private void checkValidConstraint(Constraint constraint) { { checkValidActivityPrePostconditionConstraint(constraint); } else if (PokaYokeUmlProfileUtil.isContainedAsClassOrActivityOwnedRule(constraint)) { - checkValidRequirementConstraint(constraint); - } else if (PokaYokeUmlProfileUtil.isContainedAsActivityOccurrenceConstraint(constraint)) { - checkValidOccurrenceConstraint((IntervalConstraint)constraint); - } else if (PokaYokeUmlProfileUtil.isPrimitiveTypeConstraint(constraint)) { - // The constraints for primitive types are validated in #checkValidPrimitiveType(PrimitiveType) + if (PokaYokeUmlProfileUtil.isPrimitiveTypeConstraint(constraint)) { + // The constraints for primitive types are validated in #checkValidPrimitiveType(PrimitiveType). + } else if (PokaYokeUmlProfileUtil.isContainedAsActivityOccurrenceConstraint(constraint)) { + checkValidOccurrenceConstraint((IntervalConstraint)constraint); + } else if (PokaYokeUmlProfileUtil.isRequirementConstraint(constraint)) { + // Check the class and activity requirements. + checkValidRequirementConstraint(constraint); + } else { + error("Unsupported constraint", UMLPackage.Literals.CONSTRAINT__CONTEXT); + } } else { error("Unsupported constraint", UMLPackage.Literals.CONSTRAINT__CONTEXT); } From 2f63429913c71a3230c93be88d7fa7320c508f03 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Tue, 10 Mar 2026 08:10:09 +0100 Subject: [PATCH 25/26] #638 PokaYokeUmlProfileUtil: add comment --- .../tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java index 0bfd62c09..4a768aa48 100644 --- a/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java +++ b/plugins/com.github.tno.synthml.uml.profile.util/src/com/github/tno/synthml/uml/profile/util/PokaYokeUmlProfileUtil.java @@ -550,7 +550,8 @@ public static boolean isContainedAsActivityPostcondition(Constraint constraint) } public static boolean isContainedAsClassOrActivityOwnedRule(Constraint constraint) { - return (constraint.eContainer() instanceof Classifier clazz) && clazz.getOwnedRules().contains(constraint); + // Activity is a sub-type of Classifier. + return constraint.eContainer() instanceof Classifier clazz && clazz.getOwnedRules().contains(constraint); } public static boolean isContainedAsActivityOccurrenceConstraint(Constraint constraint) { From f0ba3f0e24fba5aac15e63b7ee779d4fecaab360 Mon Sep 17 00:00:00 2001 From: AndreaPuffo Date: Tue, 10 Mar 2026 08:10:24 +0100 Subject: [PATCH 26/26] #638 UmlToCifTranslator: reformat file --- .../tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java index 4b5246008..a229032b5 100644 --- a/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java +++ b/plugins/com.github.tno.pokayoke.transform.uml2cif/src/com/github/tno/pokayoke/transform/uml2cif/UmlToCifTranslator.java @@ -1649,7 +1649,8 @@ private List createDisableEventsWhenDoneRequirements() { } /** - * Translates all UML class constraints that are in context, as well as all activity's constraints, to CIF requirement invariants. + * Translates all UML class constraints that are in context, as well as all activity's constraints, to CIF + * requirement invariants. * * @return The translated CIF requirement invariants. */