OwS Style Sheet Directive: heading

Aus CTS2-LE
Zur Navigation springen Zur Suche springen

Syntax

HeadingDirective := #heading Level TypeName Mask  
| #heading Level
Level := [1-9](-[1-9])?


Description

The #heading directive considers a MS Word chapter or section as an OwS object definition. The #heading directive takes 3 arguments:

argument description
Level The heading levels that trigger the directive. E.g. if "2-4" is provided for this argument, the directive only applies to MS Word headlines which are formatted by style sheets that are registered as level-2, level-3 and level-4 headings.
TypeName The type of the object that shall be created and defined by the headline text and the section/chapter assigned to that headline. As well OwS buildin types as custom types may be devined through the #heading directive.
Mask Pattern that defines how properties of the newly defined object are provided within the headline text.

Defining the Headline Text Pattern

The Mask argument is a sequence of OwS property names and non-interpreted text. Property names shall start with a dot (.) and denote a property that is defined for the object that is to be created. Property names and non-interpreted text shall alternate within the mask. Non-interpreted text shall not include dots (because otherwise the OwS Tokenizer would consider the word following the dot as a property name). The table below gives some examples for valid mask definitions:

mask typename example headline text equivalent to
.Name codesystem Ingredients and Tools
define codesystem (Ingredients and Tools) { ... } 
.Name and Tools codesystem Ingredients and Tools
define codesystem (Ingredients) { ... } 
Ingredients and .Name codesystem Ingredients and Tools
define codesystem (Tools) { ... } 
.Name ( .Display ) concept sugar white (White Sugar)
define concept (sugar white) {
  set .Display = (White Sugar)
  ... 
} 
.Name : .Code ( .Designation[Language=de] ) concept sugar white:37 (Zucker)
define concept (sugar white) {
  set .Code = (37)
  set .Designation[Language=de] = (Zucker)
  ... 
} 

The following restrictions apply:

  • when defining a codesystem, property, predicate or type, the Name-property shall be provided as part of the headline text
  • when defining a concept, either the Name- or the Code-property shall be provided as part of the headline text. If only a Code is provided, the code of the concept is also used as the name of the concept.

Linking MS Word Sections and Definition Scopes

Each object definition has its definition scope. When defining an object through the #heading directive the defined object's definition scope corresponds to the scope of the section that was opened with the heading.

The example below shows this correspondence of MS Word sections/chapters and OwS definition scopes.


Style Sheet   Text   Translates to Comment
OwS
#heading 2 codesystem .Name
The OwS Macro interpreter is advised to generate codesystem definitions from level-2 headings. The text of the respective headlines shall be taken as the value of the codesystem's Name property (which is as well the name of the codesystem).
OwS
#heading 3-4 concept .Name
The OwS Macro interpreter is advised to generate concept definitions from level-3 and level-4 headings. The text of the respective headlines shall be taken as the value of the concept's Name property (which is as well the name of the concept).
OwS
Überschrift 2
Animals
define codesystem (Animals) { We are entering a level-2 chapter within the document. Everything within this chapter is part of the definition scope of the corresponding codesystem definition.
Überschrift 3
Mammals
  define concept (Mammals) { We are entering a level-3 section within the document. Everything within this section is part of the definition scope of the concept named "Mammals".
Überschrift 4
Lion
    define concept (Lion) { We are entering a level-4 section within the document. Everything within this section is part of the definition scope of the concept "Lion". As the level-4 section is within the level-3 section the concept "Lion" is defined within the definition scope oft he concept "Mammals" which makes it a sub-concept of "Mammals".
Überschrift 4
Elephant
    }
    define concept (Elephant) {
The definiton scope of "Lion" is closed due to the beginning of a new level-4 section. The concept "Elephant" is defined within the definition scope of the concept "Mammals" which makes it another sub-concept of this concept.
Überschrift 3
Birds
  } }
  define concept (Birds) {
While beginning a new level-3 section, the definition scopes associated to the open level-4 section ("Elephant") and level-3 section ("Mammals") are closed.
Überschrift 4
Penguin
    define concept (Penguin) {
Standard
} } } The text ends. All open definition scopes ("Penguin", "Birds" and "Animals") are closed.

Deactivating Headline Parsing

When placing OwS directives and statements into MS Word documents there may be situations where sections of a specific level shall be parsed in on chapter but be left as-is within other chapters. For this one can disable the OwS processing of heading levels by using the #heading directive with just the heading levels to be disabled as an argument. E.g. the directive

#heading 2-3

disables processing of headlines of levels 2 and 3 for all text to come.

Examples

Within the context of the tutorial examples and hints for using the #heading directive are given in these lessons: