From 9af93b219e5f99cbb10d23c38b1daaf2d28d61fe Mon Sep 17 00:00:00 2001
From: Philip Makedonski <makedonski@cs.uni-goettingen.de>
Date: Fri, 22 Dec 2023 12:02:24 +0100
Subject: [PATCH] + fixes for constraints issues #65

---
 .../model/tdl-constraints.ocl                       | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl b/plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl
index 246dc688..440da939 100644
--- a/plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl
+++ b/plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl
@@ -401,8 +401,8 @@ context DataElementUse
   -- 'DataElement' reference or non-empty 'argument' or non-empty 'item'
   inv DataInstanceOrArgumentsOrItemsInDataElementUse ('If a \'dataElement\' is not specified, or if the \'dataElement\' is resolved to a \'StructuredDataType\' or a \'CollectionDataType\', either a non-empty \'argument\' set or a non-empty \'item\' set shall be specified.' + self.toString()):
         not (self.dataElement.oclIsUndefined() and self.argument->isEmpty() and self.item->isEmpty())
-          and not (self.dataElement.oclIsKindOf(StructuredDataType) and self.argument->isEmpty())
-          and not (self.dataElement.oclIsKindOf(CollectionDataType) and self.item->isEmpty())
+          and (self.dataElement.oclIsKindOf(StructuredDataInstance) or not (self.resolveDataType().oclIsKindOf(StructuredDataType) and self.argument->isEmpty()))
+          and (self.dataElement.oclIsKindOf(CollectionDataInstance) or not (self.resolveDataType().oclIsKindOf(CollectionDataType) and self.item->isEmpty()))
   
 
   -- Valid 'DataType' for items
@@ -584,7 +584,7 @@ context TestConfiguration
 context Block
   -- Guard shall evaluate to Boolean
   inv GuardType ('The type of \'guard\' shall be \'Boolean\'.' + self.toString()):
-        self.guard ->forAll(g | g.expression.resolveDataType().name = 'Boolean')
+        self.guard ->forAll(g | g.expression.resolveDataType().conformsTo('Boolean'))
   
 
   -- No directly contained 'ExceptionalBehaviour's and 'PeriodicBehaviour's.
@@ -637,7 +637,7 @@ context LocalExpression
 context BoundedLoopBehaviour
   -- No guard constraint
   inv BoundedGuard ('The \'Block\' of a \'BoundedLoopBehaviour\' shall not have a \'guard\'.' + self.toString()):
-        self.block->forAll(b | b.guard.oclIsUndefined())
+        self.block.guard->isEmpty()
   
 
   -- Iteration number shall be countable and positive
@@ -750,7 +750,7 @@ context AlternativeBehaviour
 context ConditionalBehaviour
   -- Guard for 'ConditionalBehaviour' with single block
   inv ConditionalFirstGuard ('If there is only one \'Block\' specified, it shall have a \'guard\'.' + self.toString()):
-        self.block->size() > 1 or self.block->first().guard->size() > 1
+        self.block->size() > 1 or self.block->first().guard->size() > 0
   
 
   -- Possible else block for 'ConditionalBehaviour' with multiple blocks
@@ -1091,7 +1091,8 @@ context TestDescriptionReference
 
   -- Compatible test configurations 
   inv CompatibleConfiguration ('The \'TestConfiguration\' of the referenced (invoked) \'TestDescription\' shall be compatible with the \'TestConfiguration\' of the referencing (invoking) \'TestDescription\' under the provided \'ComponentInstanceBinding\'s between the \'ComponentInstance\'s of the \'TestConfiguration\'s of referenced and referencing \'TestDescription\'s. ' + self.toString()):
-        self.testDescription.testConfiguration.compatibleWith(
+        self.componentInstanceBinding->isEmpty()
+      or self.testDescription.testConfiguration.compatibleWith(
               self.getParentTestDescription().testConfiguration, self.componentInstanceBinding)
   
 
-- 
GitLab