Commit dac54e09 authored by Martti Käärik's avatar Martti Käärik
Browse files

MemberRefinement constraints.

parent 21d250bf
Loading
Loading
Loading
Loading
+15 −0
Changes for plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -210,6 +210,13 @@ context StructuredDataType
        self.allMembers()->isUnique(e | e.name)
  

  -- Refined 'Member' of the 'StructuredDataType'
  inv RefineExistingMemberOfDataType ('The refined \'Member\'s shall be inherited by the \'StructuredDataType\'.' + self.toString()):
        self.memberRefinement->forAll(a | 
              self.allMembers()->includes(a.member) and 
              self.member->excludes(a.member))
  



context StructuredDataInstance
@@ -324,6 +331,14 @@ context EnumDataType



context MemberRefinement
  -- Only optional 'Member's can be made mandatory 
  inv OptionalToMandatoryMembers ('The \'isMandatory\' property of a \'MemberRefinement\' shall be true only for optional \'Member\'s.' + self.toString()):
        self.isMandatory implies self.member.isOptional
  



context DataUse
  -- Occurrence of 'argument' and 'reduction'
  inv ArgumentReductionLists ('Only in case of a \'FunctionCall\', or a \'DataElementUse\' which refers to a \'Function\', both the \'argument\' list and the \'reduction\' list may be provided, otherwise either the \'argument\' list, the \'reduction\' list, or none of them shall be provided.' + self.toString()):
+10 −1
Changes for plugins/org.etsi.mts.tdl.model/model/tdl.ecore: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -229,11 +229,13 @@
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="StructuredDataType" eSuperTypes="#//DataType">
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
      <details key="constraints" value="DistinguishableMemberNames"/>
      <details key="constraints" value="DistinguishableMemberNames RefineExistingMemberOfDataType"/>
    </eAnnotations>
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
      <details key="DistinguishableMemberNames" value="self.allMembers()->isUnique(e | e.name)"/>
      <details key="DistinguishableMemberNames$message" value="'All \'Member\' names of a \'StructuredDataType\' (including the names of inherited \'Members\') shall be distinguishable.' + self.toString()"/>
      <details key="RefineExistingMemberOfDataType" value="self.memberRefinement->forAll(a |&#xA;self.allMembers()->includes(a.member) and&#xA;self.member->excludes(a.member))"/>
      <details key="RefineExistingMemberOfDataType$message" value="'The refined \'Member\'s shall be inherited by the \'StructuredDataType\'.' + self.toString()"/>
    </eAnnotations>
    <eOperations name="allMembers" upperBound="-1" eType="#//Member">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
@@ -1526,6 +1528,13 @@
        eType="#//DataType"/>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="MemberRefinement" eSuperTypes="#//Element">
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
      <details key="constraints" value="OptionalToMandatoryMembers"/>
    </eAnnotations>
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
      <details key="OptionalToMandatoryMembers" value="self.isMandatory implies self.member.isOptional"/>
      <details key="OptionalToMandatoryMembers$message" value="'The \'isMandatory\' property of a \'MemberRefinement\' shall be true only for optional \'Member\'s.' + self.toString()"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EReference" name="member" lowerBound="1"
        eType="#//Member"/>
    <eStructuralFeatures xsi:type="ecore:EReference" name="constraint" upperBound="-1"
+8 −0
Changes for plugins/org.etsi.mts.tdl.tx.tests/src/constraints/core/MemberRefinement_OptionalToMandatoryMembers.optional.tdltx: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
//! expect none
// The other branch: an optional inherited member is made mandatory.
Package OptionalToMandatoryMembersOk {
    Import all from TDL

    Structure Base ( optional Integer maybe )
    Structure Derived extends Base ( mandatory maybe )
}
+8 −0
Changes for plugins/org.etsi.mts.tdl.tx.tests/src/constraints/core/MemberRefinement_OptionalToMandatoryMembers.tdltx: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
//! expect MemberRefinement::OptionalToMandatoryMembers
// 'certain' is not optional in the extended structure, so there is nothing to make mandatory.
Package OptionalToMandatoryMembers {
    Import all from TDL

    Structure Base ( Integer certain )
    Structure Derived extends Base ( mandatory certain )
}
+8 −0
Changes for plugins/org.etsi.mts.tdl.tx.tests/src/constraints/core/StructuredDataType_RefineExistingMemberOfDataType.inherited.tdltx: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
//! expect none
// The other branch: the refined member comes from the extended structure.
Package RefineExistingMemberOfDataTypeOk {
    Import all from TDL

    Structure Base ( optional Integer inherited )
    Structure Derived extends Base ( Integer own, inherited )
}
Loading