OwS Tokenizer Directive: package

Aus CTS2-LE
Zur Navigation springen Zur Suche springen

OwS Packages allow to define simple subroutines to be used by the OwS macro interpreter. Packages contain sequences of OwS statements which are executed whenever the packae is invoked. Execution always takes place within the definition scope of the OwS directive that triggered the execution of the package.

Syntax

PackageDirective := #package PackageName PackageCode* #endpackage  
PackageName := #SimpleName
PackageCode := OwSStatement must be formatted using style sheet "OwS"
| any MS Word Text ignored by the OwS interpreter


Defining a Package

A package is defined through the OwS directive #package. Each package shall be given a name that contains a hashmark as its first letter. The end of a package definition is signaled by the #endpackage directive.

In between #package and #endpackage any OwS statements and non-interpretable text may be placed that is executed by the OwS compiler whenever the package is called. Within a package definition no OwS macro directives (commands starting with '#') may be placed.

The example below defines a package named #SetURI that can be used to generate an object's URI from it's type and name. E.g. executing #SetURI for a OwS predicate object named test will set the value of the URI attribute of this object to "http://OwS.sample.de/predicate/test".

#package #SetURI
set me.URI = (http://OwS.sample.de/)
set me.URI =[Mode=concat] me.Type
set me.URI =[Mode=concat][Delimiter=(/)] me.Name
#endpackage

Executing a Package

The execution of a package can either be triggered through an #obligation or through a #table directive:

#obligation Überschrift 4 => #SetURI
#table 2 codesystem .Name .Version .Description #SetURI