OntoDL Statement: set: Unterschied zwischen den Versionen

Aus CTS2-LE
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „== Syntax == <hr><font face="courier"> {|border="0" | ''SetStatement'' | := | '''set''' ''InternalReference'' ''SetOpera…“)
 
(Syntax)
 
(10 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 
== Syntax ==
 
== Syntax ==
<hr><font face="courier">
+
<font face="courier">
{|border="0"
+
{|border="0"  
| ''SetStatement''  
+
|- style="vertical-align:top"
| :=  
+
| style="width:10em" | ''SetStatement''  
| '''set''' [[OntoDL Syntax: InternalReference|''InternalReference'']] ''SetOperator'' ''AssignedValue''
+
| style="width:3em"  | :=  
|-
+
| style="width:36em" |  '''set''' [[OntoDL Syntax: InternalReference|''InternalReference'']] '''=''' ''SetModeQualifier''* ''AssignedValue''
 +
| style="width:1em" | &nbsp;
 +
|                      <font face="arial" size="2"> </font>
 +
|- style="vertical-align:top"
 
| ''AssignedValue''  
 
| ''AssignedValue''  
 
| :=  
 
| :=  
 
| [[OntoDL Syntax: InternalReference|''InternalReference'']]  
 
| [[OntoDL Syntax: InternalReference|''InternalReference'']]  
 +
|
 +
|
 
|-
 
|-
 
|
 
|
 
| style="text-align:right" | &#124;
 
| style="text-align:right" | &#124;
| '''=''' [[OntoDL Syntax: QualifiedConcept|''QualifiedConcept'']]
+
| [[OntoDL Syntax: QualifiedConcept|''QualifiedConcept'']]
 +
|
 +
|
 
|-
 
|-
 
|
 
|
 
| style="text-align:right" | &#124;
 
| style="text-align:right" | &#124;
| '''=''' [[OntoDL Syntax: Text|''Text'']]  
+
| '''{''' [[OntoDL Statement: define|''FullDefinition'']]* '''}'''
|-
+
|
| ''SetOperator''  
+
|                      <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="text-align:right" | &#124;
 +
| '''($'''? [[OntoDL Statement: Base Types|''Text'']]
 +
|
 +
| <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"
 +
| ''SetModeQualifer''
 +
| :=
 +
| &nbsp;'''[''' '''Mode''' '''=''' QualiferValueMode ''']'''
 +
|
 +
|<font face="arial" size="2">controls the overall behavior of the set-statement (see below)</font>
 +
|- style="vertical-align:top"
 +
|
 +
| style="text-align:right" | &#124;
 +
| &nbsp;'''[''' '''Copy''' '''=''' QualiferValueCopy ''']'''
 +
|
 +
| <font face="arial" size="2">copy-by-value vs. copy-by-reference</font>
 +
|- style="vertical-align:top"
 +
|
 +
| style="text-align:right" | &#124;
 +
| &nbsp;'''[''' '''Delimiter''' '''=''' ''Name'' ''']'''
 +
|
 +
| <font face="arial" size="2">for Mode=concat: insert a demiter between the concatenated strings</font>
 +
|- style="vertical-align:top"
 +
| ''QualifierValueMode''
 +
| :=
 +
| &nbsp; '''default''' &#124; '''overwrite''' &#124; '''no-overwrite''' &#124; '''concat''' &#124; '''append''' &#124; '''add'''
 +
|
 +
|
 +
|- style="vertical-align:top"
 +
| ''QualifierValueCopy''  
 
| :=  
 
| :=  
| &nbsp;&nbsp;'''=''' &#124; '''$=''' &#124; '''-=''' &#124; '''+=''' &#124; ''':='''
+
| &nbsp; '''default''' &#124; '''value''' &#124; '''reference'''
 +
|
 +
|
 
|}
 
|}
 
</font>
 
</font>
 
<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
 
! a=object<br>b=object
 
! a=object<br>b=object
! a=empty&nbsp;collection
+
! 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"
| $=
+
| 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] =[Mode=concat] ($ (German)</font><br> appends the text "(German)" to all German designations in the collection.<p>
 
| ab
 
| ab
 
| ''error''
 
| ''error''
Zeile 42: Zeile 83:
 
| {a<sub>1</sub>b,&nbsp;..&nbsp;,&nbsp;a<sub>n</sub>b}
 
| {a<sub>1</sub>b,&nbsp;..&nbsp;,&nbsp;a<sub>n</sub>b}
 
| ''error''
 
| ''error''
 +
|- style="vertical-align:top"
 +
| 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 }
 +
| {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
 +
| { 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] =[Mode=overwrite] NULL</font><br> removes all German language designation from the list).
 +
| b
 +
| b
 +
| { b }
 +
| { b }
 +
| { b }
 +
|- style="vertical-align:top"
 +
| append
 +
| If a is a collection, b will be appended to that collection.
 +
| ''error''
 +
| ''error''
 +
| { b }
 +
| { a<sub>1</sub>, .., a<sub>n</sub>, b }
 +
| { a<sub>1</sub>, .., a<sub>n</sub>, b }
 +
|- style="vertical-align:top"
 +
| default
 +
| The default behavior is ''Overwrite'' for single strings/objects and ''Append to List'' for collections
 +
| b
 +
| b
 +
| { b }
 +
| { 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].