Newer
Older

Martti Käärik
committed
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
import 'http://www.etsi.org/spec/TDL/1.4.1'
import 'http://www.etsi.org/spec/TDL/1.3.1/structured'
package structuredobjectives
context PICSReference
-- Combining Multiple 'PICSReference's
inv MultiplePICS ('A \'Comment\' with body containing an \'and\' or \'or\' shall be attached to the \'PICSReference\' as a Boolean operand if there are two or more \'PICSReference\'s and it is not the first \'PICSReference\'.' + self.toString()):
self.getTestObjective().picsReference->size() < 2
or self.getTestObjective().picsReference->forAll(p |
self.getTestObjective().picsReference->at(0) = p
or (not p.comment->isEmpty()
and (p.comment->first()._'body' = 'and'
or p.comment->first()._'body' = 'or')))
context RepeatedEventSequence
-- Either 'repetitions', or 'interval' or neither shall be specified
inv RepetitionOrInterval ('At most one of the optional properties \'repetitions\' or \'interval\' shall be defined.' + self.toString()):
self.repetitions.oclIsUndefined() or self.interval.oclIsUndefined()
-- The 'repetitions' 'Value' shall be countable and positive
inv RepetitionCount ('The expression assigned to the \'repetitions\' property shall evaluate to a positive and countable \'Value\'.' + self.toString()):
true --This constraint cannot be expressed in OCL
-- The 'interval' 'Value' shall be countable and positive
inv RepetitionInterval ('The expression assigned to the \'repetitions\' property shall evaluate to a positive and countable \'Value\'' + self.toString()):
true --This constraint cannot be expressed in OCL
--context EventOccurrence
-- -- Combining Multiple 'EventOccurrence's
-- inv MultipleEventOccurrences ('A \'Comment\' with body containing an \'and\' or \'or\' shall be attached to the \'EventOccurrence\' as an operand if there are two or more \'EventOccurrence\'s and it is not the first \'EventOccurrence\'.' + self.toString()):
-- self.container().oclIsTypeOf(EventSpecificationTemplate)
-- or self.container().events->size() < 2
-- or self.container().events->forAll(o |
-- self.container().events->at(0) = o
-- or (not o.comment->isEmpty()
-- and (o.comment->first()._'body' = 'and'
-- or o.comment->first()._'body' = 'or')))
context EntityReference
-- An 'Entity' or a 'ComponentInstance' shall be referenced.
inv EntityOrComponentInstance ('There shall be a reference to an \'Entity\' or a \'ComponentInstance\' but not both.' + self.toString()):
(not self.entity.oclIsUndefined() and self.component.oclIsUndefined())
or (self.entity.oclIsUndefined() and not self.component.oclIsUndefined())
context Content
-- No nested 'Content's if 'Value' is provided
inv ContentOrValue ('Either nested \'Content\'s or \'Value\' may be specified within \'Content\', but not both.' + self.toString()):
self.content->isEmpty() or self.value.oclIsUndefined()
context LiteralValueReference
-- Referenced 'LiteralValue' visibility
inv VisibleValue ('Only \'LiteralValue\'s defined within previous \'EventOccurrence\'s of the containing \'StructuredTestObjective\' may be referenced.' + self.toString()):
self.getTestObjective().contains(self.content)
and self.getTestObjective().indexOf(self.content) < self.getTestObjective().indexOf(self)
context ContentReference
-- Referenced 'Content' visibility
inv VisibleContent ('Only \'Content\' defined within previous \'EventOccurrence\'s of the containing \'StructuredTestObjective\' may be referenced.' + self.toString()):
self.getTestObjective().contains(self.content)
and self.getTestObjective().indexOf(self.content) < self.getTestObjective().indexOf(self)
context DataReference
-- 'DataUse' restrictions within 'DataReference'
inv DataReferenceContents ('Only \'StaticDataUse\' may be used directly or indirectly in \'ParameterBinding\'s of the \'StaticDataUse\' within a \'DataReference\'.' + self.toString()):
self.content.oclIsTypeOf(StaticDataUse)
and self.content.argument->forAll(a | a.dataUse.oclIsKindOf(StaticDataUse))
and self.content.argument->closure(a |
a.dataUse.argument)->forAll(a|a.dataUse.oclIsKindOf(StaticDataUse))
-- No 'reduction' within 'DataReference'
inv DataReferenceReduction ('The \'reduction\' property of \'StaticDataUse\' inherited from \'DataUse\' shall not be used within a \'DataReference\'.' + self.toString()):
self.content.reduction->isEmpty()
context EventTemplateOccurrence
-- 'EntityReference' of referenced 'EventSpecificationTemplate'
inv EntityTemplateOccurrenceConsistency ('If \'EntityBinding\'s are provided, the \'Entity\'s or \'ComponentInstance\'s referenced in the \'templateEntity\' properties shall also be referenced by one of the \'EntityReferences\' in the \'EventOccurrenceSpecification\' of the \'EventSpecificationTemplate\' referenced in the \'EventTemplateOccurrence\'.' + self.toString()):
self.entityBinding->forAll(b |
(not b.templateEntity.entity.oclIsUndefined()
and (b.templateEntity.entity =
self.eventTemplate.eventSpecification.entityReference.entity))
or (not b.templateEntity.component.oclIsUndefined()
and (b.templateEntity.component =
self.eventTemplate.eventSpecification.entityReference.component)
or self.eventTemplate.eventSpecification.oppositeEntityReference->exists(e |
(not b.templateEntity.entity.oclIsUndefined()
and (e.entity = b.templateEntity.entity))
or (not b.templateEntity.component.oclIsUndefined()
and (e.component = b.templateEntity.component)))))
context VariantBinding
-- Referenced 'Value' of 'VariantBinding'
inv VariantBindingValues ('If the \'value\' property references a \'LiteralValue\' or \'Content\' element, the referenced element shall be contained in the \'StructuredTestObjective\' containing the \'VariantBinding\'.' + self.toString()):
self.value.oclIsTypeOf(LiteralValueReference) implies
self.value.oclAsType(LiteralValueReference).content.getTestObjective() = self.getTestObjective()
and
self.value.oclIsKindOf(ContentReference) implies
self.value.oclAsType(ContentReference).content.getTestObjective() = self.getTestObjective()
endpackage