OwS Tutorial: Using Defaults (Part 1)
Inhaltsverzeichnis
Motivation
- Rationale
- In the previous lesson the OwS #heading directive was introduced for mapping heading levels onto levels of a code system definition. Even though this makes the text look much more like a description than a formal definition, there are still many OwS statements inside the code system definition. The ambition of OwS is to provide easy means for turining ordiary MS Word texts into powerful code system definitions.
- In this lesson you will learn how to take common property definitions out of single code system definitions by using defaults. Defaults allow you to define common properties only once in the begining of an OwS file.
- What you need
- You should have worked through lesson 2 of this tutorial in order to have a basic understanding of OwS objects and properties. Beside this you need your MS Word with the OwS macro installed.
- Example
- This example builds upon the example introduced in Lesson 1 which again implements a simple story board:
- Storyboard: In order to foster semantic interoperability among its IT-systems a hospital wants to define unique terminologies for its clinics. Each clinic and each ward shall be assigned a unique code that shall be used throughout all IT-systems for referring to that clinic or ward.
The default statement
The default statement sets a default value for a named property. If the value of that property is not explicitly set within the object's definition scope, the default value is used as the value for that property.
Setting default values for properties is especially useful for
- properties that carry the same value for many objects (e. g. if you define a German code system most of the string values used for defining concepts will have the value "de" for the Language property),
- properties that carry information that is solely required by the OwS parser or the CTS2-LE server. Setting these properties' values by default allows to move the respective definitions out of the object definition.
Global vs Local Defaults
default statements may be placed outside any object definition. In this case the default value is only bound to the name of a property; every OwS type that contains a property of this name will use the default for that property (unless the property value is explicitly given). A good example for this is setting a default for the Language property which is used for defining codesystem as well as concept objects. Putting a respective default outside any object definition makes the default value applicable to all codesystem and concept definitions:
default Language = de
If you want a default value to be visible with a smaller scope, you may as well set a default value within an object definition.
define codesystem (Clinics and Wards) {
default Language = de
...
}
Side Effects
Setting a default for the Language property has a side effect on the Display property of newly defined concepts: If no value is explicitly defined for the Display property of a concept, the value of the Display property is set to the value of the Designation property in the default language.
Full Example
| Style Sheet | Text | Comment | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| OwS | #heading 2 codesystem .Name ( .Version ) | Comment | ||||||||
| OwS | #heading 3-4 concept .Display ( .Name ) | Comment | ||||||||
| OwS | default Group = EXA | Comment | ||||||||
| OwS | default Copyright = ($ copyright (c) 2016, Jörg Caumanns | Comment | ||||||||
| OwS | default Language = de | Comment | ||||||||
| Standard | Comment | |||||||||
| Überschrift 2 | Clinics and Wards (0.1) | Comment | ||||||||
| OwS |
|
Comment | ||||||||
| Überschrift 4 | Cardiologic care ward for Women and Children (ward 51.1) | Comment | ||||||||
| OwS |
|
Comment | ||||||||
| Überschrift 4 | Cardiologic care ward for Intensive Care (ward 51.2) | Comment | ||||||||
| OwS |
|
Comment | ||||||||
| OwS | Comment | |||||||||
| Überschrift 4 | Orthopedic care ward for knee and hip patients (ward 52.1) | Comment | ||||||||
| OwS |
|
Comment |
<?xml version="1.0" encoding="UTF-8"?>
<ValueSet ....>
...
<copyright value="copyright (c) 2016, Jörg Caumanns"/>
<codeSystem>
...
<concept>
<code value="cardiologic clinic"/>
<display value="Cardiologic Clinic, Prof. Smyth"/>
<definition value="The Cardiologic Clinic ...."/>
<designation>
<language value="de"/>
<value value="Kardiologische Klinik"/>
</designation>
<concept>
<code value="ward 51.1"/>
<display value="Cardiologic care ward for Women and Children"/>
<definition/>
<designation>
<language value="de"/>
<value value="Kardiologische Station für Frauen und Kinder"/>
</designation>
</concept>
...
</codeSystem>
</ValueSet>