Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
import 'http://www.etsi.org/spec/TDL/1.4.1'
package tdl
context NamedElement
-- Mandatory name
inv MandatoryName ('A \'NamedElement\' shall have the \'name\' property set and the \'name\' shall be not an empty String.' + self.toString()):
not self.name.oclIsUndefined() and self.name.size() > 0
-- Distinguishable qualified names
inv DistinquishableName ('All qualified names of instances of \'NamedElement\'s shall be distinguishable within a TDL model.' + self.toString()):
NamedElement.allInstances()->one(e | e.qualifiedName = self.qualifiedName)
-- [NOTE: It is up to the concrete syntax definition and tooling to resolve any name clashes between instances of the same meta-class in the qualified name.]
context Package
-- No cyclic imports
inv CyclicImports ('A \'Package\' shall not import itself directly or indirectly.' + self.toString()):
self.import->asOrderedSet()->closure(i | i.importedPackage.import)->forAll(i |
i.importedPackage <> self)
context ElementImport
-- Consistency of imported elements
inv ConsistentImports ('All imported \'PackageableElement\'s referenced by an \'ElementImport\' shall be directly owned by the imported \'Package\'.' + self.toString()):
self.importedElement->forAll(e | self.importedPackage.packagedElement->includes(e))
-- [Figure 5.2: Miscellaneous elements]
context Comment
-- No nested comments
inv CommentNestedComments ('A \'Comment\' shall not contain \'Comment\'s.' + self.toString()):
self.comment->isEmpty()
-- No annotations to comments
inv CommentNestedAnnotations ('A \'Comment\' shall not contain \'Annotation\'s.' + self.toString()):
self.annotation->isEmpty()
context Annotation
-- No nested annotations
inv AnnotationNestedAnnotations ('An \'Annotation\' shall not contain \'Annotation\'s' + self.toString()):
self.annotation->isEmpty()
-- No comments to annotations
inv AnnotationNestedComments ('An \'Annotation\' shall not contain \'Comment\'s.' + self.toString()):
self.comment->isEmpty()
context Extension
-- Inherit from element of the same meta-class
inv Extension ('The element containing an \'Extension\' and the element in the \'extending\' property shall have the same meta-class.' + self.toString()):
self.container().oclType() = self.extending.oclType()
context Constraint
-- Effectively static quantifiers
inv StaticQuantifiers ('All \'DataUse\'s specified as \'quantifier\'s shall be effectively static.' + self.toString()):
self.quantifier->forAll(q | q.isEffectivelyStatic())
-- Empty arguments for quantifiers
inv NoArgumentQuantifiers ('The \'argument\' sets for all \'DataUse\'s specified as \'quantifier\'s shall be empty.' + self.toString()):
self.quantifier->forAll(q | q.argument->isEmpty())
-- Constraint applicability for 'union' and 'uniontype'
inv ConstraintApplicabilityUnionUniontype ('The predefined \'ConstraintType\'s \'union\' and \'uniontype\' shall be applied to \'StructuredDataType\'s only. ' + self.toString()):
(self.type.name = 'union' or self.type.name = 'uniontype')
implies self.container().oclIsTypeOf(StructuredDataType)
-- Constraint applicability for 'range' and 'format'
inv ConstraintApplicabilityRangeFormat ('The predefined \'ConstraintType\'s \'range\' and \'format\' shall be applied to \'SimpleDataType\'s and \'Member\'s with a \'SimpleDataType\' \'dataType\' only. ' + self.toString()):
(self.type.name = 'range' or self.type.name = 'format')
implies (self.container().oclIsTypeOf(SimpleDataType)
or (self.container().oclIsTypeOf(Member)
and self.container().oclAsType(Member).dataType.oclIsTypeOf(SimpleDataType)))
-- Constraint applicability for 'length', 'minLength', and 'maxLength'
inv ConstraintApplicabilityLength ('The predefined \'ConstraintType\'s \'length\', \'minLength\', and \'maxLength\' shall be applied to \'CollectionDataType\'s, \'SimpleDataType\'s and \'Member\'s with a \'SimpleDataType\' or a \'CollectionDataType\' \'dataType\' only. ' + self.toString()):
(self.type.name = 'length' or self.type.name = 'minLength' or self.type.name = 'maxLength')
implies (self.container().oclIsTypeOf(SimpleDataType)
or self.container().oclIsTypeOf(CollectionDataType)
or (self.container().oclIsTypeOf(Member)
and self.container().oclAsType(Member).dataType.oclIsTypeOf(SimpleDataType))
and self.container().oclAsType(Member).dataType.oclIsTypeOf(CollectionDataType))
-- Quantifiers for 'length', 'minLength', and 'maxLength'
inv ConstraintQuantifierLength ('The predefined \'ConstraintType\'s \'length\', \'minLength\', and \'maxLength\' shall be used with exactly one \'quantifier\' resolved to an instance conforming to the predefined \'Integer\' \'DataType\'. ' + self.toString()):
(self.type.name = 'length' or self.type.name = 'minLength' or self.type.name = 'maxLength')
implies (self.quantifier->size() = 1
and self.quantifier->forAll(q | q.resolveDataType().conformsTo('Integer')))
-- Quantifiers for 'range'
inv ConstraintQuantifierRange ('The predefined \'ConstraintType\' \'range\' shall be used with exactly two \'quantifier\'s resolved to instance conforming to the predefined \'Integer\' \'DataType\'. ' + self.toString()):
(self.type.name = 'length')
implies (self.quantifier->size() = 2
and self.quantifier->forAll(q | q.resolveDataType().conformsTo('Integer')))
context DataElementMapping
-- Restricted use of 'ParameterMapping'
inv ParameterMappingType ('A set of \'ParameterMapping\'s may only be provided if \'mappableDataElement\' refers to a \'StructuredDataType\', an \'Action\' or a \'Function\' definition and the \'mappableDataElement\' contains the mapped \'Parameters\'.' + self.toString()):
self.parameterMapping->size() = 0
or (self.mappableDataElement.oclIsTypeOf(StructuredDataType)
and self.parameterMapping->forAll(p |
self.mappableDataElement.oclAsType(StructuredDataType).allMembers()->includes(p.parameter)))
or (self.mappableDataElement.oclIsKindOf(Action)
and self.parameterMapping->forAll(p |
self.mappableDataElement.oclAsType(Action).formalParameter->includes(p.parameter)))
-- All parameters shall be mapped
inv ParameterMappings ('If the \'mappableDataElement\' refers to a \'StructuredDataType\', an \'Action\' or a \'Function\' definition, all the \'Parameters\' contained in the \'mappableDataElement\' shall be mapped.' + self.toString()):
(self.mappableDataElement.oclIsTypeOf(SimpleDataType)
or (self.mappableDataElement.oclIsTypeOf(StructuredDataType)
and self.mappableDataElement.oclAsType(StructuredDataType).member->forAll(p |
self.parameterMapping->exists(m | m.parameter = p)))
or (self.mappableDataElement.oclIsKindOf(Action)
and self.mappableDataElement.oclAsType(Action).formalParameter->forAll(p |
self.parameterMapping->exists(m | m.parameter = p)))
and self.parameterMapping->forAll(p |
self.mappableDataElement.oclAsType(Action).formalParameter->includes(p.parameter)))
context SimpleDataInstance
-- SimpleDataInstance shall refer to SimpleDataType
inv SimpleDataInstanceType ('The inherited reference \'dataType\' from \'DataInstance\' shall refer to instances of \'SimpleDataType\' solely.' + self.toString()):
self.dataType.oclIsKindOf(SimpleDataType)
-- [Figure 6.3: Structured data type and instance]
context StructuredDataType
-- Different member names in a structured data type
inv DistinguishableMemberNames ('All \'Member\' names of a \'StructuredDataType\' (including the names of inherited \'Members\') shall be distinguishable.' + self.toString()):
self.allMembers()->isUnique(e | e.name)
context StructuredDataInstance
-- StructuredDataInstance shall refer to StructuredDataType
inv StructuredDataInstance ('The inherited reference \'dataType\' from \'DataInstance\' shall refer to instances of \'StructuredDataType\' solely.' + self.toString()):
self.dataType.oclIsTypeOf(StructuredDataType)
-- 'Member' of the 'StructuredDataType'
inv ExistingMemberOfDataType ('The referenced \'Member\' shall be contained in or inherited by the \'StructuredDataType\' that the \'StructuredDataInstance\', which contains this \'MemberAssignment\', refers to.' + self.toString()):
self.memberAssignment->forAll(a | self.dataType.oclAsType(StructuredDataType).allMembers()->includes(a.member))
-- Unique assignments for each 'Member' of the 'StructuredDataType'
inv UniqueMemberAssignments ('There shall be at most one \'memberAssignment\' for each \'Member\' of the \'StructuredDataType\' that the \'StructuredDataInstance\', which contains this \'MemberAssignment\', refers to.' + self.toString()):
self.memberAssignment->isUnique(m | m.member)
-- 'union' constraint on the type of the 'StructuredDataInstance'
inv StructuredDataInstanceUnionConstraint ('If the \'dataType\' of the \'StructuredDataInstance\' has the predefined constraint \'union\' then the \'memberAssignment\' shall not contain more than one \'MemberAssignment\'.' + self.toString()):
not self.dataType.allConstraints()->exists(c | c.type.name = 'union')
or self.memberAssignment->size() <= 1
-- 'uniontype' constraint on the type of the 'StructuredDataInstance'
inv StructuredDataInstanceUniontypeConstraint ('If the \'dataType\' of \'StructuredDataInstance\' has the predefined constraint \'uniontype\' then there shall only be \'MemberAssignment\' for the \'Member\'s of the \'dataType\' itself or of at most one of the \'StructuredDataType\'s which the \'dataType\' is extending.' + self.toString()):
not self.dataType.allConstraints()->exists(c | c.type.name = 'uniontype')
or self.memberAssignment->forAll(m | self.dataType.oclAsType(StructuredDataType).member->includes(m)
or self.dataType.oclAsType(StructuredDataType).extension->one(e |
e.extending.oclAsType(StructuredDataType).allMembers()->includes(m)))
context MemberAssignment
-- Type of a 'memberSpec' shall conform to the type of the 'member'
inv MatchingMemberDataType ('The \'DataType\' of the \'DataUse\' of \'memberSpec\' shall conform to the \'DataType\' of the \'Member\' of the \'MemberAssignment\'.' + self.toString()):
Loading
Loading full blame…