Section 4.8 The relationship between CSN and OSN


The best way to illustrate the relationship between CSN and OSN is through examples. Below are two type definitions, expressed in CSN, pertaining to towers, as defined in the National Topographic Database, 1:50 000 program. TowerFunctionType is an enumeration used as the domain for an attribute in Tower. Tower is defined as a subclass of Entity (in the NTDB50K schema), which itself is identified as a subclass of GeographicObject.


< Enumeration  
     subclass:     TowerFunctionType::NTDB50k  

     values:       clearance (1) communication (2) control (3) fire (4) lookout (5) 

     comments:     "A choice of tower functions."
>

< Entity::NTDB50k
     subclass:     Tower::NTDB50k 

     attributes:   [towerFunction]     TowerFunctionType::NTDB50k 
                   towerIdentifier     Integer16 
                   [heightOfTheTower]  Integer16

     defaults:     heightOfTheTower:-1

     restricted:   position.geometry:^Point
                   position.geometry*Coordinate:^Coordinate
                   position.geometry:notNil
                   position.spatialReferencing:notNil

     constraints:  "Height only applies if higher than 30 metres. A
                   height lower than 30 metres is represented by a value
                   of zero. An unspecified height is indicated by a
                   value of -1."

     comments:     "A high structure built to provide clearance above the
                   surrounding objects."
>


A particular instance of class Tower would be expressed in OSN as follows:


Tower 
 (
  position:  SpatialObject
    ( 
     geometry:   Point 
        (
               position:  CoordXYZ
           (
                x: 477377
                y: 5360468
                z: 150
               )
        )

//  Note that the spatialReferencing should be specified in this example, as it is restricted 
//  above to be notNil; however, in the interests of brevity, it is not provided here.

    )
  towerFunction: control 
  towerIdentifier: 40
 )


The type definitions given earlier can themselves be described in OSN as instances of the SAIF classes TupleDefinition and EnumerationDefinition (both of which are subclasses of TypeDefinition). The definitions of TowerType and Tower are expressed in OSN below.


EnumerationDefinition
 (
  class:  TypeIdentifier
     (
      typeName:  TowerFunctionType
      schema:  SchemaIdentifier
         (
          schemaName:  NTDB
          version:   v.2.0
         )
     )
  enumerates: List 
     {
      EnumerationValueDef
      (
       description:  clearance
       value:   1
      )
       EnumerationValueDef
      (
       description: communication
       value:   2
       )
      EnumerationValueDef
      (
       description: control
       value:   3
      )
      EnumerationValueDef
      (
       description: fire
       value:   4
      )
      EnumerationValueDef
      (
       description: lookout 
       value:   5
      )
     }
  comments: "A choice of tower functions"
 )

TupleDefinition
 (
  type:  TypeIdentifier
     (
      typeName:  Tower
      schema:  SchemaIdentifier
          (
           schemaName: NTDB
           version:  v.2.0
          )
     )
  superclass:  TypeIdentifer
     (
      typeName:  GeographicObject
     )
   attributes:  List
     {
      SimpleAttributeDef
      (
       attributeName: towerFunction
       attributeDomain: TypeIdentifer
         (
          typeName: TowerFunctionType
          schema: SchemaIdentifier
             (
              schemaName: NTDB
              version:  v.2.0
             )
         )
       optional: true
      )
      SimpleAttributeDef
      (
       attributeName: towerIdentifer
       attributeDomain: TypeIdentifer
         (
          typeName: Integer16
         )
       optional: false
      )
      SimpleAttributeDef
      (
       attributeName: heightOfTheTower
       attributeDomain: TypeIdentifer
         (
          typeName: Integer16
         )
       optional: true
      )
  }
  defaults:  List
  {
     RestrictedValue
      (
       attributeName: heightOfTheTower
       attributeValue: -1
     )
  }
  restricted: List  
  {
     RestrictedDomain
      (
       attributePathName: position.geometry
       attributeDomain: TypeIdentifer
         (
          typeName: Point
         )
      )
     RestrictedDomain
      (
       attributePathName: position.geometry*Coordinate
       attributeDomain: TypeIdentifer
         (
          typeName:  Coordinate
         )
      )
     RestrictedOptionality
      (
       attributePathName: position.geometry
       attributeOptionality: neverNil
      )
     RestrictedOptionality
      (
       attributePathName: position.spatialReferencing
       attributeOptionality: neverNil
      )
  }
  constraints:  "Height only applies if higher than 30 metres.   A height 
    lower than 30 metres is represented by a value of zero.
    An unspecified height is indicated by a value of -1. "

  comments:  "A high structure built to provide clearance above the 
    surrounding objects."
 )

As one can see, the OSN notation is much more verbose for class definitions than the equivalent CSN notation. The conversion between the two notations is mechanical, and could be done by appropriate software. For the purpose of encoding class definitions for archive or interchange, class definitions in CSN may be converted to TypeDefinition objects, if required by the encoding scheme. When decoded, these would be in OSN, and could be converted to CSN by software.


Links to the SAIF 3.1 Specification document and the complete SAIF class list