sysml-validate 0.11.0 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/LICENSE +27 -27
  2. package/README.md +200 -200
  3. package/out/main.js +596 -141
  4. package/out/main.js.map +4 -4
  5. package/package.json +57 -57
  6. package/resources/sysml.dimension-table.json +1 -1
  7. package/resources/sysml.library/Domain Libraries/Analysis/.meta.json +9 -9
  8. package/resources/sysml.library/Domain Libraries/Analysis/.project.json +26 -26
  9. package/resources/sysml.library/Domain Libraries/Analysis/AnalysisTooling.sysml +33 -33
  10. package/resources/sysml.library/Domain Libraries/Analysis/SampledFunctions.sysml +118 -118
  11. package/resources/sysml.library/Domain Libraries/Analysis/StateSpaceRepresentation.sysml +143 -143
  12. package/resources/sysml.library/Domain Libraries/Analysis/TradeStudies.sysml +170 -170
  13. package/resources/sysml.library/Domain Libraries/Cause and Effect/.meta.json +7 -7
  14. package/resources/sysml.library/Domain Libraries/Cause and Effect/.project.json +22 -22
  15. package/resources/sysml.library/Domain Libraries/Cause and Effect/CausationConnections.sysml +82 -82
  16. package/resources/sysml.library/Domain Libraries/Cause and Effect/CauseAndEffect.sysml +81 -81
  17. package/resources/sysml.library/Domain Libraries/Geometry/.meta.json +7 -7
  18. package/resources/sysml.library/Domain Libraries/Geometry/.project.json +26 -26
  19. package/resources/sysml.library/Domain Libraries/Geometry/ShapeItems.sysml +898 -898
  20. package/resources/sysml.library/Domain Libraries/Geometry/SpatialItems.sysml +167 -167
  21. package/resources/sysml.library/Domain Libraries/Metadata/.meta.json +9 -9
  22. package/resources/sysml.library/Domain Libraries/Metadata/.project.json +18 -18
  23. package/resources/sysml.library/Domain Libraries/Metadata/ImageMetadata.sysml +77 -77
  24. package/resources/sysml.library/Domain Libraries/Metadata/ModelingMetadata.sysml +142 -142
  25. package/resources/sysml.library/Domain Libraries/Metadata/ParametersOfInterestMetadata.sysml +38 -38
  26. package/resources/sysml.library/Domain Libraries/Metadata/RiskMetadata.sysml +99 -99
  27. package/resources/sysml.library/Domain Libraries/Quantities and Units/.meta.json +28 -28
  28. package/resources/sysml.library/Domain Libraries/Quantities and Units/.project.json +22 -22
  29. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQ.sysml +42 -42
  30. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQAcoustics.sysml +439 -439
  31. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQAtomicNuclear.sysml +2726 -2726
  32. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQBase.sysml +206 -206
  33. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQCharacteristicNumbers.sysml +1991 -1991
  34. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQChemistryMolecular.sysml +1353 -1353
  35. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQCondensedMatter.sysml +1223 -1223
  36. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQElectromagnetism.sysml +2333 -2333
  37. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQInformation.sysml +958 -958
  38. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQLight.sysml +1537 -1537
  39. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQMechanics.sysml +1564 -1564
  40. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQSpaceTime.sysml +1169 -1169
  41. package/resources/sysml.library/Domain Libraries/Quantities and Units/ISQThermodynamics.sysml +1256 -1256
  42. package/resources/sysml.library/Domain Libraries/Quantities and Units/MeasurementRefCalculations.sysml +30 -30
  43. package/resources/sysml.library/Domain Libraries/Quantities and Units/MeasurementReferences.sysml +526 -526
  44. package/resources/sysml.library/Domain Libraries/Quantities and Units/Quantities.sysml +107 -107
  45. package/resources/sysml.library/Domain Libraries/Quantities and Units/QuantityCalculations.sysml +70 -70
  46. package/resources/sysml.library/Domain Libraries/Quantities and Units/SI.sysml +378 -378
  47. package/resources/sysml.library/Domain Libraries/Quantities and Units/SIPrefixes.sysml +48 -48
  48. package/resources/sysml.library/Domain Libraries/Quantities and Units/TensorCalculations.sysml +49 -49
  49. package/resources/sysml.library/Domain Libraries/Quantities and Units/Time.sysml +274 -274
  50. package/resources/sysml.library/Domain Libraries/Quantities and Units/USCustomaryUnits.sysml +260 -260
  51. package/resources/sysml.library/Domain Libraries/Quantities and Units/VectorCalculations.sysml +62 -62
  52. package/resources/sysml.library/Domain Libraries/Requirement Derivation/.meta.json +7 -7
  53. package/resources/sysml.library/Domain Libraries/Requirement Derivation/.project.json +18 -18
  54. package/resources/sysml.library/Domain Libraries/Requirement Derivation/DerivationConnections.sysml +62 -62
  55. package/resources/sysml.library/Domain Libraries/Requirement Derivation/RequirementDerivation.sysml +38 -38
  56. package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/.meta.json +8 -8
  57. package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/.project.json +10 -10
  58. package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/Collections.kerml +176 -176
  59. package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/ScalarValues.kerml +23 -23
  60. package/resources/sysml.library/Kernel Libraries/Kernel Data Type Library/VectorValues.kerml +63 -63
  61. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/.meta.json +22 -22
  62. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/.project.json +14 -14
  63. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/BaseFunctions.kerml +79 -79
  64. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/BooleanFunctions.kerml +22 -22
  65. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/CollectionFunctions.kerml +68 -68
  66. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ComplexFunctions.kerml +47 -47
  67. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ControlFunctions.kerml +116 -116
  68. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/DataFunctions.kerml +42 -42
  69. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/IntegerFunctions.kerml +43 -43
  70. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/NaturalFunctions.kerml +27 -27
  71. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/NumericalFunctions.kerml +42 -42
  72. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/OccurrenceFunctions.kerml +153 -153
  73. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/RationalFunctions.kerml +49 -49
  74. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/RealFunctions.kerml +56 -56
  75. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/ScalarFunctions.kerml +32 -32
  76. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/SequenceFunctions.kerml +110 -110
  77. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/StringFunctions.kerml +25 -25
  78. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/TrigFunctions.kerml +34 -34
  79. package/resources/sysml.library/Kernel Libraries/Kernel Function Library/VectorFunctions.kerml +272 -272
  80. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/.meta.json +21 -21
  81. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/.project.json +14 -14
  82. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Base.kerml +94 -94
  83. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Clocks.kerml +155 -155
  84. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/ControlPerformances.kerml +134 -134
  85. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/FeatureReferencingPerformances.kerml +189 -189
  86. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/KerML.kerml +483 -483
  87. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Links.kerml +66 -66
  88. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Metaobjects.kerml +57 -57
  89. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Objects.kerml +212 -212
  90. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Observation.kerml +160 -160
  91. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Occurrences.kerml +992 -992
  92. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Performances.kerml +292 -292
  93. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/SpatialFrames.kerml +196 -196
  94. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/StatePerformances.kerml +144 -144
  95. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Transfers.kerml +280 -280
  96. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/TransitionPerformances.kerml +65 -65
  97. package/resources/sysml.library/Kernel Libraries/Kernel Semantic Library/Triggers.kerml +187 -187
  98. package/resources/sysml.library/LICENSE +276 -276
  99. package/resources/sysml.library/NOTICE.md +20 -20
  100. package/resources/sysml.library/Systems Library/Actions.sysml +556 -556
  101. package/resources/sysml.library/Systems Library/Allocations.sysml +28 -28
  102. package/resources/sysml.library/Systems Library/AnalysisCases.sysml +37 -37
  103. package/resources/sysml.library/Systems Library/Attributes.sysml +24 -24
  104. package/resources/sysml.library/Systems Library/Calculations.sysml +36 -36
  105. package/resources/sysml.library/Systems Library/Cases.sysml +70 -70
  106. package/resources/sysml.library/Systems Library/Connections.sysml +59 -59
  107. package/resources/sysml.library/Systems Library/Constraints.sysml +43 -43
  108. package/resources/sysml.library/Systems Library/Flows.sysml +125 -125
  109. package/resources/sysml.library/Systems Library/Interfaces.sysml +88 -88
  110. package/resources/sysml.library/Systems Library/Items.sysml +152 -152
  111. package/resources/sysml.library/Systems Library/Metadata.sysml +31 -31
  112. package/resources/sysml.library/Systems Library/Parts.sysml +80 -80
  113. package/resources/sysml.library/Systems Library/Ports.sysml +53 -53
  114. package/resources/sysml.library/Systems Library/Requirements.sysml +193 -193
  115. package/resources/sysml.library/Systems Library/StandardViewDefinitions.sysml +123 -123
  116. package/resources/sysml.library/Systems Library/States.sysml +102 -102
  117. package/resources/sysml.library/Systems Library/SysML.sysml +539 -539
  118. package/resources/sysml.library/Systems Library/UseCases.sysml +56 -56
  119. package/resources/sysml.library/Systems Library/VerificationCases.sysml +102 -102
  120. package/resources/sysml.library/Systems Library/Views.sysml +163 -163
  121. package/resources/sysml.library.index.json +1 -1
@@ -1,273 +1,273 @@
1
- standard library package VectorFunctions {
2
- doc
3
- /*
4
- * This package defines abstract functions on VectorValues corresponding to the algebraic operations
5
- * provided by a vector space with inner product. It also includes concrete implementations of these
6
- * functions specifically for CartesianVectorValues.
7
- */
8
-
9
- private import ScalarValues::NumericalValue;
10
- private import ScalarValues::Positive;
11
- private import ScalarValues::Real;
12
- private import ScalarValues::Boolean;
13
- private import NumericalFunctions::*;
14
- private import RealFunctions::sqrt;
15
- private import TrigFunctions::arccos;
16
- private import SequenceFunctions::size;
17
- private import ControlFunctions::*;
18
-
19
- public import VectorValues::*;
20
-
21
- /* Generic arithmetic functions for all VectorValues. */
22
-
23
- abstract function isZeroVector {
24
- doc
25
- /*
26
- * Return whether a VectorValue is a zero vector.
27
- */
28
-
29
- in v: VectorValue[1];
30
- return : Boolean[1];
31
- }
32
-
33
- abstract function '+' specializes DataFunctions::'+' {
34
- doc
35
- /*
36
- * With two arguments, returns the sum of two VectorValues. With one argument, returns that VectorValue.
37
- */
38
-
39
- in v: VectorValue[1];
40
- in w: VectorValue[0..1];
41
- return u: VectorValue[1];
42
- inv zeroAddition { w == null or isZeroVector(w) implies u == w }
43
- inv commutivity { w != null implies u == w + v }
44
- }
45
-
46
- abstract function '-' specializes DataFunctions::'-' {
47
- doc
48
- /*
49
- * With two arguments, returns the difference of two VectorValues. With one arguments, returns the inverse
50
- * of the given VectorValue, that is, the VectorValue that, when added to the original VectorValue, results in
51
- * the zeroVector.
52
- */
53
-
54
- in v: VectorValue[1];
55
- in w: VectorValue[0..1];
56
- return u: VectorValue[1];
57
- inv negation { w == null implies isZeroVector(v + u) }
58
- inv difference { w != null implies v + u == w }
59
- }
60
-
61
- abstract function sum0 {
62
- doc
63
- /*
64
- * Return the sum of a collection of VectorValues. If the collection is empty, return a given zero vector.
65
- */
66
-
67
- in coll: VectorValue[*] nonunique;
68
- in zero: VectorValue[1];
69
- inv precondition { isZeroVector(zero) }
70
- return s: VectorValue[1] = coll->reduce '+' ?? zero;
71
- }
72
-
73
- /* Functions specific to NumericalVectorValues. */
74
-
75
- function VectorOf {
76
- doc
77
- /*
78
- * Construct a NumericalVectorValue whose elements are a non-empty list of component NumericalValues.
79
- * The dimension of the NumericalVectorValue is equal to the number of components.
80
- */
81
-
82
- in components: NumericalValue[1..*] ordered nonunique;
83
- return : NumericalVectorValue[1] {
84
- :>> dimension = size(components);
85
- :>> elements = components;
86
- }
87
- }
88
-
89
- abstract function scalarVectorMult specializes DataFunctions::'*' {
90
- doc
91
- /*
92
- * Scalar product of a NumericalValue and a NumericalVectorValue.
93
- */
94
-
95
- in x: NumericalValue[1];
96
- in v: NumericalVectorValue[1];
97
- return w: NumericalVectorValue[1];
98
- inv scaling { norm(w) == x * norm(v) }
99
- inv zeroLength { isZeroVector(w) implies isZero(norm(w))}
100
- }
101
- alias '*' for scalarVectorMult;
102
-
103
- abstract function vectorScalarMult specializes DataFunctions::'*' {
104
- doc
105
- /*
106
- * Scalar product of a NumericalVectorValue and a NumericalValue, which has the same value as the scalar product of the
107
- * NumericalValue and the NumericalVectorValue.
108
- */
109
-
110
- in v: NumericalVectorValue[1];
111
- in x: NumericalValue[1];
112
- return w: NumericalVectorValue[1] default scalarVectorMult(x, v);
113
- }
114
-
115
- abstract function vectorScalarDiv specializes DataFunctions::'/' {
116
- doc
117
- /*
118
- * Scalar quotient of a NumericalVectorValue and a NumericalValue, defined as the scalar product of the inverse of the
119
- * NumericalValue and the NumericalVectorValue.
120
- */
121
-
122
- in v: NumericalVectorValue[1];
123
- in x: NumericalValue[1];
124
- return w: NumericalVectorValue[1] = scalarVectorMult(1.0 / x, v);
125
- }
126
-
127
- abstract function inner specializes DataFunctions::'*' {
128
- doc
129
- /*
130
- * Inner product of two NumericalVectorValues.
131
- */
132
-
133
- in v: NumericalVectorValue[1];
134
- in w: NumericalVectorValue[1];
135
- return x: NumericalValue[1];
136
- inv commmutivity { x == inner(w, v) }
137
- inv zeroInner { isZeroVector(v) or isZeroVector(w) implies isZero(x)}
138
- }
139
-
140
- abstract function norm {
141
- doc
142
- /*
143
- * The norm (magnitude) of a NumericalVectorValue, as a NumericalValue.
144
- */
145
-
146
- in v: NumericalVectorValue[1];
147
- return l : NumericalValue[1];
148
- inv squareNorm { l * l == inner(v,v) }
149
- inv lengthZero { isZero(l) == isZeroVector(v) }
150
- }
151
-
152
- abstract function angle {
153
- doc
154
- /*
155
- * The angle between two NumericalVectorValues, as a NumericalValue.
156
- */
157
-
158
- in v: NumericalVectorValue[1];
159
- in w: NumericalVectorValue[1];
160
- return theta: NumericalValue[1];
161
- inv commutivity { theta == angle(w, v) }
162
- inv lengthInsensitive { theta == angle(w / norm(w), v / norm(v)) }
163
- }
164
-
165
- /* Specialized functions with concrete definitions for CartesianVectorValues. */
166
-
167
- function CartesianVectorOf {
168
- doc
169
- /*
170
- * Construct a CartesianVectorValue whose elements are a non-empty list of Real components.
171
- * The dimension of the NumericalVectorValue is equal to the number of components.
172
- */
173
-
174
- in components: Real[*] ordered nonunique;
175
- return : CartesianVectorValue[1] {
176
- :>> dimension = size(components);
177
- :>> elements = components;
178
- }
179
- }
180
- function CartesianThreeVectorOf specializes CartesianVectorOf {
181
- in components: Real[3] ordered nonunique;
182
- return : CartesianThreeVectorValue[1] {
183
- feature :>> CartesianVectorOf::result::dimension, CartesianThreeVectorValue::dimension;
184
- }
185
- }
186
-
187
- feature cartesianZeroVector: CartesianVectorValue[3] =
188
- (
189
- CartesianVectorOf(0.0),
190
- CartesianVectorOf((0.0, 0.0)),
191
- CartesianThreeVectorOf((0.0, 0.0, 0.0))
192
- ) {
193
- doc
194
- /*
195
- * Cartesian zero vectors of 1, 2 and 3 dimensions.
196
- */
197
- }
198
- feature cartesian3DZeroVector: CartesianThreeVectorValue[1] =
199
- cartesianZeroVector#(3);
200
-
201
- function isCartesianZeroVector specializes isZeroVector {
202
- doc
203
- /*
204
- * A CartesianVectorValue is a zero vector if all its elements are zero.
205
- */
206
-
207
- in v: CartesianVectorValue[1];
208
- return : Boolean[1] = v.elements->forAll{in x; x == 0.0};
209
- }
210
-
211
- function 'cartesian+' specializes '+' {
212
- in v: CartesianVectorValue[1];
213
- in w: CartesianVectorValue[0..1];
214
- inv precondition { w != null implies v.dimension == w.dimension }
215
- return u: CartesianVectorValue[1] =
216
- if w == null? v
217
- else CartesianVectorOf(
218
- (1..w.dimension)->collect{in i : Positive; v#(i) + w#(i)}
219
- );
220
- }
221
-
222
- function 'cartesian-' specializes '-' {
223
- in v: CartesianVectorValue[1];
224
- in w: CartesianVectorValue[0..1];
225
- inv precondition { w != null implies v.dimension == w.dimension }
226
- return u: CartesianVectorValue[1] =
227
- CartesianVectorOf(
228
- if w == null? CartesianVectorOf(v.elements->collect{in x : Real; -x})
229
- else CartesianVectorOf(
230
- (1..v.dimension)->collect{in i : Positive; v#(i) - w#(i)}
231
- )
232
- );
233
- }
234
-
235
- function cartesianScalarVectorMult specializes scalarVectorMult {
236
- in x: Real[1];
237
- in v: CartesianVectorValue[1];
238
- return w: CartesianVectorValue[1] =
239
- CartesianVectorOf(
240
- v.elements->collect{in y : Real; x * y}
241
- );
242
- }
243
- function cartesianVectorScalarMult specializes vectorScalarMult {
244
- in v: CartesianVectorValue[1];
245
- in x: Real[1];
246
- return w: CartesianVectorValue[1] = cartesianScalarVectorMult(x, v);
247
- }
248
-
249
- function cartesianInner specializes inner {
250
- in v: CartesianVectorValue[1];
251
- in w : CartesianVectorValue[1];
252
- inv precondition { v.dimension == w.dimension }
253
- return x: Real[1] =
254
- (1..v.dimension)->collect{in i : Positive; v#(i) * w#(i)}->reduce RealFunctions::'+';
255
- }
256
-
257
- function cartesianNorm specializes norm {
258
- in v: CartesianVectorValue[1];
259
- return l : NumericalValue[1] = sqrt(cartesianInner(v, v));
260
- }
261
-
262
- function cartesianAngle specializes angle {
263
- in v: CartesianVectorValue[1]; in w: CartesianVectorValue[1];
264
- inv precondition { v.dimension == w.dimension }
265
- return theta: Real[1] = arccos(cartesianInner(v, w) / (norm(v) * norm(w)));
266
- }
267
-
268
- function sum {
269
- in coll: CartesianThreeVectorValue[*];
270
- return : CartesianThreeVectorValue[1] = sum0(coll, cartesian3DZeroVector);
271
- }
272
-
1
+ standard library package VectorFunctions {
2
+ doc
3
+ /*
4
+ * This package defines abstract functions on VectorValues corresponding to the algebraic operations
5
+ * provided by a vector space with inner product. It also includes concrete implementations of these
6
+ * functions specifically for CartesianVectorValues.
7
+ */
8
+
9
+ private import ScalarValues::NumericalValue;
10
+ private import ScalarValues::Positive;
11
+ private import ScalarValues::Real;
12
+ private import ScalarValues::Boolean;
13
+ private import NumericalFunctions::*;
14
+ private import RealFunctions::sqrt;
15
+ private import TrigFunctions::arccos;
16
+ private import SequenceFunctions::size;
17
+ private import ControlFunctions::*;
18
+
19
+ public import VectorValues::*;
20
+
21
+ /* Generic arithmetic functions for all VectorValues. */
22
+
23
+ abstract function isZeroVector {
24
+ doc
25
+ /*
26
+ * Return whether a VectorValue is a zero vector.
27
+ */
28
+
29
+ in v: VectorValue[1];
30
+ return : Boolean[1];
31
+ }
32
+
33
+ abstract function '+' specializes DataFunctions::'+' {
34
+ doc
35
+ /*
36
+ * With two arguments, returns the sum of two VectorValues. With one argument, returns that VectorValue.
37
+ */
38
+
39
+ in v: VectorValue[1];
40
+ in w: VectorValue[0..1];
41
+ return u: VectorValue[1];
42
+ inv zeroAddition { w == null or isZeroVector(w) implies u == w }
43
+ inv commutivity { w != null implies u == w + v }
44
+ }
45
+
46
+ abstract function '-' specializes DataFunctions::'-' {
47
+ doc
48
+ /*
49
+ * With two arguments, returns the difference of two VectorValues. With one arguments, returns the inverse
50
+ * of the given VectorValue, that is, the VectorValue that, when added to the original VectorValue, results in
51
+ * the zeroVector.
52
+ */
53
+
54
+ in v: VectorValue[1];
55
+ in w: VectorValue[0..1];
56
+ return u: VectorValue[1];
57
+ inv negation { w == null implies isZeroVector(v + u) }
58
+ inv difference { w != null implies v + u == w }
59
+ }
60
+
61
+ abstract function sum0 {
62
+ doc
63
+ /*
64
+ * Return the sum of a collection of VectorValues. If the collection is empty, return a given zero vector.
65
+ */
66
+
67
+ in coll: VectorValue[*] nonunique;
68
+ in zero: VectorValue[1];
69
+ inv precondition { isZeroVector(zero) }
70
+ return s: VectorValue[1] = coll->reduce '+' ?? zero;
71
+ }
72
+
73
+ /* Functions specific to NumericalVectorValues. */
74
+
75
+ function VectorOf {
76
+ doc
77
+ /*
78
+ * Construct a NumericalVectorValue whose elements are a non-empty list of component NumericalValues.
79
+ * The dimension of the NumericalVectorValue is equal to the number of components.
80
+ */
81
+
82
+ in components: NumericalValue[1..*] ordered nonunique;
83
+ return : NumericalVectorValue[1] {
84
+ :>> dimension = size(components);
85
+ :>> elements = components;
86
+ }
87
+ }
88
+
89
+ abstract function scalarVectorMult specializes DataFunctions::'*' {
90
+ doc
91
+ /*
92
+ * Scalar product of a NumericalValue and a NumericalVectorValue.
93
+ */
94
+
95
+ in x: NumericalValue[1];
96
+ in v: NumericalVectorValue[1];
97
+ return w: NumericalVectorValue[1];
98
+ inv scaling { norm(w) == x * norm(v) }
99
+ inv zeroLength { isZeroVector(w) implies isZero(norm(w))}
100
+ }
101
+ alias '*' for scalarVectorMult;
102
+
103
+ abstract function vectorScalarMult specializes DataFunctions::'*' {
104
+ doc
105
+ /*
106
+ * Scalar product of a NumericalVectorValue and a NumericalValue, which has the same value as the scalar product of the
107
+ * NumericalValue and the NumericalVectorValue.
108
+ */
109
+
110
+ in v: NumericalVectorValue[1];
111
+ in x: NumericalValue[1];
112
+ return w: NumericalVectorValue[1] default scalarVectorMult(x, v);
113
+ }
114
+
115
+ abstract function vectorScalarDiv specializes DataFunctions::'/' {
116
+ doc
117
+ /*
118
+ * Scalar quotient of a NumericalVectorValue and a NumericalValue, defined as the scalar product of the inverse of the
119
+ * NumericalValue and the NumericalVectorValue.
120
+ */
121
+
122
+ in v: NumericalVectorValue[1];
123
+ in x: NumericalValue[1];
124
+ return w: NumericalVectorValue[1] = scalarVectorMult(1.0 / x, v);
125
+ }
126
+
127
+ abstract function inner specializes DataFunctions::'*' {
128
+ doc
129
+ /*
130
+ * Inner product of two NumericalVectorValues.
131
+ */
132
+
133
+ in v: NumericalVectorValue[1];
134
+ in w: NumericalVectorValue[1];
135
+ return x: NumericalValue[1];
136
+ inv commmutivity { x == inner(w, v) }
137
+ inv zeroInner { isZeroVector(v) or isZeroVector(w) implies isZero(x)}
138
+ }
139
+
140
+ abstract function norm {
141
+ doc
142
+ /*
143
+ * The norm (magnitude) of a NumericalVectorValue, as a NumericalValue.
144
+ */
145
+
146
+ in v: NumericalVectorValue[1];
147
+ return l : NumericalValue[1];
148
+ inv squareNorm { l * l == inner(v,v) }
149
+ inv lengthZero { isZero(l) == isZeroVector(v) }
150
+ }
151
+
152
+ abstract function angle {
153
+ doc
154
+ /*
155
+ * The angle between two NumericalVectorValues, as a NumericalValue.
156
+ */
157
+
158
+ in v: NumericalVectorValue[1];
159
+ in w: NumericalVectorValue[1];
160
+ return theta: NumericalValue[1];
161
+ inv commutivity { theta == angle(w, v) }
162
+ inv lengthInsensitive { theta == angle(w / norm(w), v / norm(v)) }
163
+ }
164
+
165
+ /* Specialized functions with concrete definitions for CartesianVectorValues. */
166
+
167
+ function CartesianVectorOf {
168
+ doc
169
+ /*
170
+ * Construct a CartesianVectorValue whose elements are a non-empty list of Real components.
171
+ * The dimension of the NumericalVectorValue is equal to the number of components.
172
+ */
173
+
174
+ in components: Real[*] ordered nonunique;
175
+ return : CartesianVectorValue[1] {
176
+ :>> dimension = size(components);
177
+ :>> elements = components;
178
+ }
179
+ }
180
+ function CartesianThreeVectorOf specializes CartesianVectorOf {
181
+ in components: Real[3] ordered nonunique;
182
+ return : CartesianThreeVectorValue[1] {
183
+ feature :>> CartesianVectorOf::result::dimension, CartesianThreeVectorValue::dimension;
184
+ }
185
+ }
186
+
187
+ feature cartesianZeroVector: CartesianVectorValue[3] =
188
+ (
189
+ CartesianVectorOf(0.0),
190
+ CartesianVectorOf((0.0, 0.0)),
191
+ CartesianThreeVectorOf((0.0, 0.0, 0.0))
192
+ ) {
193
+ doc
194
+ /*
195
+ * Cartesian zero vectors of 1, 2 and 3 dimensions.
196
+ */
197
+ }
198
+ feature cartesian3DZeroVector: CartesianThreeVectorValue[1] =
199
+ cartesianZeroVector#(3);
200
+
201
+ function isCartesianZeroVector specializes isZeroVector {
202
+ doc
203
+ /*
204
+ * A CartesianVectorValue is a zero vector if all its elements are zero.
205
+ */
206
+
207
+ in v: CartesianVectorValue[1];
208
+ return : Boolean[1] = v.elements->forAll{in x; x == 0.0};
209
+ }
210
+
211
+ function 'cartesian+' specializes '+' {
212
+ in v: CartesianVectorValue[1];
213
+ in w: CartesianVectorValue[0..1];
214
+ inv precondition { w != null implies v.dimension == w.dimension }
215
+ return u: CartesianVectorValue[1] =
216
+ if w == null? v
217
+ else CartesianVectorOf(
218
+ (1..w.dimension)->collect{in i : Positive; v#(i) + w#(i)}
219
+ );
220
+ }
221
+
222
+ function 'cartesian-' specializes '-' {
223
+ in v: CartesianVectorValue[1];
224
+ in w: CartesianVectorValue[0..1];
225
+ inv precondition { w != null implies v.dimension == w.dimension }
226
+ return u: CartesianVectorValue[1] =
227
+ CartesianVectorOf(
228
+ if w == null? CartesianVectorOf(v.elements->collect{in x : Real; -x})
229
+ else CartesianVectorOf(
230
+ (1..v.dimension)->collect{in i : Positive; v#(i) - w#(i)}
231
+ )
232
+ );
233
+ }
234
+
235
+ function cartesianScalarVectorMult specializes scalarVectorMult {
236
+ in x: Real[1];
237
+ in v: CartesianVectorValue[1];
238
+ return w: CartesianVectorValue[1] =
239
+ CartesianVectorOf(
240
+ v.elements->collect{in y : Real; x * y}
241
+ );
242
+ }
243
+ function cartesianVectorScalarMult specializes vectorScalarMult {
244
+ in v: CartesianVectorValue[1];
245
+ in x: Real[1];
246
+ return w: CartesianVectorValue[1] = cartesianScalarVectorMult(x, v);
247
+ }
248
+
249
+ function cartesianInner specializes inner {
250
+ in v: CartesianVectorValue[1];
251
+ in w : CartesianVectorValue[1];
252
+ inv precondition { v.dimension == w.dimension }
253
+ return x: Real[1] =
254
+ (1..v.dimension)->collect{in i : Positive; v#(i) * w#(i)}->reduce RealFunctions::'+';
255
+ }
256
+
257
+ function cartesianNorm specializes norm {
258
+ in v: CartesianVectorValue[1];
259
+ return l : NumericalValue[1] = sqrt(cartesianInner(v, v));
260
+ }
261
+
262
+ function cartesianAngle specializes angle {
263
+ in v: CartesianVectorValue[1]; in w: CartesianVectorValue[1];
264
+ inv precondition { v.dimension == w.dimension }
265
+ return theta: Real[1] = arccos(cartesianInner(v, w) / (norm(v) * norm(w)));
266
+ }
267
+
268
+ function sum {
269
+ in coll: CartesianThreeVectorValue[*];
270
+ return : CartesianThreeVectorValue[1] = sum0(coll, cartesian3DZeroVector);
271
+ }
272
+
273
273
  }
@@ -1,22 +1,22 @@
1
- {
2
- "index": {
3
- "Base": "Base.kerml",
4
- "Clocks": "Clocks.kerml",
5
- "ControlPerformances": "ControlPerformances.kerml",
6
- "FeatureReferencingPerformances": "FeatureReferencingPerformances.kerml",
7
- "KerML": "KerML.kerml",
8
- "Links": "Links.kerml",
9
- "Metaobjects": "Metaobjects.kerml",
10
- "Objects": "Objects.kerml",
11
- "Observation": "Observation.kerml",
12
- "Occurrences": "Occurrences.kerml",
13
- "Performances": "Performances.kerml",
14
- "SpatialFrames": "SpatialFrames.kerml",
15
- "StatePerformances": "StatePerformances.kerml",
16
- "Transfers": "Transfers.kerml",
17
- "TransitionPerformances": "TransitionPerformances.kerml",
18
- "Triggers": "Triggers.kerml"
19
- },
20
- "created": "2025-03-13T00:00:00Z",
21
- "metamodel": "https://www.omg.org/spec/KerML/20250201"
1
+ {
2
+ "index": {
3
+ "Base": "Base.kerml",
4
+ "Clocks": "Clocks.kerml",
5
+ "ControlPerformances": "ControlPerformances.kerml",
6
+ "FeatureReferencingPerformances": "FeatureReferencingPerformances.kerml",
7
+ "KerML": "KerML.kerml",
8
+ "Links": "Links.kerml",
9
+ "Metaobjects": "Metaobjects.kerml",
10
+ "Objects": "Objects.kerml",
11
+ "Observation": "Observation.kerml",
12
+ "Occurrences": "Occurrences.kerml",
13
+ "Performances": "Performances.kerml",
14
+ "SpatialFrames": "SpatialFrames.kerml",
15
+ "StatePerformances": "StatePerformances.kerml",
16
+ "Transfers": "Transfers.kerml",
17
+ "TransitionPerformances": "TransitionPerformances.kerml",
18
+ "Triggers": "Triggers.kerml"
19
+ },
20
+ "created": "2025-03-13T00:00:00Z",
21
+ "metamodel": "https://www.omg.org/spec/KerML/20250201"
22
22
  }
@@ -1,15 +1,15 @@
1
- {
2
- "name": "Kernel Semantic Library",
3
- "version": "1.0.0",
4
- "description": "Standard semantic library for the Kernel Modeling Language (KerML)",
5
- "usage": [
6
- {
7
- "resource": "https://www.omg.org/spec/KerML/20250201/Data-Type-Library.kpar",
8
- "versionConstraint": "1.0.0"
9
- },
10
- {
11
- "resource": "https://www.omg.org/spec/KerML/20250201/Function-Library.kpar",
12
- "versionConstraint": "1.0.0"
13
- }
14
- ]
1
+ {
2
+ "name": "Kernel Semantic Library",
3
+ "version": "1.0.0",
4
+ "description": "Standard semantic library for the Kernel Modeling Language (KerML)",
5
+ "usage": [
6
+ {
7
+ "resource": "https://www.omg.org/spec/KerML/20250201/Data-Type-Library.kpar",
8
+ "versionConstraint": "1.0.0"
9
+ },
10
+ {
11
+ "resource": "https://www.omg.org/spec/KerML/20250201/Function-Library.kpar",
12
+ "versionConstraint": "1.0.0"
13
+ }
14
+ ]
15
15
  }