The PIM Constraint, Improving Geospatial Database Integrity
The PIM now contains sets of features (the pimFeature) grouped into sets (the pimConfiguration) with properties and referencing sets of attributes (the pimAttribute). For may GIS solutions, this is all that is required for collecting, validating, and displaying geospatial data.
But the PIM also contains the ability to constrain attribute values in a variety of ways, in much the same way that many of the RDBMS data stores contain a similar ability. Probably the simplest of these ways is the ‘Nulls Allowed’ property. In nearly all cases, attributes will be coded as ‘Nulls Allowed’, but specific user preferences might dictate otherwise, provided the user fully understands the implications of this coding.
The PIM also supports three other common types of attribute constraints. These are 1) Common List, where the values within an attribute must be in a specified set of values, 2) Range, where values associated with a numeric attributes must lies between a minimum or maximum value, or 3) Foreign Key, where the value in the attribute must reference a Primary Key in another RDBMS table.
|ID – The Constraint GUID|
|Name – What it is called|
|Definition – A definition of the Constraint|
|Owner – the userID of the Constraint|
|IsList – a boolean flag indicating whether the constraint is a list of range|
|ValueCount – the number of values associated with the Constraint|
|Attribute – the PIMAttribute to which the Constraint applies (may be null)|
|Feature – the pimFeature to which PIMAttribute above applies|
|Configuration – the pimConfiguration to which the PIMFeature above applies|
|Version – the pimVersion of the configuration|
A pimConstraint is used for both Range and List Constraints. A Foreign Key constraint is applied through the use of a pimRelatedFeature. Once again, the pimConstraint has a Name, Definition, Version, and Owner. Other common properties of the pimConstraint are shown in the table (right).
There are several conventions for the pimConstraint that are different from other objects. First a pimConstraint within the PIM is not directly tied to a pimConfiguration. It is, however, tied to a pimVersion and a User. This means that any given user may use a pimConstraint over and over for any or all pimConfigurations belonging to the user.
Second, each pimConstraint has a method that provides a PIMObjectSet of pimEnumerations. If the pimConstraint is a list type constraint (determined by an isList property set to true), each pimEnumeration is a value object in the list. If the pimConstraint is a range type constraint (the isList property is set to false), the pimConstraint has two additional properties. These are .MaxValue and .MinValue. A range constraint may have either or both of these Values.
The additional ‘Nulls Allowed’ constraint may be applied to an attribute regardless of the application of any pimConstraint to the attribute. The Foreign Key (pimRelatedFeature) constraint can be applied in a number of ways, and impacts both the pimFeature and the pimAttribute.
The use and application of pimRelatedFeatures is somewhat advanced for now, but we will come back to it as we explore other capabilities of the PIM.
The next post will begin to demonstrate how we put all of these concepts together into a working, managed data model. We’ll introduce a simple geospatial model with a couple of features, some attribution, and several constraints to demonstrate how the PIM stores the information and how the API will retrieve and use it.
This post was written by: