OntoDL Statement: set: Unterschied zwischen den Versionen

Aus CTS2-LE
Zur Navigation springen Zur Suche springen
(Syntax)
(Syntax)
 
(5 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 17: Zeile 17:
 
|
 
|
 
| style="text-align:right" | |
 
| style="text-align:right" | |
| '''=''' [[OntoDL Syntax: QualifiedConcept|''QualifiedConcept'']]
+
| [[OntoDL Syntax: QualifiedConcept|''QualifiedConcept'']]
 
|
 
|
 
|
 
|
 +
|-
 +
|
 +
| style="text-align:right" | |
 +
| '''{''' [[OntoDL Statement: define|''FullDefinition'']]* '''}'''
 +
|
 +
|                      <font face="arial" size="2">can only be used for properties with a custom type. Requires the ''InlineSource'' property of the type to be set to a codesystem object. </font>
 
|- style="vertical-align:top"
 
|- style="vertical-align:top"
 
|
 
|
 
| style="text-align:right" | &#124;
 
| style="text-align:right" | &#124;
| '''=''' [[OntoDL Syntax: Text|''Text'']]  
+
| '''($'''? [[OntoDL Statement: Base Types|''Text'']]  
 
|
 
|
| <font face="arial" size="2"></font>
+
| <font face="arial" size="2">The prefix "($" advises the OntoDL interpreter to consider the provided text as a string (which will not be further processed)</font>
 
|- style="vertical-align:top"
 
|- style="vertical-align:top"
 
| ''SetModeQualifer''  
 
| ''SetModeQualifer''  
Zeile 44: Zeile 50:
 
|
 
|
 
| <font face="arial" size="2">for Mode=concat: insert a demiter between the concatenated strings</font>
 
| <font face="arial" size="2">for Mode=concat: insert a demiter between the concatenated strings</font>
|- style="vertical-align:top"
 
|
 
| style="text-align:right" | &#124;
 
| &nbsp;'''[''' '''Valuetype''' '''=''' QualiferValueType ''']'''
 
|
 
| <font face="arial" size="2">for Mode=concat: string concatenation vs. numeric addition </font>
 
 
|- style="vertical-align:top"
 
|- style="vertical-align:top"
 
| ''QualifierValueMode''  
 
| ''QualifierValueMode''  
 
| :=  
 
| :=  
| &nbsp; '''default''' &#124; '''overwrite''' &#124; '''no-overwrite''' &#124; '''concat''' &#124; '''append'''  
+
| &nbsp; '''default''' &#124; '''overwrite''' &#124; '''no-overwrite''' &#124; '''concat''' &#124; '''append''' &#124; '''add'''  
 
|
 
|
 
|
 
|
Zeile 60: Zeile 60:
 
| :=  
 
| :=  
 
| &nbsp; '''default''' &#124; '''value''' &#124; '''reference'''
 
| &nbsp; '''default''' &#124; '''value''' &#124; '''reference'''
|
 
|
 
|- style="vertical-align:top"
 
| ''QualifierValueType''
 
| :=
 
| &nbsp; '''string''' &#124; '''numeric'''
 
 
|
 
|
 
|
 
|
Zeile 72: Zeile 66:
 
<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 76:
 
!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> appends the text "(German)" to all German designations in the collection.<p>
 
| ab
 
| ab
 
| ''error''
 
| ''error''
Zeile 90: Zeile 84:
 
| ''error''
 
| ''error''
 
|- style="vertical-align:top"
 
|- style="vertical-align:top"
| -=
+
| add
| 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 and b must be strings representing a numeric value. The result is a string holding the arithmetic sum of a and b. If a is a collection of numeric strings, b will be added to each number element of the collection. 
 +
| a+b
 +
| ''error''
 +
| { b }
 +
| {a<sub>1</sub>+b,&nbsp;..&nbsp;,&nbsp;a<sub>n</sub>+b}
 +
| ''error''
 +
|- style="vertical-align:top"
 +
| 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
 
| a
 
| a
Zeile 98: Zeile 100:
 
| { 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 108:
 
| { 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 116:
 
| { 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 124:
 
| { 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>.

Aktuelle Version vom 21. September 2016, 00:36 Uhr

Syntax

SetStatement := set InternalReference = SetModeQualifier* AssignedValue  
AssignedValue := InternalReference
| QualifiedConcept
| { FullDefinition* } can only be used for properties with a custom type. Requires the InlineSource property of the type to be set to a codesystem object.
| ($? Text The prefix "($" advises the OntoDL interpreter to consider the provided text as a string (which will not be further processed)
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
QualifierValueMode := overwrite | no-overwrite | concat | append | add
QualifierValueCopy := value | reference


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)
appends the text "(German)" to all German designations in the collection.

ab error { b } {a1b, .. , anb} error
add a and b must be strings representing a numeric value. The result is a string holding the arithmetic sum of a and b. If a is a collection of numeric strings, b will be added to each number element of the collection. a+b error { b } {a1+b, .. , an+b} 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].