-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathOccurrences.kerml
More file actions
992 lines (830 loc) · 37 KB
/
Copy pathOccurrences.kerml
File metadata and controls
992 lines (830 loc) · 37 KB
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
standard library package Occurrences {
doc
/*
* This package defines modeling constructs for anything existing or occurring in time and space, with
* associations between them that assert temporal and spatial relationships.
*/
private import Base::Anything;
private import Base::things;
private import Base::DataValue;
private import ScalarValues::Natural;
private import ScalarValues::Boolean;
private import Links::*;
private import Clocks::*;
private import Collections::Set;
private import Collections::OrderedSet;
private import CollectionFunctions::contains;
private import SequenceFunctions::isEmpty;
private import SequenceFunctions::notEmpty;
private import SequenceFunctions::includes;
private import SequenceFunctions::union;
abstract class Occurrence specializes Anything disjoint from DataValue {
doc
/*
* Occurrence is the most general classifier of entities that have identity and
* occur over time and space.
*
* The features of Occurrence specify the semantics of associations between occurrences that
* assert complete inclusion and exclusion in time or space, or both, which includes
* portions of an occurrence (having the same identity). Portions include slices and shots
* over time and space.
*/
private import SequenceFunctions::*;
feature portionOfLife: Life[1] subsets portionOf default self;
feature self: Occurrence[1] redefines Anything::self subsets timeSlices, spaceSlices, spaceTimeCoincidentOccurrences, sameLifeOccurrences;
feature sameLifeOccurrences: Occurrence[1..*] subsets things;
feature this : Occurrence[1] default self {
doc
/*
* The "context" Occurrence within which this Occurrence takes place. By default, it is this
* Occurrence itself. However, this is overridden for ownedPerformances of Objects and
* subperformances of Performances.
*/
}
connector :HappensDuring from [1] self to [1] this;
feature localClock : Clock[1] default universalClock {
doc
/*
* A local Clock to be used as the corresponding time reference for this Occurrence
* and, by default, all ownedOccurrences. By default this is the singleton universalClock.
*/
}
composite feature suboccurrences: Occurrence[0..*] subsets occurrences {
doc
/*
* Composite suboccurrences of this Occurrence.
*/
feature redefines localClock default (that as Occurrence).localClock {
doc
/*
* The localClock of a suboccurrence defaults to the localClock of its containing
* Occurrence.
*/
}
feature redefines incomingTransferSort default (that as Occurrence).incomingTransferSort;
}
/* Occurrences may be suboccurrences of no more than one other occurrence. */
feature superoccurrence: Occurrence[0..1] subsets occurrences inverse of suboccurrences;
feature withoutOccurrences: Occurrence[0..*] unions successors, predecessors, outsideOfOccurrences
inverse of withoutOccurrences {
doc
/*
* Occurrences that are completely separate either in time or space or both.
*/
/* withoutOccurrences is irreflexive. */
inv { (that as Occurrence) != (that.that as Occurrence) }
}
feature predecessors: Occurrence[0..*] subsets withoutOccurrences {
doc
/*
* Occurrences that end before this occurrence starts.
*/
}
feature successors: Occurrence[0..*] subsets withoutOccurrences inverse of predecessors {
doc
/*
* Occurrences that start after this occurrence ends.
*/
/* successors is transitive. */
feature earlierOccurrence: Occurrence[1] subsets that;
feature laterOccurrence: Occurrence[1] subsets self;
subset laterOccurrence.successors subsets earlierOccurrence.successors;
}
feature immediatePredecessors: Occurrence[0..*] subsets predecessors {
doc
/*
* Occurrences that end just before this occurrence starts, with no
* possibility of other occurrences happening in the time between them.
*/
}
feature immediateSuccessors: Occurrence[0..*] subsets successors inverse of immediatePredecessors {
doc
/*
* Occurrences that start just after this occurrence ends, with no
* possibility of other occurrences happening in the time between them.
*/
disjoint earlierOccurrence.successors from laterOccurrence.predecessors;
}
feature timeEnclosedOccurrences: Occurrence[1..*] subsets occurrences {
doc
/*
* Occurrences that start no earlier than and end no later than
* this occurrence, including at least this occurrence.
*/
/*
* timeEnclosedOccurrences and successors constrain each other. All successors of
* (occurrences happening after) time enclosing occurrences (inverse of
* timeEnclosedOccurrences) are also successors of their timeEnclosedOccurrences.
* And predecessors of (occurrences happening before) time enclosing occurrences
* are predecessors of their timeEnclosedOccurrences.
*/
feature longerOccurrence: Occurrence[1] subsets that;
feature shorterOccurrence: Occurrence[1] subsets self;
subset longerOccurrence.predecessors subsets shorterOccurrence.predecessors;
subset longerOccurrence.successors subsets shorterOccurrence.successors;
/* timeEnclosedOccurrences is transitive. */
subset shorterOccurrence.timeEnclosedOccurrences subsets longerOccurrence.timeEnclosedOccurrences;
}
feature all timeCoincidentOccurrences: Occurrence[1..*] subsets timeEnclosedOccurrences inverse of timeCoincidentOccurrences {
doc
/*
* Occurrences that start at the same time and end at the same time as this occurrence,
* including at least this occurrence.
*/
feature thatOccurrence: Occurrence[1] subsets longerOccurrence;
feature thisOccurrence: Occurrence[1] subsets shorterOccurrence;
/* timeCoincidentOccurrences occurrences happen during each other. */
connector :HappensDuring
from [1] shorterOccurrence references thisOccurrence
to [1] longerOccurrence references thatOccurrence;
/* timeCoincidentOccurrences is transitive */
subset thatOccurrence.timeCoincidentOccurrences
subsets thisOccurrence.timeCoincidentOccurrences;
}
feature spaceEnclosedOccurrences: Occurrence[1..*] subsets occurrences {
doc
/*
* Occurrences that this one completely includes in space (not necessarily in time),
* including this one.
*/
feature largerSpace: Occurrence[1] subsets that;
feature smallerSpace: Occurrence[1] subsets self;
/* spaceEnclosedOccurrences is transitive. */
subset smallerSpace.spaceEnclosedOccurrences subsets largerSpace.spaceEnclosedOccurrences;
/* smallerSpace are outside occurrences that are outside their largerSpace */
subset smallerSpace.outsideOfOccurrences subsets largerSpace.outsideOfOccurrences;
}
feature all spaceTimeEnclosedOccurrences: Occurrence[1..*] subsets timeEnclosedOccurrences, spaceEnclosedOccurrences
intersects timeEnclosedOccurrences, spaceEnclosedOccurrences {
doc
/*
* Occurrences that this one completely includes in both space and time,
* including this one.
*/
/* spaceTimeEnclosedOccurrences is transitive */
subset largerSpace.spaceTimeEnclosedOccurrences subsets smallerSpace.spaceTimeEnclosedOccurrences;
}
feature all spaceTimeEnclosedPoints : Occurrence[1..*] subsets spaceTimeEnclosedOccurrences {
doc
/*
* All space time enclosed occurrences that take up zero time and space.
*/
redefines innerSpaceDimension = 0;
binding [1] startShot = [1] endShot;
}
feature spaceTimeCoincidentOccurrences: Occurrence[1..*]
subsets timeCoincidentOccurrences, spaceEnclosedOccurrences, spaceTimeEnclosedOccurrences
intersects timeCoincidentOccurrences, spaceEnclosedOccurrences inverse of spaceTimeCoincidentOccurrences {
doc
/*
* Occurrences that this one completely includes in both space and time,
* and vice-versa, including this one.
*/
feature redefines thatOccurrence subsets largerSpace;
feature redefines thisOccurrence subsets smallerSpace;
/* spaceTimeCoincidentOccurrences occurrences are inside of each other. */
connector :InsideOf
from [1] largerSpace references thatOccurrence
to [1] smallerSpace references thisOccurrence;
/* spaceTimeCoincidentOccurrences is transitive */
subset thatOccurrence.spaceTimeCoincidentOccurrences
subsets thisOccurrence.spaceTimeCoincidentOccurrences;
}
feature outsideOfOccurrences: Occurrence[0..*] subsets withoutOccurrences inverse of outsideOfOccurrences {
doc
/*
* Occurrences that do not overlap in space (not necessarily in time, see successors).
*/
}
feature justOutsideOfOccurrences: Occurrence[0..*] subsets outsideOfOccurrences inverse of justOutsideOfOccurrences {
doc
/*
* Occurrences that have no space between some of their space slices and some space slices of this occurrence.
*/
feature separateSpaceToo: Occurrence[1] subsets that;
feature separateSpace: Occurrence[1] subsets self;
connector :MatesWith [1..*]
from [0..*] separateSpaceToo references separateSpaceToo.spaceSlices
to [0..*] separateSpace references separateSpace.spaceSlices;
}
feature matingOccurrences: Occurrence[1..*] subsets justOutsideOfOccurrences inverse of matingOccurrences {
doc
/*
* Occurrences that have no space between them and this one.
*/
feature matingSpaceToo: Occurrence[1] subsets that;
feature matingSpace: Occurrence[1] subsets self;
feature matingOccurrence: Occurrence [1] {
portion feature redefines spaceBoundary [1];
inv { contains(unionsOf, union(matingSpaceToo, matingSpace)) }
portion feature redefines spaceInterior [0];
}
}
feature innerSpaceDimension : Natural [1] {
doc
/*
* The number of variables needed to identify space points in this occurrence, from 0
* to 3, without regard to higher dimensional spaces it might be embedded in.
*/
}
inv { innerSpaceDimension <= 3 }
feature outerSpaceDimension : Natural [0..1] {
doc
/*
* For occurrences of innerSpaceDimension 1 or 2, the number of variables needed to
* identify their space points in higher dimensions they might be embedded in, from
* the innerSpaceDimension to 3. An outerSpaceDimension equal to innerSpaceDimension
* indicates the occurrence is spatially straight (innerSpaceDimension 1 embedded in
* 2 or 3 dimensions) or flat (innerSpaceDimension 2 embedded in 3 dimensions).
*/
}
inv { notEmpty(outerSpaceDimension) implies
(outerSpaceDimension >= innerSpaceDimension & outerSpaceDimension <= 3) }
portion feature all portions: Occurrence[1..*] subsets spaceTimeEnclosedOccurrences {
doc
/*
* All spaceTimeEnclosedOccurrences that have the same portionOfLife (considered the same
* thing occurring).
*/
portion redefines portionOfLife = (that as Occurrence).portionOfLife;
}
feature portionOf : Occurrence[1..*] inverse of portions {
doc
/*
* Occurrences of which this occurrence is a portion, including at
* least this occurrence.
*/
}
portion feature timeSlices: Occurrence[1..*] subsets portions {
doc
/*
* Portions of an occurrence taking up all of its space over some period of time,
* including at least this occurrence.
*/
}
feature timeSliceOf : Occurrence[1..*] subsets portionOf inverse of timeSlices {
doc
/*
* Occurrences of which this occurrence is a time slice, including at least this
* occurrence.
*/
feature timeSliceOccurrence: Occurrence[1] subsets that;
feature timeSlicedOccurrence: Occurrence[1] subsets self;
/* timeSliceOf is transitive */
subset timeSlicedOccurrence.timeSliceOf subsets timeSliceOccurrence.timeSliceOf;
}
portion feature all snapshots: Occurrence[1..*] subsets timeSlices {
doc
/*
* Time slices of an occurrence that happen at a single instant of time
* (i.e., have no duration).
*/
binding [1] startShot = [1] endShot;
}
inv { snapshots == union(startShot, union(middleTimeSlice.snapshots, endShot)) }
feature snapshotOf : Occurrence[0..*] subsets timeSliceOf inverse of snapshots {
doc
/*
* Occurrences of which this occurrence is a snapshot.
*/
}
portion feature startShot: Occurrence[1] subsets snapshots {
doc
/*
* The snapshot representing the start of the occurrence in time.
*/
}
portion feature middleTimeSlice: Occurrence[0..1] subsets timeSlices {
doc
/*
* A time slice that takes all the time between the start shot and end shot. There
* is none when the startShot and endShot are the same.
*/
}
inv { isEmpty((that as Occurrence).middleTimeSlice) == ((that as Occurrence).startShot == (that as Occurrence).endShot) }
connector :HappensJustBefore
from [1] earlierOccurrence references startShot
to [0..1] laterOccurrence references middleTimeSlice {
doc
/*
* The startShot happens immediately before the middle time slice.
*/
}
portion feature endShot: Occurrence[1] subsets snapshots {
doc
/*
* The snapshot at the end of the occurrence in time.
*/
/* suboccurrences at the end of an Occurrence must also end. */
feature subendshot : Occurrence [0..*] chains self.suboccurrences.endShot {
feature superendshot : Occurrence [1] subsets that;
subset superendshot subsets self.timeCoincidentOccurrences; }
}
connector :HappensJustBefore
from [0..1] earlierOccurrence references middleTimeSlice
to [1] laterOccurrence references endShot {
doc
/*
* The endShot happens after the middle time slice.
*/
}
portion feature spaceSlices: Occurrence[1..*] subsets portions {
doc
/*
* Portions of this occurrence that extend for exactly the same time and some or all
* the space, relative to spatial location of this occurrence, including at least
* this occurrence.
*/
}
feature spaceSliceOf: Occurrence[1..*] subsets portionOf inverse of spaceSlices {
doc
/*
* Occurrences of which this occurrence is a space slice, including at least this
* occurrence.
*/
feature spaceSliceOccurrence: Occurrence[1] subsets that;
feature spaceSlicedOccurrence: Occurrence[1] subsets self;
inv { spaceSliceOccurrence.innerSpaceDimension <= spaceSlicedOccurrence.innerSpaceDimension }
/* spaceSliceOf is transitive */
subset spaceSlicedOccurrence.spaceSliceOf subsets spaceSliceOccurrence.spaceSliceOf;
}
portion feature spaceShots: Occurrence[1..*] subsets spaceSlices {
doc
/*
* All spaceSlices of this occurrence that are of a lower inner space dimension than it.
*/
}
feature all spaceShotOf: Occurrence[0..*] subsets spaceSliceOf inverse of spaceShots {
doc
/*
* All occurrences of which this occurrence is a space shot.
*/
feature spaceShotOccurrence: Occurrence[1] subsets that;
feature spaceShottedOccurrence: Occurrence[1] subsets self;
inv { spaceShotOccurrence.innerSpaceDimension < spaceShottedOccurrence.innerSpaceDimension }
/* spaceShotOf is transitive */
subset spaceShottedOccurrence.spaceShotOf subsets spaceShotOccurrence.spaceShotOf;
}
feature unionsOf: Set[0..*] {
doc
/*
* Sets of occurrences, where the time and space taken by all the occurrences in each
* set together is the same as taken by this occurrence (all four dimensional points in
* the occurrences of each set are at the same time and space as those of this
* occurrence).
*/
feature redefines elements: Occurrence[0..*];
feature union: Occurrence[0..1];
connector :Within
from [0..*] smallerOccurrence references elements
to [1] largerOccurrence references union;
connector :Within
from [0..*] smallerOccurrence references union.spaceTimeEnclosedPoints
to [1..*] largerOccurrence references elements;
}
binding [0..1] unionsOf.union = [1] self;
feature intersectionsOf: Set[0..*] {
doc
/*
* Sets of occurrences, where the time and space taken in common between the occurrences
* in each set is at the same as taken by this occurrence (all four dimensional points
* common to the occurrences in each set are at the same time and space as those in this
* occurrence).
*/
feature redefines elements: Occurrence[0..*] {
feature all notIntersection: Occurrence[0..*] subsets spaceTimeEnclosedPoints;
}
feature intersection: Occurrence[0..1];
connector :Within
from [1] smallerOccurrence references intersection
to [0..*] largerOccurrence references elements;
connector :Without
from [0..*] separateOccurrenceToo references elements.notIntersection
to [1] separateOccurrence references intersection;
connector :Without
from [0..*] separateOccurrenceToo references elements.notIntersection
to [1..*] separateOccurrence references elements;
}
binding [0..1] intersectionsOf.intersection = [1] self;
feature differencesOf: OrderedSet[0..*] {
doc
/*
* Ordered sets of occurrences, where the time and space taken by first occurrence in
* each set that is not in the time and space taken by the remaining occurrences is the
* same as taken by this occurrence (all four dimensional points in the minuend that are
* not in any subtrahend are at the same time and space as those in this occurrence).
*/
feature redefines elements: Occurrence[0..*];
feature difference: Occurrence[0..1];
feature minuend: Occurrence [0..1] subsets elements, interdiff.elements = head(elements);
feature subtrahend: Occurrence[*] subsets elements = tail(elements);
feature interdiff: Set [0..1] {
feature redefines elements: Occurrence[1..*];
feature all notSubtrahend: Occurrence [0..*] subsets elements;
}
connector :Without
from [0..*] separateOccurrenceToo references interdiff.notSubtrahend
to [1..*] separateOccurrence references subtrahend;
inv { isEmpty(difference) == isEmpty(interdiff) }
inv { notEmpty(difference) implies (difference.intersectionsOf == interdiff) }
}
binding [0..1] differencesOf.difference = [1] self;
portion feature spaceInterior: Occurrence[0..1] subsets spaceSlices {
doc
/*
* A space slice of this occurrence that includes all its space shots except the
* space boundary, which must exist and be outsideOf it. The space interior must be
* of the same inner space dimension as this occurrence, except if it is zero,
* whereupon there is no space interior.
*/
}
feature spaceInteriorOf: Occurrence[0..1] subsets spaceSliceOf inverse of spaceInterior {
doc
/*
* An Occurrence of which this one is the space interior.
*/
}
inv { notEmpty(spaceInterior) implies spaceInterior.innerSpaceDimension == innerSpaceDimension }
portion feature spaceBoundary: Occurrence[0..1] subsets spaceShots {
doc
/*
* The space shot of this Occurrence that is not among those of its space interior,
* which must be outside it. It must not have a spaceBoundary. It can be divided
* into space slices that also have no spaceBoundary, where the outer one surrounds
* the inner ones.
*/
feature redefines isClosed = true;
feature spaceBounder: Occurrence [1] subsets self;
outer: Occurrence [0..1] subsets spaceSlices {
feature redefines isClosed = true;
feature redefines innerSpaceDimension = spaceBounder.innerSpaceDimension;
}
inner: Occurrence [0..*] subsets spaceSlices {
feature redefines isClosed = true;
feature redefines innerSpaceDimension = spaceBounder.innerSpaceDimension;
}
inv { notEmpty(inner) implies notEmpty(outer) }
inv { notEmpty(outer) implies
contains(unionsOf, union(outer, inner)) }
}
feature spaceBoundaryOf: Occurrence[0..*] subsets spaceShotOf inverse of spaceBoundary {
doc
/*
* An Occurrence of which this one is the space boundary.
*/
feature spaceBounderOf: Occurrence subsets self;
inv { spaceBounderOf.spaceBoundary == that.that }
}
inv { not isClosed implies contains((that as Occurrence).unionsOf, union(spaceBoundary, spaceInterior)) }
inv { innerSpaceDimension == 0 implies isEmpty(spaceBoundary) }
connector :SurroundedBy
from [0..*] surroundedSpace references spaceInterior
to [1] surroundingSpace references spaceBoundary.outer;
connector :SurroundedBy
from [0..*] surroundedSpace references spaceBoundary.inner
to [1] surroundingSpace references spaceInterior;
feature innerSpaceOccurrences: Occurrence [0..*] subsets outsideOfOccurrences {
doc
/*
* Occurrences that completely occupy the space surrounded by an inner space boundary of this occurrence.
*/
feature redefines innerSpaceOccurrences [0];
/* innerSpace is the spaceInterior of hOccurrence, which is formed from an inner space boundary of outerSpace. */
feature outerSpace: Occurrence[1] subsets that;
feature innerSpace: Occurrence[1] subsets self;
feature hOccurrence: Occurrence [1];
connector hbi: WithinBoth [0..1] from [0..1] hOccurrence.spaceBoundary to [0..1] outerSpace.spaceBoundary.inner;
connector hbo: WithinBoth [0..1] from [0..1] hOccurrence.spaceBoundary to [0..1] outerSpace;
connector :WithinBoth from [1] hOccurrence.spaceInterior to [1] innerSpace;
inv { (isEmpty(hbi) == notEmpty(hbo)) & (notEmpty(hbo) == outerSpace.isClosed) }
}
feature surroundedByOccurrences: Occurrence [0..*] subsets outsideOfOccurrences {
doc
/*
* Occurrences that have inner spaces that completely include this occurrence.
*/
feature surroundedSpace: Occurrence [1] subsets that;
feature surroundingSpace: Occurrence [1] subsets self;
connector :InsideOf
from [0..1] smallerOccurrence references surroundedSpace
to [1..*] largerOccurrence references surroundingSpace.innerSpaceOccurrences;
}
feature isClosed : Boolean [1] {
doc
/*
* Tells whether an occurrence has a spaceBoundary, true if it does, false otherwise.
*/
}
inv { isClosed == isEmpty((that as Occurrence).spaceBoundary) }
var feature incomingTransfers: Transfers::Transfer[0..*] subsets Transfers::transfers {
doc
/*
* The incoming transfers received by this occurrence.
*/
end feature redefines source;
end feature redefines target;
}
feature isDispatch : Boolean[1] default false {
doc
/*
* Determines whether transfers to the dispatch scope might be accepted more than once.
*/
}
feature dispatchScope: Occurrence [1] default self;
connector :HappensDuring from [1] self to [1] dispatchScope;
feature isRunToCompletion: Boolean [1] default true {
doc
/*
* Determines whether transition performances might happen during state entry performances
* within the run to completion scope.
*/
}
feature runToCompletionScope: Occurrence [1] default self;
connector :HappensDuring from [1] self to [1] runToCompletionScope;
feature incomingTransferSort : IncomingTransferSort [0..*] default earlierFirstIncomingTransferSort {
doc
/*
* Determines which transfer to accept when multiple are available and which of the unaccepted
* transfers are never to be accepted (dispatched).
*/
}
var feature all incomingTransfersToSelf subsets incomingTransfers {
doc
/*
* The incoming transfers with this occurrence as the target.
*/
end feature redefines source;
end feature redefines target = that;
}
var feature outgoingTransfers: Transfers::Transfer[0..*] subsets Transfers::transfers {
doc
/*
* The outgoing transfers sent from this occurrence.
*/
end feature redefines source;
end feature redefines target;
}
var feature all outgoingTransfersFromSelf subsets outgoingTransfers {
doc
/*
* The outgoing transfers with this occurrence as the source.
*/
end feature redefines source = that;
end feature redefines target;
}
}
abstract class all Life specializes Occurrence {
binding portionOf = self {
doc
/*
* Lives are only portions of themselves.
*/
}
}
abstract feature occurrences: Occurrence[0..*] nonunique subsets things;
predicate IncomingTransferSort specializes Performances::BooleanEvaluation {
in t1: Transfers::Transfer [1];
in t2: Transfers::Transfer [1];
return t1First: Boolean [1];
}
bool earlierFirstIncomingTransferSort : IncomingTransferSort {
return t1First = includes(t1.endShot.successors, t2.endShot);
}
assoc all SelfSameLifeLink specializes BinaryLink {
doc
/*
* SelfSameLifeLink is a binary association that is equivalent to SelfLink if the
* linked things are DataValues, but asserts that the linked things are portions of
* the same Life if they are Occurrences.
*/
end myselfSameLives [1..*] feature myselfSameLife: Anything redefines source;
end selfSameLives [1..*] feature selfSameLife: Anything redefines target;
feature all sourceOccurrence : Occurrence [0..1] subsets myselfSameLife;
feature all targetOccurrence : Occurrence [0..1] subsets selfSameLife, sourceOccurrence.sameLifeOccurrences;
binding oSelf of sourceOccurrence.portionOfLife = targetOccurrence.portionOfLife;
feature all sourceDataValue : DataValue [0..1] subsets myselfSameLife;
feature all targetDataValue : DataValue [0..1] subsets selfSameLife;
binding dSelf of sourceDataValue = targetDataValue;
}
subclassifier SelfLink specializes SelfSameLifeLink;
assoc HappensLink specializes BinaryLink disjoint from Occurrence {
doc
/*
* HappensLink is the most general associations that assert temporal relationships between a
* sourceOccurrence and a targetOccurrence. Because HappensLinks assert temporal
* relationships, they cannot also be Occurrences that happen in time. Therefore
* HappensLink is disjoint with LinkObject, that is, no HappensLink can also be a
* LinkObject.
*/
end feature sourceOccurrence: Occurrence redefines BinaryLink::source;
end feature targetOccurrence: Occurrence redefines BinaryLink::target;
}
assoc all HappensDuring specializes HappensLink {
doc
/*
* HappensDuring asserts that the shorterOccurrence happens during the longerOccurrence.
* That is, the time interval of the shorterOccurrence is completely within that of the
* longerOccurrence, or every snapshot of the shorterOccurrence happens while (at the
* same time as) some snapshot of the longerOccurrence. Note that this means every
* Occurrence HappensDuring itself and that HappensDuring is transitive.
*/
end feature shorterOccurrence: Occurrence redefines sourceOccurrence crosses longerOccurrence.timeEnclosedOccurrences;
end happensDuring [1..*] feature longerOccurrence: Occurrence redefines targetOccurrence;
}
assoc all HappensWhile specializes HappensDuring {
doc
/*
* HappensWhile asserts that two occurrences happen during each other, that is, they
* each start at the same time and end at the same time.
*/
end feature thisOccurrence: Occurrence redefines shorterOccurrence crosses thatOccurrence.timeCoincidentOccurrences;
end happensWhile [1..*] subsets timeCoincidentOccurrences feature thatOccurrence: Occurrence redefines longerOccurrence;
}
assoc SpaceLink specializes BinaryLink disjoint from Occurrence {
doc
/*
* SpaceLink is the most general association that asserts spatial relationships between a
* sourceOccurrence and a targetOccurrence. Because SpaceLinks assert spatial
* relationships, they cannot also be Occurrences that happen in space. Therefore
* SpaceLink is disjoint with LinkObject, that is, no SpaceLink can also be a
* LinkObject.
*/
end feature sourceOccurrence: Occurrence redefines BinaryLink::source;
end feature targetOccurrence: Occurrence redefines BinaryLink::target;
}
assoc all InsideOf specializes SpaceLink {
doc
/*
* InsideOf asserts that its largerSpace completely overlaps its smallerSpace in space (not
* necessarily in time, see HappensDuring). That is, all four dimensional points of the
* smallerSpace are in the spatial extent of the largerSpace. Note that this means every
* Occurrence is InsideOf itself and that InsideOf is transitive.
*/
end feature smallerSpace: Occurrence redefines source crosses largerSpace.spaceEnclosedOccurrences;
end insideOf [1..*] feature largerSpace: Occurrence redefines target;
}
assoc all Within specializes HappensDuring, InsideOf intersects HappensDuring, InsideOf {
doc
/*
* Within asserts that its largerOccurrence completely overlaps its smallerOccurrence in
* time and space. That is, all four dimensional points of the smallerOccurrence happen
* during and are included in the space of the largerOccurrence. This means every occurrence
* is Within itself and Within is transitive.
*/
end feature smallerOccurrence: Occurrence redefines shorterOccurrence, smallerSpace
crosses largerOccurrence.spaceTimeEnclosedOccurrences;
end within [1..*] feature largerOccurrence: Occurrence redefines longerOccurrence, largerSpace;
}
assoc all WithinBoth specializes Within, HappensWhile {
doc
/*
* WithinBoth asserts that two occurrences are Within each other, that is, they occupy the
* same four dimensional region. Note that this means every Occurrence is WithinBoth with
* itself and transitive.
*/
end feature thisOccurrence redefines smallerOccurrence, HappensWhile::thisOccurrence
crosses thatOccurrence.spaceTimeCoincidentOccurrences;
end withinBoth subsets spaceTimeCoincidentOccurrences feature thatOccurrence redefines largerOccurrence, HappensWhile::thatOccurrence;
}
assoc all PortionOf specializes Within {
doc
/*
* PortionOf asserts one occurrence is a portion of another, including at least itself.
*/
end feature portionOccurrence: Occurrence redefines smallerOccurrence crosses portionedOccurrence.portions;
end portionWithin subsets portionOf feature portionedOccurrence: Occurrence redefines largerOccurrence;
}
assoc all TimeSliceOf specializes PortionOf {
doc
/*
* TimeSliceOf asserts one occurrence is a time slice of another, including at least itself.
*/
end feature timeSliceOccurrence: Occurrence redefines portionOccurrence crosses timeSlicedOccurrence.timeSlices;
end timeSliceWithin subsets timeSliceOf feature timeSlicedOccurrence: Occurrence redefines portionedOccurrence;
}
assoc all SnapshotOf specializes TimeSliceOf {
doc
/*
* SnapshotsOf asserts one occurrence is a snapshot of another.
*/
end feature snapshotOccurrence: Occurrence redefines timeSliceOccurrence crosses snapshottedOccurrence.snapshots;
end snapshotWithin subsets snapshotOf feature snapshottedOccurrence: Occurrence redefines timeSlicedOccurrence;
}
assoc all SpaceSliceOf specializes PortionOf {
doc
/*
* SpaceSliceOf asserts that its spaceSliceOccurrence extends for exactly the same time and
* some or all the space of the spaceSlicedOccurrence and that the spaceSliceOccurrence is
* of the same of lower innerSpaceDimension than the spaceSliceOccurrence. Note that this
* means every occurrence is a SpaceSliceOf itself and SpaceSliceOf is transitive.
*/
end feature spaceSliceOccurrence: Occurrence redefines portionOccurrence crosses spaceSlicedOccurrence.spaceSlices;
end spaceSliceWithin subsets spaceSliceOf feature spaceSlicedOccurrence: Occurrence redefines portionedOccurrence;
}
assoc all SpaceShotOf specializes SpaceSliceOf {
doc
/*
* SpaceShotOf asserts that its spaceShotOccurrence is of a lower inner space dimension than
* it spaceShottedOccurrence.
*/
end feature spaceShotOccurrence: Occurrence redefines spaceSliceOccurrence crosses spaceShottedOccurrence.spaceShots;
end spaceShotWithin subsets spaceSliceOf feature spaceShottedOccurrence: Occurrence redefines spaceSlicedOccurrence;
}
assoc all Without specializes BinaryLink unions HappensBefore, OutsideOf {
doc
/*
* Without is the most general association that asserts complete separation (no overlap) in
* either space or time, or both, between two occurrences. That is, no four dimensional
* points are in both occurrences. Note that this means no Occurrence is Without itself.
*/
end feature separateOccurrenceToo: Occurrence redefines BinaryLink::source
crosses separateOccurrence.withoutOccurrences;
end feature separateOccurrence: Occurrence redefines BinaryLink::target
crosses separateOccurrenceToo.withoutOccurrences;
}
assoc all HappensBefore specializes HappensLink, Without {
doc
/*
* HappensBefore asserts that the earlierOccurrence is completely separated in time (not
* necessarily in space, see OutsideOf), with the earlierOccurrence happening completely
* before the laterOccurrence. That is, no snapshot of the earlierOccurrence happens at the
* same time as any snapshot of the laterOccurrence, with all snapshots of earlierOccurrence
* happening before those the laterOccurrence, including the endShot of the earlierOccurrence
* and startShot of the laterOccurrence. Note that this means no Occurrence HappensBefore
* itself.
*/
end feature earlierOccurrence: Occurrence redefines sourceOccurrence, separateOccurrenceToo
crosses laterOccurrence.predecessors;
end feature laterOccurrence: Occurrence redefines targetOccurrence, separateOccurrence
crosses earlierOccurrence.successors;
}
assoc all HappensJustBefore specializes HappensBefore {
doc
/*
* HappensJustBefore is HappensBefore asserting that there is no possibility of another
* occurrences happening in the time between the earlierOccurrence and laterOccurrence.
*/
end feature redefines earlierOccurrence: Occurrence crosses laterOccurrence.immediatePredecessors;
end feature redefines laterOccurrence: Occurrence crosses earlierOccurrence.immediateSuccessors;
}
feature all happensBeforeLinks: HappensBefore[0..*] nonunique subsets binaryLinks {
doc
/*
* happensBeforeLinks is a specialization of binaryLinks restricted to type HappensBefore.
* It is the default subsetting for succession connectors.
*/
end feature earlierOccurrence: Occurrence redefines HappensBefore::earlierOccurrence, binaryLinks::source;
end feature laterOccurrence: Occurrence redefines HappensBefore::laterOccurrence, binaryLinks::target;
}
assoc all OutsideOf specializes SpaceLink, Without {
doc
/*
* OutsideOf asserts that two occurrences do not overlap in space (not necessarily in time,
* see HappensBefore). That is, no four dimensional points of the occurrences are in the
* spatial extent of both of them. This means no Occurrence is OutsideOf itself.
*/
end feature separateSpaceToo: Occurrence redefines sourceOccurrence, separateOccurrenceToo
crosses separateSpace.outsideOfOccurrences;
end feature separateSpace: Occurrence redefines targetOccurrence, separateOccurrence
crosses separateSpaceToo.outsideOfOccurrences;
}
assoc all JustOutsideOf specializes OutsideOf {
doc
/*
* JustOutsideOf is an OutsideOf asserting that two occurrences have some space slices with
* no space between them.
*/
end feature redefines separateSpaceToo: Occurrence
crosses separateSpace.justOutsideOfOccurrences;
end feature redefines separateSpace: Occurrence
crosses separateSpaceToo.justOutsideOfOccurrences;
}
assoc all MatesWith specializes JustOutsideOf {
doc
/*
* MatesWith is an OutsideOf asserting that two occurrences have no space between them.
*/
end feature matingSpaceToo: Occurrence redefines separateSpaceToo
crosses matingSpace.matingOccurrences;
end feature matingSpace: Occurrence redefines separateSpace
crosses matingSpaceToo.matingOccurrences;
}
assoc all InnerSpaceOf specializes OutsideOf {
doc
/*
* InnerSpaceOf is an OutsideOf asserting that the space surrounded by an inner space boundary
* of one occurrence (outer space) is completely occupied by another occurrence (inner space).
*/
end feature outerSpace: Occurrence redefines separateSpaceToo;
end feature innerSpace: Occurrence redefines separateSpace crosses outerSpace.innerSpaceOccurrences;
}
assoc all SurroundedBy specializes OutsideOf {
doc
/*
* SurroundedBy is an OutsideOf asserting that one occurrence (surrounded space) is included
* in space by an inner space occurrence of another (surrounding space).
*/
end feature surroundedSpace: Occurrence redefines separateSpaceToo;
end feature surroundingSpace: Occurrence redefines separateSpace crosses surroundedSpace.surroundedByOccurrences;
}
}