Constraint Converter

(since v2.4.0)

Introduction

The ConstraintConverter analyzes the constraints of application schema elements and adds the resulting information to the model (in one form or another) for subsequent processing steps.

Evaluating geometry restrictions from OCL constraints

NOTE: This specific transformation has been developed in OGC Testbed 13, to support the conversion of an application schema to a schema compliant to the GML Simple Feature Level 0 Profile (see the Geography Markup Language (GML) simple features profile (with Corrigendum) (2.0), OGC document number 10-100r3). For further details, see the OGC NAS Profiling Engineering Report (OGC document number 17-020 – to be published).

Some application schemas allow different types of geometries to be assigned to feature types. For example, depending on the use case, a building could be represented by a point or surface. The application schema may actually allow the use of many different geometry types, like curves, solids, and multi-geometries. This is typically convenient from a modelling perspective, since a common type hierarchy for spatial representation can be designed and used throughout the application schema.

However, a modeller may want to restrict the geometry options for specific feature types, either in general, or for particular use cases. One way to achieve this is the use of OCL constraints. For example, an OCL constraint on a feature type could be:

inv: place->forAll(p|(p.oclIsKindOf(PointPositionInfo) or p.oclIsKindOf(SurfacePositionInfo)))

The knowledge on which geometry types are allowed for a feature type is encoded in OCL constraints. This is a suitable approach: when deriving an XML Schema from the application schema, a Schematron schema can be derived from the OCL constraints, and used to check that the constraints are fulfilled by XML instance data.

ShapeChange supports a number of model transformations, for example the Flattener. Typically, a transformation does not update OCL constraints to reflect the transformed model. The variety of OCL expressions is immense. Any update of OCL constraints can therefore not be guaranteed to produce a valid result that still captures the intent of the modeller who designed the constraint.

However, transformations and targets may need information that is encoded in OCL constraints. The geometry types that are allowed to be used by a feature type are of interest to the Flattener rule-trf-prop-flatten-homogeneousgeometries. The Flattener expects this information to be available in the tagged value “geometry”, using specific abbreviations to identify a geometry type. The ConstraintConverter supports rules to populate this tagged value from the information found in OCL constraints. The rules work as follows:

  • Via the configuration parameter geometryRepresentationTypes, a list of all application schema types that represent certain geometry types is provided, together with the abbreviation to use in the “geometry” tagged value. Example: “SurfacePositionInfo=S;PointPositionInfo=P;CurvePositionInfo=C”.
    • NOTE: The parameter contains a list of key-value pairs. The list uses the semicolon as separator. The key is a string with the name of a type that represents a specific geometry type. The value is the abbreviation to use when populating the “geometry” tagged value.
  • For each type of the application schema, ShapeChange analyzes its constraints. A constraint that restricts the geometry representation is identified using a regular expression (given via configuration parameter geometryRepresentationConstraintRegex) that matches on the constraint name:

 

NOTE: Ideally, the ConstraintConverter would extract information on allowed geometry types by actually evaluating OCL constraints defined on (feature) types. However, as discussed before, doing so can be very complex. The ConstraintConverter rules therefore implement a simple approach that relies on a number of assumptions. An implementation that supports actual evaluation of OCL constraints to determine allowed geometry types is future work.

Configuration

Class

The class of this ShapeChange Transformer is de.interactive_instruments.ShapeChange.Transformation.Constraints.ConstraintConverter

Rules

rule-trf-cls-constraints-geometryRestrictionToGeometryTV-exclusion

(since v2.4.0)

The abbreviations from those types from parameter geometryRepresentationTypes that DO occur in constraints selected via parameter geometryRepresentationConstraintRegex are set in the “geometry” tagged value.

rule-trf-cls-constraints-geometryRestrictionToGeometryTV-inclusion

(since v2.4.0)

The abbreviations from those types from parameter geometryRepresentationTypes that DO NOT occur in the constraints selected via parameter geometryRepresentationConstraintRegex are set in the “geometry” tagged value.

 rule-trf-cls-constraints-geometryRestrictionToGeometryTV-typesWithoutRestriction-byValueTypeMatch

(since v2.4.0)

Tagged value “geometry” will be set – with all the geometry types from parameter geometryRepresentationTypes as value – for all types:

Parameters

geometryRepresentationConstraintRegex

Alias: none

Required / Optional: optional

Type: String with regular expression (using the syntax supported by Java)

Default Value: none

Explanation: Regular expression to identify relevant constraints by matching on the constraint name.

Applies to Rule(s):

geometryRepresentationTypes

Alias: none

Required / Optional: optional

Type: String with list of key-value pairs. The list uses the semicolon as separator between key-value pairs. The key is a string with the name of a type that represents a specific geometry type. The value is the abbreviation to use when populating the “geometry” tagged value

Default Value: none

Explanation: Provides a list of all application schema types that represent certain geometry types, together with the abbreviation to use in the “geometry” tagged value. Example: “SurfacePosi-tionInfo=S;PointPositionInfo=P;CurvePositionInfo=C”.

Applies to Rule(s):

geometryRepresentationValueTypeRegex

Alias: none

Required / Optional: optional

Type: String with regular expression (using the syntax supported by Java)

Default Value: none

Explanation: Regular expression to match on the name of property value types.

Applies to Rule(s):

Map Entries

Currently, no specific map entries are defined for the ConstraintConverter.

Advanced Process Configuration

The ConstraintConverter does not make use of the advanced process configuration facility.

Sample Configuration

<Transformer
  class="de.interactive_instruments.ShapeChange.Transformation.Constraints.ConstraintConverter"
  id="TRF_GEOMETRY_RESTRICTION_TO_GEOMETRY_TAGGEDVALUE" input="TRF_X" mode="enabled">
  <parameters>
   <ProcessParameter name="geometryRepresentationTypes"
    value="PointPositionInfo = P; CurvePositionInfo = C; SurfacePositionInfo = S"/>
   <ProcessParameter name="geometryRepresentationConstraintRegex"
    value=".*Place Representations Disallowed.*"/>
   <ProcessParameter name="geometryRepresentationValueTypeRegex" value="PlaceInfo"/>
  </parameters>
  <rules>
   <ProcessRuleSet name="trf">
    <rule name="rule-trf-cls-constraints-geometryRestrictionToGeometryTV-exclusion"/>
    <rule
     name="rule-trf-cls-constraints-geometryRestrictionToGeometryTV-typesWithoutRestriction-byValueTypeMatch"
    />
   </ProcessRuleSet>
  </rules>
 </Transformer>
Top