OntoDL Statement: set: Unterschied zwischen den Versionen

Aus CTS2-LE
Zur Navigation springen Zur Suche springen
(Syntax)
(Semantics of the set-operator)
Zeile 72: Zeile 72:
 
<hr>
 
<hr>
  
== Semantics of the set-operator ==
+
== Semantics of the set modes ==
 
{|class="wikitable"
 
{|class="wikitable"
! Operator
+
! Mode
 
! Sematics
 
! Sematics
 
! a=string<br>b=string
 
! a=string<br>b=string
Zeile 82: Zeile 82:
 
!style="width:7em" | a=collection<br>b=object
 
!style="width:7em" | a=collection<br>b=object
 
|- style="vertical-align:top"
 
|- style="vertical-align:top"
| $=
+
| concat
| 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.  
+
| 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] =[Mode=concat] ($ (German)</font><br> append the text "(German)" to all German designations in the collection.<p>
 +
If a and b are numeric and the ''Valuetype'' qualifier is set to ''numeric'', the result is the sum of a and b. If a is a collection of numeric strings, b will be added to each number element of the collection. 
 
| ab
 
| ab
 
| ''error''
 
| ''error''
Zeile 90: Zeile 91:
 
| ''error''
 
| ''error''
 
|- style="vertical-align:top"
 
|- style="vertical-align:top"
| -=
+
| no-overwrite
| 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.
+
| 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
 
| a
 
| a
Zeile 98: Zeile 99:
 
| { a }
 
| { a }
 
|- style="vertical-align:top"
 
|- style="vertical-align:top"
| :=
+
| overwrite
| 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).
+
| 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] =[Mode=overwrite] NULL</font><br> removes all German language designation from the list).
 
| b
 
| b
 
| b
 
| b
Zeile 106: Zeile 107:
 
| { b }
 
| { b }
 
|- style="vertical-align:top"
 
|- style="vertical-align:top"
| +=
+
| append
| 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.
+
| If a is a collection, b will be appended to that collection.  
 
| ''error''
 
| ''error''
 
| ''error''
 
| ''error''
Zeile 114: Zeile 115:
 
| { a<sub>1</sub>, .., a<sub>n</sub>, b }
 
| { a<sub>1</sub>, .., a<sub>n</sub>, b }
 
|- style="vertical-align:top"
 
|- style="vertical-align:top"
| =
+
| default
 
| The default behavior is ''Overwrite'' for single strings/objects and ''Append to List'' for collections
 
| The default behavior is ''Overwrite'' for single strings/objects and ''Append to List'' for collections
 
| b
 
| b
Zeile 122: Zeile 123:
 
| { a<sub>1</sub>, .., a<sub>n</sub>, b }
 
| { a<sub>1</sub>, .., a<sub>n</sub>, b }
 
|}
 
|}
 +
If no Mode qualifier is given, the behavior of the set-statement is like <font face=courier>[Mode=default]</font>.

Version vom 8. September 2016, 11:15 Uhr

Syntax

SetStatement := set InternalReference = SetModeQualifier* AssignedValue  
AssignedValue := InternalReference
| = QualifiedConcept
| = Text
SetModeQualifer :=  [ Mode = QualiferValueMode ] controls the overall behavior of the set-statement (see below)
|  [ Copy = QualiferValueCopy ] copy-by-value vs. copy-by-reference
|  [ Delimiter = Name ] for Mode=concat: insert a demiter between the concatenated strings
|  [ Valuetype = QualiferValueType ] for Mode=concat: string concatenation vs. numeric addition
QualifierValueMode := overwrite | no-overwrite | concat | append
QualifierValueCopy := value | reference
QualifierValueType := numeric


Semantics of the set modes

Mode Sematics a=string
b=string
a=object
b=object
a=empty collection a=collection
b=string
a=collection
b=object
concat 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] =[Mode=concat] ($ (German)
append the text "(German)" to all German designations in the collection.

If a and b are numeric and the Valuetype qualifier is set to numeric, the result is the sum of a and b. If a is a collection of numeric strings, b will be added to each number element of the collection.

ab error { b } {a1b, .. , anb} error
no-overwrite 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] =[Mode=overwrite] NULL
removes all German language designation from the list).
b b { b } { b } { b }
append If a is a collection, b will be appended to that collection. error error { b } { a1, .., an, b } { a1, .., an, b }
default The default behavior is Overwrite for single strings/objects and Append to List for collections b b { b } { a1, .., an, b } { a1, .., an, b }

If no Mode qualifier is given, the behavior of the set-statement is like [Mode=default].