-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
2909 lines (2668 loc) · 154 KB
/
index.d.ts
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
993
994
995
996
997
998
999
1000
export = ELM;
export as namespace ELM;
declare namespace ELM {
/*
The Element type defines the abstract base type for all library elements in ELM.
*/
interface AbstractElement {
localId?: string;
locator?: string;
resultTypeName?: string;
annotation?: any[];
resultTypeSpecifier?: TypeSpecifier;
}
/*
TypeSpecifier is the abstract base type for all type specifiers.
*/
interface AbstractTypeSpecifier extends AbstractElement {}
/*
NamedTypeSpecifier defines a type identified by a name, such as Integer, String, Patient, or Encounter.
*/
interface NamedTypeSpecifier extends AbstractTypeSpecifier {
type: "NamedTypeSpecifier";
name: string;
}
/*
IntervalTypeSpecifier defines an interval type by specifying the point type. Any type can serve as the point type for an interval, so long as it supports comparison operators, minimum and maximum value determination, as well as predecessor and successor functions.
*/
interface IntervalTypeSpecifier extends AbstractTypeSpecifier {
type: "IntervalTypeSpecifier";
pointType: TypeSpecifier;
}
/*
ListTypeSpecifier defines a list type by specifying the type of elements the list may contain.
*/
interface ListTypeSpecifier extends AbstractTypeSpecifier {
type: "ListTypeSpecifier";
elementType: TypeSpecifier;
}
/*
TupleElementDefinition defines the name and type of a single element within a TupleTypeSpecifier.
*/
interface TupleElementDefinition extends AbstractElement {
name: string;
type?: TypeSpecifier;
elementType?: TypeSpecifier;
}
/*
TupleTypeSpecifier defines the possible elements of a tuple.
*/
interface TupleTypeSpecifier extends AbstractTypeSpecifier {
type: "TupleTypeSpecifier";
element?: TupleElementDefinition[];
}
/*
ChoiceTypeSpecifier defines the possible types of a choice type.
*/
interface ChoiceTypeSpecifier extends AbstractTypeSpecifier {
type: "ChoiceTypeSpecifier";
choice?: TypeSpecifier[];
}
/*
The Expression type defines the abstract base type for all expressions used in the ELM expression language.
*/
interface AbstractExpression extends AbstractElement {}
/*
The Operator type defines the abstract base type for all built-in operators used in the ELM expression language. This explicitly excludes FunctionRef, which is the concrete type for all function invocations.
*/
interface AbstractOperatorExpression extends AbstractExpression {
signature?: TypeSpecifier[];
}
/*
The UnaryExpression type defines the abstract base type for expressions that take a single argument.
*/
interface AbstractUnaryExpression extends AbstractOperatorExpression {
operand: Expression;
}
/*
The BinaryExpression type defines the abstract base type for expressions that take two arguments.
*/
interface AbstractBinaryExpression extends AbstractOperatorExpression {
operand: Expression[];
}
/*
The TernaryExpression type defines the abstract base type for expressions that take three arguments.
*/
interface AbstractTernaryExpression extends AbstractOperatorExpression {
operand: Expression[];
}
/*
The NaryExpression type defines an abstract base class for an expression that takes any number of arguments, including zero.
*/
interface AbstractNaryExpression extends AbstractOperatorExpression {
operand?: Expression[];
}
/*
The ExpressionDef type defines an expression and an associated name that can be referenced by any expression in the artifact. The name must be unique within the artifact.
The context attribute specifies the context of the execution and is used by the environment to determine whether or not to filter the data returned from retrieves based on the current context.
*/
interface ExpressionDef extends AbstractElement {
name?: string;
context?: string;
accessLevel?: AccessModifier;
expression?: Expression;
}
/*
The FunctionDef type defines a named function that can be invoked by any expression in the artifact. Function names must be unique within the artifact. Functions may take any number of operands.
*/
interface FunctionDef extends AbstractElement {
type: "FunctionDef";
external?: boolean;
fluent?: boolean;
operand?: OperandDef[];
name?: string;
context?: string;
accessLevel?: AccessModifier;
expression?: Expression;
}
/*
The ExpressionRef type defines an expression that references a previously defined NamedExpression. The result of evaluating an ExpressionReference is the result of evaluating the referenced NamedExpression.
*/
interface ExpressionRef extends AbstractExpression {
type: "ExpressionRef";
name?: string;
libraryName?: string;
}
/*
The FunctionRef type defines an expression that invokes a previously defined function. The result of evaluating each operand is passed to the function.
*/
interface FunctionRef extends AbstractExpression {
type: "FunctionRef";
signature?: TypeSpecifier[];
operand?: Expression[];
name?: string;
libraryName?: string;
}
/*
The ParameterDef type defines a parameter that can be referenced by name anywhere within an expression.
Parameters are defined at the artifact level, and may be provided as part of the payload for an evaluation request.
If no parameter value is provided, the default element is used to provide the value for the parameter.
If no parameter or default is provided, the parameter is defined to be null.
Note that the expression specified in the default element must be able to be evaluated at compile-time (i.e. without reference to any run-time capabilities such as data, terminology, and library references, both local and included).
*/
interface ParameterDef extends AbstractElement {
name?: string;
parameterType?: string;
accessLevel?: AccessModifier;
default?: Expression;
parameterTypeSpecifier?: TypeSpecifier;
}
/*
The ParameterRef expression allows the value of a parameter to be referenced as part of an expression.
*/
interface ParameterRef extends AbstractExpression {
type: "ParameterRef";
name?: string;
libraryName?: string;
}
/*
The OperandDef type defines an operand to a function that can be referenced by name anywhere within the body of a function definition.
*/
interface OperandDef extends AbstractElement {
name?: string;
operandType?: string;
operandTypeSpecifier?: TypeSpecifier;
}
/*
The OperandRef expression allows the value of an operand to be referenced as part of an expression within the body of a function definition.
*/
interface OperandRef extends AbstractExpression {
type: "OperandRef";
name?: string;
}
/*
The IdentifierRef type defines an expression that references an identifier that is either unresolved, or has been resolved to an attribute in an unambiguous iteration scope such as a sort. Implementations should attempt to resolve the identifier, only throwing an error at compile-time (or run-time for an interpretive system) if the identifier reference cannot be resolved.
*/
interface IdentifierRef extends AbstractExpression {
type: "IdentifierRef";
name?: string;
libraryName?: string;
}
/*
The Literal type defines a single scalar value. For example, the literal 5, the boolean value true or the string "antithrombotic".
*/
interface Literal extends AbstractExpression {
type: "Literal";
valueType: string;
value?: any;
}
/*
The TupleElement is used within a Tuple expression to provide the value of a specific element within a tuple literal expression.
*/
interface TupleElement {
name: string;
value: Expression;
}
/*
The Tuple expression allows tuples of any type to be built up as an expression. The tupleType attribute specifies the type of the tuple being built, if any, and the list of tuple elements specify the values for the elements of the tuple. Note that the value of an element may be any expression, including another Tuple.
*/
interface Tuple extends AbstractExpression {
type: "Tuple";
element?: TupleElement[];
}
/*
The InstanceElement is used within an Instance expression to provide the value of a specific element within an object literal expression.
*/
interface InstanceElement {
name: string;
value: Expression;
}
/*
The Instance expression allows class instances of any type to be built up as an expression. The classType attribute specifies the type of the class instance being built, and the list of instance elements specify the values for the elements of the class instance. Note that the value of an element may be any expression, including another Instance.
*/
interface Instance extends AbstractExpression {
type: "Instance";
classType: string;
element?: InstanceElement[];
}
/*
The Interval selector defines an interval value. An interval must be defined using a point type that supports comparison, as well as Successor and Predecessor operations, and Minimum and Maximum Value operations.
The low and high bounds of the interval may each be defined as open or closed. Following standard terminology usage in interval mathematics, an open interval is defined to exclude the specified point, whereas a closed interval includes the point. The default is closed, indicating an inclusive interval.
The low and high elements are both optional. If the low element is not specified, the low bound of the resulting interval is null. If the high element is not specified, the high bound of the resulting interval is null.
The static type of the low bound determines the type of the interval, and the high bound must be of the same type.
If the low bound of the interval is null and open, the low bound of the interval is interpreted as unknown, and computations involving the low boundary will result in null.
If the low bound of the interval is null and closed, the interval is interpreted to start at the minimum value of the point type, and computations involving the low boundary will be performed with that value.
If the high bound of the interval is null and open, the high bound of the interval is unknown, and computations involving the high boundary will result in null.
If the high bound of the interval is null and closed, the interval is interpreted to end at the maximum value of the point type, and computations involving the high boundary will be performed with that interpretation.
*/
interface Interval extends AbstractExpression {
type: "Interval";
lowClosed?: boolean;
highClosed?: boolean;
low?: Expression;
lowClosedExpression?: Expression;
high?: Expression;
highClosedExpression?: Expression;
}
/*
The List selector returns a value of type List, whose elements are the result of evaluating the arguments to the List selector, in order.
If a typeSpecifier element is provided, the list is of that type. Otherwise, the static type of the first argument determines the type of the resulting list, and each subsequent argument must be of that same type.
If any argument is null, the resulting list will have null for that element.
*/
interface List extends AbstractExpression {
type: "List";
typeSpecifier?: TypeSpecifier;
element?: Expression[];
}
/*
The And operator returns the logical conjunction of its arguments. Note that this operator is defined using 3-valued logic semantics. This means that if either argument is false, the result is false; if both arguments are true, the result is true; otherwise, the result is null. Note also that ELM does not prescribe short-circuit evaluation.
*/
interface And extends AbstractBinaryExpression {
type: "And";
}
/*
The Or operator returns the logical disjunction of its arguments. Note that this operator is defined using 3-valued logic semantics. This means that if either argument is true, the result is true; if both arguments are false, the result is false; otherwise, the result is null. Note also that ELM does not prescribe short-circuit evaluation.
*/
interface Or extends AbstractBinaryExpression {
type: "Or";
}
/*
The Xor operator returns the exclusive or of its arguments. Note that this operator is defined using 3-valued logic semantics. This means that the result is true if and only if one argument is true and the other is false, and that the result is false if and only if both arguments are true or both arguments are false. If either or both arguments are null, the result is null.
*/
interface Xor extends AbstractBinaryExpression {
type: "Xor";
}
/*
The Implies operator returns the logical implication of its arguments. Note that this operator is defined using 3-valued logic semantics. This means that if the left operand evaluates to true, this operator returns the boolean evaluation of the right operand. If the left operand evaluates to false, this operator returns true. Otherwise, this operator returns true if the right operand evaluates to true, and null otherwise.
Note that implies may use short-circuit evaluation in the case that the first operand evaluates to false.
*/
interface Implies extends AbstractBinaryExpression {
type: "Implies";
}
/*
The Not operator returns the logical negation of its argument. If the argument is true, the result is false; if the argument is false, the result is true; otherwise, the result is null.
*/
interface Not extends AbstractUnaryExpression {
type: "Not";
}
/*
The If operator evaluates a condition, and returns the then argument if the condition evaluates to true; if the condition evaluates to false or null, the result of the else argument is returned. The static type of the then argument determines the result type of the conditional, and the else argument must be of that same type.
*/
interface If extends AbstractExpression {
type: "If";
condition: Expression;
then: Expression;
else: Expression;
}
interface CaseItem extends AbstractElement {
when: Expression;
then: Expression;
}
/*
The Case operator allows for multiple conditional expressions to be chained together in a single expression, rather than having to nest multiple If operators. In addition, the comparand operand provides a variant on the case that allows a single value to be compared in each conditional.
If a comparand is not provided, the type of each when element of the caseItems within the Case is expected to be boolean. If a comparand is provided, the type of each when element of the caseItems within the Case is expected to be of the same type as the comparand. An else element must always be provided.
The static type of the then argument within the first caseItem determines the type of the result, and the then argument of each subsequent caseItem and the else argument must be of that same type.
*/
interface Case extends AbstractExpression {
type: "Case";
comparand?: Expression;
caseItem: CaseItem[];
else: Expression;
}
/*
The Null operator returns a null, or missing information marker. To avoid the need to cast this result, the operator is allowed to return a typed null.
*/
interface Null extends AbstractExpression {
type: "Null";
valueType?: string;
}
/*
The IsNull operator determines whether or not its argument evaluates to null. If the argument evaluates to null, the result is true; otherwise, the result is false.
*/
interface IsNull extends AbstractUnaryExpression {
type: "IsNull";
}
/*
The IsTrue operator determines whether or not its argument evaluates to true. If the argument evaluates to true, the result is true; if the argument evaluates to false or null, the result is false.
*/
interface IsTrue extends AbstractUnaryExpression {
type: "IsTrue";
}
/*
The IsFalse operator determines whether or not its argument evaluates to false. If the argument evaluates to false, the result is true; if the argument evaluates to true or null, the result is false.
*/
interface IsFalse extends AbstractUnaryExpression {
type: "IsFalse";
}
/*
The Coalesce operator returns the first non-null result in a list of arguments. If all arguments evaluate to null, the result is null. The static type of the first argument determines the type of the result, and all subsequent arguments must be of that same type.
*/
interface Coalesce extends AbstractNaryExpression {
type: "Coalesce";
}
/*
The Is operator allows the type of a result to be tested. The language must support the ability to test against any type. If the run-time type of the argument is of the type being tested, the result of the operator is true; otherwise, the result is false.
*/
interface Is extends AbstractUnaryExpression {
type: "Is";
isType?: string;
isTypeSpecifier?: TypeSpecifier;
}
/*
The As operator allows the result of an expression to be cast as a given target type. This allows expressions to be written that are statically typed against the expected run-time type of the argument. If the argument is not of the specified type, and the strict attribute is false (the default), the result is null. If the argument is not of the specified type and the strict attribute is true, an exception is thrown.
*/
interface As extends AbstractUnaryExpression {
type: "As";
asType?: string;
strict?: boolean;
asTypeSpecifier?: TypeSpecifier;
}
/*
The Convert operator converts a value to a specific type. The result of the operator is the value of the argument converted to the target type, if possible.
If no valid conversion exists from the actual value to the target type, the result is null.
This operator supports conversion:
Between String and each of Boolean, Integer, Long, Decimal, Quantity, Ratio, Date, DateTime, and Time
as well as:
From Integer to Long, Decimal or Quantity
From Decimal to Quantity
Between Date and DateTime
From Code to Concept
Between Concept and List<Code>
Conversion between String and Date/DateTime/Time is performed using the ISO-8601 standard format: YYYY-MM-DDThh:mm:ss(+|-)hh:mm.
*/
interface Convert extends AbstractUnaryExpression {
type: "Convert";
toType?: string;
toTypeSpecifier?: TypeSpecifier;
}
/*
The CanConvert operator returns true if the given value can be converted to a specific type, and false otherwise.
This operator returns true for conversion:
Between String and each of Boolean, Integer, Long, Decimal, Quantity, Ratio, Date, DateTime, and Time,
as well as:
From Integer to Long, Decimal, or Quantity
From Decimal to Quantity
Between Date and DateTime
From Code to Concept
Between Concept and List<Code>
Conversion between String and Date/DateTime/Time is checked using the ISO-8601 standard format: YYYY-MM-DDThh:mm:ss(+|-)hh:mm.
*/
interface CanConvert extends AbstractUnaryExpression {
type: "CanConvert";
toType?: string;
toTypeSpecifier?: TypeSpecifier;
}
/*
The ToBoolean operator converts the value of its argument to a Boolean value.
The operator accepts 'true', 't', 'yes', 'y', and '1' as string representations of true, and 'false', 'f', 'no', 'n', and '0' as string representations of false, ignoring case.
If the input is an Integer or Long, the result is true if the integer is 1, false if the integer is 0.
If the input is a Decimal, the result is true if the decimal is 1.0, false if the decimal is 0.0.
If the input cannot be interpreted as a valid Boolean value, the result is null.
If the argument is null the result is null.
*/
interface ToBoolean extends AbstractUnaryExpression {
type: "ToBoolean";
}
/*
The ConvertsToBoolean operator returns true if the value of its argument is or can be converted to a Boolean value.
The operator accepts 'true', 't', 'yes', 'y', and '1' as string representations of true, and 'false', 'f', 'no', 'n', and '0' as string representations of false, ignoring case.
If the input is an Integer or Long, the result is true if the integer is 1 or 0.
If the input is a Decimal, the result is true if the decimal is 1.0 or 0.0.
If the input cannot be interpreted as a valid Boolean value, the result is false.
If the argument is null the result is null.
*/
interface ConvertsToBoolean extends AbstractUnaryExpression {
type: "ConvertsToBoolean";
}
/*
The ToConcept operator converts a value of type Code to a Concept value with the given Code as its primary and only Code. If the Code has a display value, the resulting Concept will have the same display value.
If the input is a list of Codes, the resulting Concept will have all the input Codes, and will not have a display value.
If the argument is null, the result is null.
*/
interface ToConcept extends AbstractUnaryExpression {
type: "ToConcept";
}
/*
The ConvertsToDate operator returns true if the value of its argument is or can be converted to a Date value.
For String values, The operator expects the string to be formatted using the ISO-8601 date representation:
YYYY-MM-DD
In addition, the string must be interpretable as a valid date value.
Note that the operator can take time formatted strings and will ignore the time portions.
If the input string is not formatted correctly, or does not represent a valid date value, the result is false.
As with date literals, date values may be specified to any precision.
If the argument is null, the result is null.
*/
interface ConvertsToDate extends AbstractUnaryExpression {
type: "ConvertsToDate";
}
/*
The ToDate operator converts the value of its argument to a Date value.
For String values, The operator expects the string to be formatted using the ISO-8601 date representation:
YYYY-MM-DD
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
In addition, the string must be interpretable as a valid date value.
Note that the operator can take datetime formatted strings and will ignore the time portions.
If the input string is not formatted correctly, or does not represent a valid date value, the result is null.
As with date literals, date values may be specified to any precision.
For DateTime values, the result is equivalent to extracting the Date component of the DateTime value.
If the argument is null, the result is null.
*/
interface ToDate extends AbstractUnaryExpression {
type: "ToDate";
}
/*
The ConvertsToDateTime operator returns true if the value of its argument is or can be converted to a DateTime value.
For String values, the operator expects the string to be formatted using the ISO-8601 datetime representation:
YYYY-MM-DDThh:mm:ss.fff(Z|((+|-)hh:mm))
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
In addition, the string must be interpretable as a valid DateTime value.
If the input string is not formatted correctly, or does not represent a valid DateTime value, the result is false.
As with Date and Time literals, DateTime values may be specified to any precision. If no timezone offset is supplied, the timezone offset of the evaluation request timestamp is assumed.
If the argument is null, the result is null.
*/
interface ConvertsToDateTime extends AbstractUnaryExpression {
type: "ConvertsToDateTime";
}
/*
The ToDateTime operator converts the value of its argument to a DateTime value.
For String values, the operator expects the string to be formatted using the ISO-8601 datetime representation:
YYYY-MM-DDThh:mm:ss.fff(Z|((+|-)hh:mm))
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
In addition, the string must be interpretable as a valid DateTime value.
If the input string is not formatted correctly, or does not represent a valid DateTime value, the result is null.
As with Date and Time literals, DateTime values may be specified to any precision. If no timezone offset is supplied, the timezone offset of the evaluation request timestamp is assumed.
For Date values, the result is a DateTime with the time components unspecified, except the timezone offset, which is set to the timezone offset of the evaluation request timestamp.
If the argument is null, the result is null.
*/
interface ToDateTime extends AbstractUnaryExpression {
type: "ToDateTime";
}
/*
The ConvertsToDecimal operator returns true if the value of its argument is or can be converted to a Decimal value. The operator accepts strings using the following format:
(+|-)?#0(.0#)?
Meaning an optional polarity indicator, followed by any number of digits (including none), followed by at least one digit, followed optionally by a decimal point, at least one digit, and any number of additional digits (including none).
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
Note that for this operator to return true, the input value must be limited in precision and scale to the maximum precision and scale representable for Decimal values within CQL.
If the input string is not formatted correctly, or cannot be interpreted as a valid Decimal value, the result is false.
If the input is a Boolean, the result is true.
If the argument is null, the result is null.
*/
interface ConvertsToDecimal extends AbstractUnaryExpression {
type: "ConvertsToDecimal";
}
/*
The ToDecimal operator converts the value of its argument to a Decimal value. The operator accepts strings using the following format:
(+|-)?#0(.0#)?
Meaning an optional polarity indicator, followed by any number of digits (including none), followed by at least one digit, followed optionally by a decimal point, at least one digit, and any number of additional digits (including none).
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
Note that the decimal value returned by this operator must be limited in precision and scale to the maximum precision and scale representable for Decimal values within CQL.
If the input string is not formatted correctly, or cannot be interpreted as a valid Decimal value, the result is null.
If the input is Boolean, true will result in 1.0, false will result in 0.0.
If the argument is null, the result is null.
*/
interface ToDecimal extends AbstractUnaryExpression {
type: "ToDecimal";
}
/*
The ConvertsToInteger operator returns true if the value of its argument is or can be converted to an Integer value. The operator accepts strings using the following format:
(+|-)?#0
Meaning an optional polarity indicator, followed by any number of digits (including none), followed by at least one digit.
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
Note that for this operator to return true, the input must be a valid value in the range representable for Integer values in CQL.
If the input string is not formatted correctly, or cannot be interpreted as a valid Integer value, the result is false.
If the input is a Boolean, the result is true.
If the argument is null, the result is null.
*/
interface ConvertsToInteger extends AbstractUnaryExpression {
type: "ConvertsToInteger";
}
/*
The ToInteger operator converts the value of its argument to an Integer value. The operator accepts strings using the following format:
(+|-)?#0
Meaning an optional polarity indicator, followed by any number of digits (including none), followed by at least one digit.
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
Note that the integer value returned by this operator must be a valid value in the range representable for Integer values in CQL.
If the input string is not formatted correctly, or cannot be interpreted as a valid Integer value, the result is null.
If the input is Boolean, true will result in 1, false will result in 0.
If the argument is null, the result is null.
*/
interface ToInteger extends AbstractUnaryExpression {
type: "ToInteger";
}
/*
The ConvertsToLong operator returns true if the value of its argument is or can be converted to a Long value. The operator accepts strings using the following format:
(+|-)?#0
Meaning an optional polarity indicator, followed by any number of digits (including none), followed by at least one digit.
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
Note that for this operator to return true, the input must be a valid value in the range representable for Long values in CQL.
If the input string is not formatted correctly, or cannot be interpreted as a valid Long value, the result is false.
If the input is a Boolean, the result is true.
If the argument is null, the result is null.
*/
interface ConvertsToLong extends AbstractUnaryExpression {
type: "ConvertsToLong";
}
/*
The ToLong operator converts the value of its argument to a Long value. The operator accepts strings using the following format:
(+|-)?#0
Meaning an optional polarity indicator, followed by any number of digits (including none), followed by at least one digit.
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
Note that the long value returned by this operator must be a valid value in the range representable for Long values in CQL.
If the input string is not formatted correctly, or cannot be interpreted as a valid Long value, the result is null.
If the argument is null, the result is null.
*/
interface ToLong extends AbstractUnaryExpression {
type: "ToLong";
}
/*
The ConvertsToQuantity operator returns true if the value of its argument is or can be converted to a Quantity value. The operator may be used with Integer, Decimal, Ratio, or String values.
For String values, the operator accepts strings using the following format:
(+|-)?#0(.0#)?('<unit>')?
Meaning an optional polarity indicator, followed by any number of digits (including none) followed by at least one digit, optionally followed by a decimal point, at least one digit, and any number of additional digits, all optionally followed by a unit designator as a string literal specifying a valid UCUM unit of measure or calendar duration keyword, singular or plural. Spaces are allowed between the quantity value and the unit designator.
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
Note that the decimal value of the quantity returned by this operator must be a valid value in the range representable for Decimal values in CQL.
If the input string is not formatted correctly, or cannot be interpreted as a valid Quantity value, the result is false.
For Integer, Decimal, and Ratio values, the operator simply returns true.
If the argument is null, the result is null.
*/
interface ConvertsToQuantity extends AbstractUnaryExpression {
type: "ConvertsToQuantity";
}
/*
The ToQuantity operator converts the value of its argument to a Quantity value. The operator may be used with Integer, Decimal, Ratio, or String values. The operation does not perform any unit conversion, that capability is supported by the ConvertQuantity operator.
For String values, the operator accepts strings using the following format:
(+|-)?#0(.0#)?('<unit>')?
Meaning an optional polarity indicator, followed by any number of digits (including none) followed by at least one digit, optionally followed by a decimal point, at least one digit, and any number of additional digits, all optionally followed by a unit designator as a string literal specifying a valid UCUM unit of measure or calendar duration keyword, singular or plural. Spaces are allowed between the quantity value and the unit designator.
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
Note that the decimal value of the quantity returned by this operator must be a valid value in the range representable for Decimal values in CQL.
If the input string is not formatted correctly, or cannot be interpreted as a valid Quantity value, the result is null.
For Integer and Decimal values, the result is a Quantity with the value of the integer or decimal input, and the default unit ('1').
For Ratio values, the operation is equivalent to the result of dividing the numerator of the ratio by the denominator.
If the argument is null, the result is null.
*/
interface ToQuantity extends AbstractUnaryExpression {
type: "ToQuantity";
}
/*
The ConvertsToRatio operator returns true if the value of its argument is or can be converted to a Ratio value. The operator accepts strings using the following format:
<quantity>:<quantity>
Meaning a quantity, followed by a colon (:), followed by another quantity. The operator accepts quantity strings using the same format as the ToQuantity operator.
If the input string is not formatted correctly, or cannot be interpreted as a valid Ratio value, the result is false.
If the argument is null, the result is null.
*/
interface ConvertsToRatio extends AbstractUnaryExpression {
type: "ConvertsToRatio";
}
/*
The ToRatio operator converts the value of its argument to a Ratio value. The operator accepts strings using the following format:
<quantity>:<quantity>
Meaning a quantity, followed by a colon (:), followed by another quantity. The operator accepts quantity strings using the same format as the ToQuantity operator.
If the input string is not formatted correctly, or cannot be interpreted as a valid Ratio value, the result is null.
If the argument is null, the result is null.
*/
interface ToRatio extends AbstractUnaryExpression {
type: "ToRatio";
}
/*
The ToList operator returns its argument as a List value. The operator accepts a singleton value of any type and returns a list with the value as the single element.
If the argument is null, the operator returns an empty list.
The operator is effectively shorthand for "if operand is null then { } else { operand }".
The operator is used to implement list promotion efficiently.
*/
interface ToList extends AbstractUnaryExpression {
type: "ToList";
}
/*
The ToChars operator takes a string and returns a list with one string for each character in the input, in the order in which they appear in the string.
If the argument is null, the result is null.
*/
interface ToChars extends AbstractUnaryExpression {
type: "ToChars";
}
/*
The ConvertsToString operator returns true if the value of its argument is or can be converted to a String value.
The operator returns true if the argument is any of the following types:
Boolean
Integer
Long
Decimal
DateTime
Date
Time
Quantity
Ratio
String
If the argument is null, the result is null.
*/
interface ConvertsToString extends AbstractUnaryExpression {
type: "ConvertsToString";
}
/*
The ToString operator converts the value of its argument to a String value. The operator uses the following string representations for each type:
Boolean true|false
Integer (-)?#0
Long (-)?#0
Decimal (-)?#0.0#
Quantity (-)?#0.0# '<unit>'
Date YYYY-MM-DD
DateTime YYYY-MM-DDThh:mm:ss.fff(+|-)hh:mm
Time hh:mm:ss.fff
Ratio <quantity>:<quantity>
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
If the argument is null, the result is null.
*/
interface ToString extends AbstractUnaryExpression {
type: "ToString";
}
/*
The ConvertsToTime operator returns true if the value of its argument is or can be converted to a Time value.
For String values, the operator expects the string to be formatted using ISO-8601 time representation:
hh:mm:ss.fff
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
In addition, the string must be interpretable as a valid time-of-day value.
If the input string is not formatted correctly, or does not represent a valid time-of-day value, the result is false.
As with time-of-day literals, time-of-day values may be specified to any precision.
If the argument is null, the result is null.
*/
interface ConvertsToTime extends AbstractUnaryExpression {
type: "ConvertsToTime";
}
/*
The ToTime operator converts the value of its argument to a Time value.
For String values, the operator expects the string to be formatted using ISO-8601 time representation:
hh:mm:ss.fff
See the Formatting Strings topic in the CQL Reference (Appendix B) of the CQL Specification for a description of formatting strings.
In addition, the string must be interpretable as a valid time-of-day value.
If the input string is not formatted correctly, or does not represent a valid time-of-day value, the result is null.
As with time-of-day literals, time-of-day values may be specified to any precision.
For DateTime values, the result is the same as extracting the Time component from the DateTime value.
If the argument is null, the result is null.
*/
interface ToTime extends AbstractUnaryExpression {
type: "ToTime";
}
/*
The CanConvertQuantity operator returns true if the Quantity can be converted to an equivalent Quantity with the given Unit. Otherwise, the result is false.
Note that implementations are not required to support quantity conversion, and so may return false, even if the conversion is valid. Implementations that do support unit conversion shall do so according to the conversion specified by UCUM.
If either argument is null, the result is null.
*/
interface CanConvertQuantity extends AbstractBinaryExpression {
type: "CanConvertQuantity";
}
/*
The ConvertQuantity operator converts a Quantity to an equivalent Quantity with the given unit. If the unit of the input quantity can be converted to the target unit, the result is an equivalent Quantity with the target unit. Otherwise, the result is null.
Note that implementations are not required to support quantity conversion. Implementations that do support unit conversion shall do so according to the conversion specified by UCUM. Implementations that do not support unit conversion shall throw an error if an unsupported unit conversion is requested with this operation.
If either argument is null, the result is null.
*/
interface ConvertQuantity extends AbstractBinaryExpression {
type: "ConvertQuantity";
}
/*
The Equal operator returns true if the arguments are equal; false if the arguments are known unequal, and null otherwise. Equality semantics are defined to be value-based.
For simple types, this means that equality returns true if and only if the result of each argument evaluates to the same value.
For string values, equality is strictly lexical based on the Unicode values for the individual characters in the strings.
For decimal values, trailing zeroes are ignored.
For quantities, this means that the dimensions of each quantity must be the same, but not necessarily the unit. For example, units of 'cm' and 'm' are comparable, but units of 'cm2' and 'cm' are not. Attempting to operate on quantities with invalid units will result in null. When a quantity has no units specified, it is treated as a quantity with the default unit ('1').
For time-valued quantities, UCUM definite-time duration quantities above days (and weeks) are not comparable to calendar duration quantities above days (and weeks). Definite-time duration unit conversions shall be performed as specified in ISO-8601, while calendar-time duration unit conversions shall be performed according to calendar duration semantics. In particular, unit conversion between variable length calendar durations (i.e. years and months) and definite-time durations (i.e. days or below) results in null.
For ratios, this means that the numerator and denominator must be the same, using quantity equality semantics.
For tuple types, this means that equality returns true if and only if the tuples are of the same type, and the values for all elements that have values, by name, are equal.
For list types, this means that equality returns true if and only if the lists contain elements of the same type, have the same number of elements, and for each element in the lists, in order, the elements are equal using equality semantics, with the exception that null elements are considered equal.
For interval types, equality returns true if and only if the intervals are over the same point type, and they have the same value for the starting and ending points of the interval as determined by the Start and End operators.
For Date, Time, and DateTime values, the comparison is performed by considering each precision in order, beginning with years (or hours for time values). If the values are the same, comparison proceeds to the next precision; if the values are different, the comparison stops and the result is false. If one input has a value for the precision and the other does not, the comparison stops and the result is null; if neither input has a value for the precision or the last precision has been reached, the comparison stops and the result is true. For the purposes of comparison, seconds and milliseconds are combined as a single precision using a decimal, with decimal equality semantics.
If either argument is null, the result is null.
*/
interface Equal extends AbstractBinaryExpression {
type: "Equal";
}
/*
The Equivalent operator returns true if the arguments are the same value, or if they are both null; and false otherwise.
With the exception of null behavior and the semantics for specific types defined below, equivalence is the same as equality.
For string values, equivalence returns true if the strings are the same value while ignoring case and locale, and normalizing whitespace. Normalizing whitespace means that all whitespace characters are treated as equivalent, with whitespace characters as defined in the whitespace lexical category.
For decimals, equivalent means the values are the same with the comparison done on values rounded to the least precision of the least precise operand; trailing zeroes after the decimal are ignored in determining precision for equivalent comparison.
For quantities, equivalent means the values are the same quantity when considering unit conversion (e.g. 100 'cm' ~ 1 'm') and using decimal equivalent semantics for the value. Note that implementations are not required to support unit conversion and so are allowed to return false for equivalence of quantities with different units.
For time-valued quantities, UCUM definite-time duration quantities above days (and weeks) are considered equivalent to their calendar duration counterparts. Definite-time duration unit conversions shall be performed as specified in ISO-8601, while calendar-time duration unit conversions shall be performed according to the calendar duration semantics. In particular, unit conversion between variable length calendar durations (i.e. years and months) and definite-time durations (i.e. days or below) uses the approximations of 365 days in a year, and 30 days in a month.
For ratios, equivalent means that the numerator and denominator represent the same ratio (e.g. 1:100 ~ 10:1000).
For tuple types, this means that two tuple values are equivalent if and only if the tuples are of the same type, and the values for all elements by name are equivalent.
For list types, this means that two lists are equivalent if and only if the lists contain elements of the same type, have the same number of elements, and for each element in the lists, in order, the elements are equivalent.
For interval types, this means that two intervals are equivalent if and only if the intervals are over the same point type, and the starting and ending points of the intervals as determined by the Start and End operators are equivalent.
For Date, Time, and DateTime values, the comparison is performed in the same way as it is for equality, except that if one input has a value for a given precision and the other does not, the comparison stops and the result is false, rather than null. As with equality, the second and millisecond precisions are combined as a single precision using a decimal, with decimal equivalence semantics.
For Code values, equivalence is defined based on the code and system elements only. The display and version elements are ignored for the purposes of determining Code equivalence.
For Concept values, equivalence is defined as a non-empty intersection of the codes in each Concept.
Note that this operator will always return true or false, even if either or both of its arguments are null or contain null components.
*/
interface Equivalent extends AbstractBinaryExpression {
type: "Equivalent";
}
/*
The NotEqual operator returns true if its arguments are not the same value.
The NotEqual operator is a shorthand for invocation of logical negation of the Equal operator.
*/
interface NotEqual extends AbstractBinaryExpression {
type: "NotEqual";
}
/*
The Less operator returns true if the first argument is less than the second argument.
For comparisons involving quantities, the dimensions of each quantity must be the same, but not necessarily the unit. For example, units of 'cm' and 'm' are comparable, but units of 'cm2' and 'cm' are not. Attempting to operate on quantities with invalid units will result in a null. When a quantity has no units specified, it is treated as a quantity with the default unit ('1').
For time-valued quantities, the UCUM definite-quantity durations above days (and weeks) are not comparable to calendar durations. Definite-time duration unit conversions shall be performed as specified in ISO-8601, while calendar-time duration unit conversions shall be performed according to calendar duration semantics. In particular, unit conversion between variable length calendar durations (i.e. years and months) and definite-time durations (i.e. days or below) results in null.
For Date, Time, and DateTime values, the comparison is performed by considering each precision in order, beginning with years (or hours for time values). If the values are the same, comparison proceeds to the next precision; if the first value is less than the second, the result is true; if the first value is greater than the second, the result is false; if one input has a value for the precision and the other does not, the comparison stops and the result is null; if neither input has a value for the precision or the last precision has been reached, the comparison stops and the result is false. For the purposes of comparison, seconds and milliseconds are combined as a single precision using a decimal, with decimal comparison semantics.
If either argument is null, the result is null.
The Less operator is defined for the Integer, Long, Decimal, String, Date, DateTime, Time, and Quantity types.
Note that relative ratio comparisons are not directly supported due to the variance of uses within healthcare. See the discussion in Ratio Operators in the Author's Guide for more information.
*/
interface Less extends AbstractBinaryExpression {
type: "Less";
}
/*
The Greater operator returns true if the first argument is greater than the second argument.
The Greater operator is defined for the Integer, Long, Decimal, String, Date, DateTime, Time, and Quantity types.
For comparisons involving quantities, the dimensions of each quantity must be the same, but not necessarily the unit. For example, units of 'cm' and 'm' are comparable, but units of 'cm2' and 'cm' are not. Attempting to operate on quantities with invalid units will result in null. When a quantity has no units specified, it is treated as a quantity with the default unit ('1').
For time-valued quantities, the UCUM definite-quantity durations above days (and weeks) are not comparable to calendar durations. Definite-time duration unit conversions shall be performed as specified in ISO-8601, while calendar-time duration unit conversions shall be performed according to calendar duration semantics. In particular, unit conversion between variable length calendar durations (i.e. years and months) and definite-time durations (i.e. days or below) results in null.
For Date, Time, and DateTime values, the comparison is performed by considering each precision in order, beginning with years (or hours for time values). If the values are the same, comparison proceeds to the next precision; if the first value is greater than the second, the result is true; if the first value is less than the second, the result is false; if one input has a value for the precision and the other does not, the comparison stops and the result is null; if neither input has a value for the precision or the last precision has been reached, the comparison stops and the result is false. For the purposes of comparison, seconds and milliseconds are combined as a single precision using a decimal, with decimal comparison semantics.
When comparing DateTime values with different timezone offsets, implementations should normalize to the timezone offset of the evaluation request timestamp, but only when the comparison precision is hours, minutes, seconds, or milliseconds.
If either argument is null, the result is null.
Note that relative ratio comparisons are not directly supported due to the variance of uses within healthcare. See the discussion in Ratio Operators in the Author's Guide for more information.
*/
interface Greater extends AbstractBinaryExpression {
type: "Greater";
}
/*
The LessOrEqual operator returns true if the first argument is less than or equal to the second argument.
The LessOrEqual operator is defined for the Integer, Long, Decimal, String, Date, DateTime, Time, and Quantity types.
For comparisons involving quantities, the dimensions of each quantity must be the same, but not necessarily the unit. For example, units of 'cm' and 'm' are comparable, but units of 'cm2' and 'cm' are not. Attempting to operate on quantities with invalid units will result in a null. When a quantity has no units specified, it is treated as a quantity with the default unit ('1').
For time-valued quantities, the UCUM definite-quantity durations above days (and weeks) are not comparable to calendar durations. Definite-time duration unit conversions shall be performed as specified in ISO-8601, while calendar-time duration unit conversions shall be performed according to calendar duration semantics. In particular, unit conversion between variable length calendar durations (i.e. years and months) and definite-time durations (i.e. days or below) results in null.
For Date, Time, and DateTime values, the comparison is performed by considering each precision in order, beginning with years (or hours for time values). If the values are the same, comparison proceeds to the next precision; if the first value is less than the second, the result is true; if the first value is greater than the second, the result is false; if one input has a value for the precision and the other does not, the comparison stops and the result is null; if neither input has a value for the precision or the last precision has been reached, the comparison stops and the result is true. For the purposes of comparison, seconds and milliseconds are combined as a single precision using a decimal, with decimal comparison semantics.
When comparing DateTime values with different timezone offsets, implementations should normalize to the timezone offset of the evaluation request timestamp, but only when the comparison precision is hours, minutes, seconds, or milliseconds.
If either argument is null, the result is null.
Note that relative ratio comparisons are not directly supported due to the variance of uses within healthcare. See the discussion in Ratio Operators in the Author's Guide for more information.
*/
interface LessOrEqual extends AbstractBinaryExpression {
type: "LessOrEqual";
}
/*
The GreaterOrEqual operator returns true if the first argument is greater than or equal to the second argument.
The GreaterOrEqual operator is defined for the Integer, Long, Decimal, String, Date, DateTime, Time, and Quantity types.
For comparisons involving quantities, the dimensions of each quantity must be the same, but not necessarily the unit. For example, units of 'cm' and 'm' are comparable, but units of 'cm2' and 'cm' are not. Attempting to operate on quantities with invalid units will result in a null. When a quantity has no units specified, it is treated as a quantity with the default unit ('1').
For time-valued quantities, the UCUM definite-quantity durations above days (and weeks) are not comparable to calendar durations. Definite-time duration unit conversions shall be performed as specified in ISO-8601, while calendar-time duration unit conversions shall be performed according to calendar duration semantics. In particular, unit conversion between variable length calendar durations (i.e. years and months) and definite-time durations (i.e. days or below) results in null.
For Date, Time, and DateTime values, the comparison is performed by considering each precision in order, beginning with years (or hours for time values). If the values are the same, comparison proceeds to the next precision; if the first value is greater than the second, the result is true; if the first value is less than the second, the result is false; if one input has a value for the precision and the other does not, the comparison stops and the result is null; if neither input has a value for the precision or the last precision has been reached, the comparison stops and the result is true. For the purposes of comparison, seconds and milliseconds are combined as a single precision using a decimal, with decimal comparison semantics.
When comparing DateTime values with different timezone offsets, implementations should normalize to the timezone offset of the evaluation request timestamp, but only when the comparison precision is hours, minutes, seconds, or milliseconds.
If either argument is null, the result is null.
Note that relative ratio comparisons are not directly supported due to the variance of uses within healthcare. See the discussion in Ratio Operators in the Author's Guide for more information.
*/
interface GreaterOrEqual extends AbstractBinaryExpression {
type: "GreaterOrEqual";
}
/*
The Add operator performs numeric addition of its arguments.
When adding quantities, the dimensions of each quantity must be the same, but not necessarily the unit. For example, units of 'cm' and 'm' can be added, but units of 'cm2' and 'cm' cannot. The unit of the result will be the most granular unit of either input. Attempting to operate on quantities with invalid units will result in a run-time error.
The Add operator is defined for the Integer, Long, Decimal, and Quantity types. In addition, a time-valued Quantity can be added to a Date, DateTime or Time using this operator.
For Date, DateTime, and Time values, the operator returns the value of the first argument, incremented by the time-valued quantity, respecting variable length periods for calendar years and months.
For Date values, the quantity unit must be one of years, months, weeks, or days.
For DateTime values, the quantity unit must be one of years, months, weeks, days, hours, minutes, seconds, or milliseconds.
For Time values, the quantity unit must be one of hours, minutes, seconds, or milliseconds.
Note that as with any Date, Time, or DateTime operations, temporal units may be specified with either singular, plural, or UCUM units. However, to avoid the potential confusion of calendar-based date and time arithmetic with definite-duration date and time arithmetic, it is an error to attempt to add a definite-duration time-valued unit above days (and weeks), a calendar duration must be used.
For precisions above seconds, any decimal portion of the time-valued quantity is ignored, since date/time arithmetic above seconds is performed with calendar duration semantics.
For partial date/time values where the time-valued quantity is more precise than the partial date/time, the operation is performed by converting the time-based quantity to the highest specified granularity in the first argument (truncating any resulting decimal portion) and then adding it to the first argument.
If either argument is null, the result is null.
If the result of the addition cannot be represented (i.e. arithmetic overflow), the result is null.
*/
interface Add extends AbstractBinaryExpression {
type: "Add";
}
/*
The Subtract operator performs numeric subtraction of its arguments.
When subtracting quantities, the dimensions of each quantity must be the same, but not necessarily the unit. For example, units of 'cm' and 'm' can be subtracted, but units of 'cm2' and 'cm' cannot. The unit of the result will be the most granular unit of either input. Attempting to operate on quantities with invalid units will result in a run-time error.
The Subtract operator is defined for the Integer, Long, Decimal, and Quantity types. In addition, a time-valued Quantity can be subtracted from a Date, DateTime, or Time using this operator.
For Date, DateTime, Time values, the operator returns the value of the first argument, decremented by the time-valued quantity, respecting variable length periods for calendar years and months.
For Date values, the quantity unit must be one of years, months, weeks, or days.
For DateTime values, the quantity unit must be one of years, months, weeks, days, hours, minutes, seconds, or milliseconds.
For Time values, the quantity unit must be one of hours, minutes, seconds, or milliseconds.
Note that as with any Date, Time, or DateTime operations, temporal units may be specified with either singular, plural, or UCUM units. However, to avoid the potential confusion of calendar-based date and time arithmetic with definite-duration date and time arithmetic, it is an error to attempt to subtract a definite-duration time-valued unit above days (and weeks), a calendar duration must be used.
For precisions above seconds, any decimal portion of the time-valued quantity is ignored, since date/time arithmetic above seconds is performed with calendar duration semantics.
For partial date/time values where the time-valued quantity is more precise than the partial date/time, the operation is performed by converting the time-based quantity to the highest specified granularity in the first argument (truncating any resulting decimal portion) and then subtracting it from the first argument.
If either argument is null, the result is null.
If the result of the operation cannot be represented, the result is null.
*/
interface Subtract extends AbstractBinaryExpression {
type: "Subtract";
}
/*
The Multiply operator performs numeric multiplication of its arguments.
For multiplication operations involving quantities, the resulting quantity will have the appropriate unit.
If either argument is null, the result is null.
If the result of the operation cannot be represented, the result is null.
The Multiply operator is defined for the Integer, Long, Decimal and Quantity types.
*/
interface Multiply extends AbstractBinaryExpression {
type: "Multiply";
}
/*
The Divide operator performs numeric division of its arguments. Note that the result type of Divide is Decimal, even if its arguments are of type Integer. For integer division, use the truncated divide operator.
For division operations involving quantities, the resulting quantity will have the appropriate unit.
If either argument is null, the result is null.
If the result of the division cannot be represented, or the right argument is 0, the result is null.
The Divide operator is defined for the Decimal and Quantity types.
*/
interface Divide extends AbstractBinaryExpression {
type: "Divide";
}
/*
The TruncatedDivide operator performs integer division of its arguments.
If either argument is null, the result is null.
If the result of the operation cannot be represented, or the right argument is 0, the result is null.
The TruncatedDivide operator is defined for the Integer, Long, Decimal, and Quantity types.
For TruncatedDivide operations involving quantities, the resulting quantity will have the appropriate unit.
*/
interface TruncatedDivide extends AbstractBinaryExpression {
type: "TruncatedDivide";
}
/*
The Modulo operator computes the remainder of the division of its arguments.
If either argument is null, the result is null.
If the result of the modulo cannot be represented, or the right argument is 0, the result is null.
The Modulo operator is defined for the Integer, Long, Decimal, and Quantity types.
For Modulo operations involving quantities, the resulting quantity will have the appropriate unit.
*/
interface Modulo extends AbstractBinaryExpression {
type: "Modulo";
}
/*
The Ceiling operator returns the first integer greater than or equal to the argument.
If the argument is null, the result is null.
*/
interface Ceiling extends AbstractUnaryExpression {
type: "Ceiling";
}
/*
The Floor operator returns the first integer less than or equal to the argument.
If the argument is null, the result is null.
*/
interface Floor extends AbstractUnaryExpression {
type: "Floor";
}
/*
The Truncate operator returns the integer component of its argument.
If the argument is null, the result is null.
*/
interface Truncate extends AbstractUnaryExpression {
type: "Truncate";
}
/*
The Abs operator returns the absolute value of its argument.
When taking the absolute value of a quantity, the unit is unchanged.
If the argument is null, the result is null.
If the result of taking the absolute value of the argument cannot be represented (e.g. Abs(minimum Integer)), the result is null.
The Abs operator is defined for the Integer, Long, Decimal, and Quantity types.
*/
interface Abs extends AbstractUnaryExpression {
type: "Abs";
}
/*
The Negate operator returns the negative of its argument.
When negating quantities, the unit is unchanged.
If the argument is null, the result is null.
If the result of negating the argument cannot be represented (e.g. -(minimum Integer)), the result is null.
The Negate operator is defined for the Integer, Long, Decimal, and Quantity types.
*/
interface Negate extends AbstractUnaryExpression {
type: "Negate";
}
/*
The Round operator returns the nearest integer to its argument. The semantics of round are defined as a traditional round, meaning that a decimal value of 0.5 or higher will round to 1.
If the argument is null, the result is null.
Precision determines the decimal place at which the rounding will occur. If precision is not specified or null, 0 is assumed.
*/
interface Round extends AbstractOperatorExpression {
type: "Round";
operand: Expression;
precision?: Expression;
}
/*