OntoDL Statement: set: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(→Syntax) |
(→Semantics of the set-operator) |
||
| Zeile 49: | Zeile 49: | ||
! a=string<br>b=string | ! a=string<br>b=string | ||
! a=object<br>b=object | ! a=object<br>b=object | ||
| − | ! a=empty | + | ! a=empty collection |
| − | ! a=collection<br>b=string | + | !style="width:7em" | a=collection<br>b=string |
| − | ! a=collection<br>b=object | + | !style="width:7em" | a=collection<br>b=object |
| − | |- | + | |- style="vertical-align:top" |
| $= | | $= | ||
| − | | String Concatenation | + | | String Concatenation: If a and b are strings, the result is a concatenation of both string. If a is a collection of strings, b will be appended to each element of the collection. Collection elements may be filtered by qualifiers (e.g. <br><font face=courier>set me.Designation[Language=de] $= ($ (German)</font><br> append the text "(German)" to all German designations in the collection. |
| ab | | ab | ||
| ''error'' | | ''error'' | ||
| Zeile 60: | Zeile 60: | ||
| {a<sub>1</sub>b, .. , a<sub>n</sub>b} | | {a<sub>1</sub>b, .. , a<sub>n</sub>b} | ||
| ''error'' | | ''error'' | ||
| + | |- style="vertical-align:top" | ||
| + | | -= | ||
| + | | No Replacement: the set operation is only performed if a is empty. If a already carries a value or is a non-empty collection, the value of a will not be altered. | ||
| + | | a | ||
| + | | a | ||
| + | | { b } | ||
| + | | { a } | ||
| + | | { a } | ||
| + | |- style="vertical-align:top" | ||
| + | | := | ||
| + | | Overwrite: The value of a is overwritten by b. In case a is a collection, b will be set as the only element of the collection. Collection elements may be filtered by qualifiers (e.g. <br><font face=courier>set me.Designation[Language=de] := NULL</font><br> removes all German language designation from the list). | ||
| + | | b | ||
| + | | b | ||
| + | | { b } | ||
| + | | { b } | ||
| + | | { b } | ||
| + | |- style="vertical-align:top" | ||
| + | | += | ||
| + | | Append to List: If a is a collection, b will be added to that collection. If a is a single object, a will be replaced by b. | ||
| + | | b | ||
| + | | b | ||
| + | | { b } | ||
| + | | { a<sub>1</sub>, .., a<sub>n</sub>, b } | ||
| + | | { a<sub>1</sub>, .., a<sub>n</sub>, b } | ||
| + | |- style="vertical-align:top" | ||
| + | | = | ||
| + | | The default behavior is ''Append to List'' | ||
| + | | b | ||
| + | | b | ||
| + | | { b } | ||
| + | | { a<sub>1</sub>, .., a<sub>n</sub>, b } | ||
| + | | { a<sub>1</sub>, .., a<sub>n</sub>, b } | ||
|} | |} | ||
Version vom 7. September 2016, 14:24 Uhr
Syntax
| SetStatement | := | set InternalReference SetOperator CopyMode? AssignedValue | ||
| AssignedValue | := | InternalReference | ||
| | | = QualifiedConcept | |||
| | | = Text | |||
| SetOperator | := | $= | -= | += | := | controls the behavior of the set-statement, e. g. if a collection shall be extended by the AssignedValue or if the AssignedValue shall replace the existing contents of the collection (see section below for details) | |
| CopyMode | := | = | signals that a full copy of the Assigned Value shall be created before assigning it to an object (see section below for details) |
Semantics of the set-operator
| Operator | Sematics | a=string b=string |
a=object b=object |
a=empty collection | a=collection b=string |
a=collection b=object |
|---|---|---|---|---|---|---|
| $= | String Concatenation: If a and b are strings, the result is a concatenation of both string. If a is a collection of strings, b will be appended to each element of the collection. Collection elements may be filtered by qualifiers (e.g. set me.Designation[Language=de] $= ($ (German) append the text "(German)" to all German designations in the collection. |
ab | error | { b } | {a1b, .. , anb} | error |
| -= | No Replacement: the set operation is only performed if a is empty. If a already carries a value or is a non-empty collection, the value of a will not be altered. | a | a | { b } | { a } | { a } |
| := | Overwrite: The value of a is overwritten by b. In case a is a collection, b will be set as the only element of the collection. Collection elements may be filtered by qualifiers (e.g. set me.Designation[Language=de] := NULL removes all German language designation from the list). |
b | b | { b } | { b } | { b } |
| += | Append to List: If a is a collection, b will be added to that collection. If a is a single object, a will be replaced by b. | b | b | { b } | { a1, .., an, b } | { a1, .., an, b } |
| = | The default behavior is Append to List | b | b | { b } | { a1, .., an, b } | { a1, .., an, b } |