1 constraints in geo-information models and their implementations in systems peter van oosterom gis...

67
1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

Post on 21-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

1

Constraints in geo-information models and their implementations in systems

Peter van Oosterom

GIS technology, OTB

Page 2: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

2

Contents

1. Introduction2. Constraints in a landscape design VR system3. Constraints in a cadastral data set (topology)4. Constraints in a topographic base data set5. Constraints in web feature service transactions 6. Classification of constraints7. Support for constraints8. Conclusions and further research

Page 3: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

3

IntroductionGeo-information models

• OMG’s Model Driven Architecture (MDA): the model forms the foundation for further system development

• The data aspect of the model is often described in a UML class diagram (Unified Modeling Language), which defines for a class:• Attributes (names and types)• Methods• Associations (generalization, aggregation)

• However, often constraints are ignored

Page 4: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

4

Page 5: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

5

IntroductionConstraints

• Constraints are conditions, which always have to be fulfilled by the user and/or by the data processing operators of the system

• Constraints can be related to properties of the object itself and/or to relationships between the objects

Example: Tree must never stand in the water

Page 6: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

6

Introduction

• More attention for constraints needed as they add meaning/semantics to the model

• Constraints enable further consistency checking

• Constraints should be explicitly modeled, specified once and used throughout system:1. Create/edit objects (in GIS/CAD editor)2. Storage/manage objects (in geo-DBMS)3. Exchange objects (in communication, XML)

Page 7: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

7

Contents

1. Introduction2. Constraints in a landscape design VR system3. Constraints in a cadastral data set (topology)4. Constraints in a topographic base data set5. Constraints in web feature service transactions 6. Classification of constraints7. Support for constraints8. Conclusions and further research

Page 8: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

8

The SALIX-2 system

• Landscape architectural design

• Interactive planting trees, bushes

• Growing simulation

Originally developed by Wageningen UniversityAdding constraints: MSc-thesis project of Jildou Louwsma

Constraints to improve the interactivity!

Page 9: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

9

The SALIX-2 system: User Interface

Page 10: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

10

UML class diagram for SALIX-2

• Three classes objects: trees, bushes and ground surface

• Trees and bushes:CorAve, CorMAs, FraxExc, QueRob, RosCAn

• Ground surface: water, paving, grass and bridge.

Page 11: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

11

Page 12: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

12

Page 13: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

13

Constraints in SALIX-2 (1)

• Direction: A bush always has to placed south of a tree

• Topology: Bushes always have to be disjoint or meet water; A bush always has to meet or be disjoint paved areas (also thematic constraint)

• Metric: Trees always have to be positioned > 1 meter from paving

• Temporal: An oak always grows for 70 years • Quantity: There must always be at least 10

trees on the specified ground surface

Page 14: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

14

Constraints in SALIX-2 (2)

• Thematic: A bush always has to meet or be disjoint paved areas (also topological constraint)

• Complex: The distance between trees inside water always is > 8 m AND the distance between the tree and the edge of the water always has to be < 0,5 meter AND the species must be a salix; Trees of type 1 always have to be placed west of trees of type 2 AND the distance between trees of type 1 and trees of type 2 must always be 7 meters (pattern)

Page 15: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

15

All SALIX-2 constraints specified as assertions (SQL92 standard)

CREATE ASSERTION <assertion_name> CHECK <constraint_body>

Bushes never lie inside water: create assertion constraint_1 check (not exists ( select * from prcv_treesrd_point t, prcv_gvkrd_poly g where t.treetype in (‘CorAve’, ‘CorMas’, ‘RosCan’) AND g.descript = ‘water’ AND sdo_relate (g.geom., t.geom., ‘mask=inside, querytype=window’) =’TRUE’))

However, not available in any mainstream DBMS

Page 16: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

16

SALIX-2 constraints hand-coded in Oracle Triggers/ProceduresCREATE OR REPLACE TRIGGER ast_salix

AFTER INSERT ON prcv_treesrd_point

BEGIN

-- constraint 1: a bush must never be placed inside water the existing

-- table with all objects has no bushes inside the water, so only

-- after each update or insert a check has to take place if

-- the new location of a bush is inside water. This can be

-- an after statement trigger.

IF pck_salix.treetype_io IN ('CorMas', 'RosCan', 'CorAve') THEN

-- the object is a bush, so all constraints concerning

-- bushes must be run.

DBMS_OUTPUT.PUT_LINE('the involved object is a bush');

pck_salix.pr_topology_c1;

ELSE raise_application_error(-20099,'the object is a tree,

no constraints have to be checked.');

END IF;

END;

Page 17: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

17

Triggers/Procedures in SALIX-2PROCEDURE pr_topology_c1IS description varchar2(15); xrd_io number; yrd_io number; bush_in_water EXCEPTION; BEGIN SELECT g.descript, t.geom.sdo_point.x, t.geom.sdo_point.y INTO description, xrd_io, yrd_io FROM prcv_gvkrd_poly g, prcv_treesrd_point t WHERE t.treeid = pck_salix.treeid_io AND sdo_relate(g.geom, t.geom, 'mask=anyinteract, querytype=window') ='TRUE' GROUP BY g.descript, t.geom.sdo_point.x, t.geom.sdo_point.y; IF description = 'water' THEN raise bush_in_water; ELSE DBMS_OUTPUT.PUT_LINE('1: the bush is not placed in water'); END IF;EXCEPTION WHEN bush_in_water THEN raise_application_error (-20001, '1: The bush (x='||to_char(xrd_io)||', y='||to_char(yrd_io)||') is placed inside water, but a bush may never be placed in water. Place the bush on another location.')END pr_topology_cl;

Page 18: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

18

Never in Water (example)

Page 19: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

19

Some lessons, VR landscape design

• Constraints occurs at different places: VR user interface and data storage

• When designing: immediate feedback to user is important

• DBMS support of assertions is non existent!

• Simulation adds an other ‘dimension’ to constraints: when creating an initial plantation layout everything may be correct, but after 5 years of simulated growth there may be conflicts; trees get too close

Page 20: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

20

Contents

1. Introduction2. Constraints in a landscape design VR system3. Constraints in a cadastral data set (topology)4. Constraints in a topographic base data set5. Constraints in web feature service transactions 6. Classification of constraints7. Support for constraints8. Conclusions and further research

Page 21: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

21

Netherlands Cadastral map (1:1000)

• Based on winged edge topology stored in DBMS• Redundancy in references; e.g. both object_id left/right

and parcel_number left/right• Considered as a topological very clean data set• Hard coded topology checks build in editor and check-

in software; at DBMS server sided, but not in DBMS

• Data set with history 1997-2004:• Boundaries/polylines: total 67.000.000 (22.000.000)• Parcels/faces: total 28.000.000 (7.000.000 actual)

Page 22: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

22

r_obj_idr_obj_id

l_obj_idl_obj_id

fr_line_idfr_line_id

lr_line_idlr_line_id

ll_line_idll_line_id

fl_line_idfl_line_id

Topology references

Page 23: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

23

Spatial types, topology references(boundary: polyline, or circular arc)

Page 24: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

24

Some, of the about 50, constraints (‘create assertion’ part skipped)• find closed ‘arcs’ (circles not allowed, not l/r

side)SELECT object_id, numpoints(shape), anypoint(shape, 1), anypoint(shape, 2), anypoint(shape, 3)FROM xfio_boundary WHERE numpoints(shape)=3 and interp_cd=3 and tmax = 0 and

ogroup = 6 and (anypoint(shape, 1) = anypoint(shape, 3));

• find straight ‘arcs’• parcel reference point not in bbox

SELECT object_id from lki_parcel WHERE inside(location, geo_bbox) != 1;

Page 25: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

25

Enlarged (cell=5mm)

Closed ‘circular arc’ & geometric 1 mm gap

Page 26: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

26

Enlarged (cell=5m)

Straight line coded as circular arc

Page 27: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

27

Topology reference exist

• Boundary: left or right parcel obj_id does not existSELECT l_obj_id FROM lki_boundaryWHERE l_obj_id not in (select object_id from lki_parcel);

• Boundary-boundary reference does not existSELECT object_id, fl_line_id FROM lki_boundaryWHERE abs(fl_line_id) not in (select object_id from lki_boundary)

• Parcel: outer boundary reference does not existSELECT object_id, line_id1 FROM lki_parcelWHERE abs(line_id1) not in (select object_id from lki_boundary);

• Parcel: island boundary reference does not exist or wrong number of island references, l_num-1

Page 28: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

28

Island reference is missing

Page 29: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

29

Topology reference correct• Two consecutive boundaries must have same

parcels at the side; 8 combinationsSELECT s.object_id, s.fl_line_idFROM xfio_boundary s, xfio_boundary rWHERE s.fl_line_id > 0 and s.fl_line_id=r.object_id and s.tmax=0 and s.ogroup=6 and r.tmax=0 and r.ogroup=6 and s.r_obj_id <> r.l_obj_id;

• End point of one boundary is start of next; 8 combSELECT s.object_id, s.fl_line_idFROM xfio_boundary s, xfio_boundary rWHERE s.fl_line_id > 0 and s.fl_line_id=r.object_id and s.tmax=0 and s.ogroup=6 and r.tmax=0 and r.ogroup=6 and (anypoint(s.shape, 1) <> anypoint(r.shape, 1));

• Check if island boundary has parcel at the right side, check if first coordinate of island is within bbox parcel

Page 30: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

30

Parcel refers to wrong island boundary

Page 31: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

31

More consistency checks…

• Boundary Parcel references not consistentSELECT s.object_id, s.line_id1FROM xfio_parcel s, xfio_boundary rWHERE s.line_id1 > 0 and s.line_id1=r.object_id and s.tmax=0 and s.ogroup=46 and r.tmax=0 and r.ogroup=6 and (s.object_id <> r.r_obj_id);

• Redundant double references, via object_id and parcel_number, not consistent

• Geometric/survey and admin/right/owners side of parcel not consistentSELECT count(*),municip FROM mo_objectWHERE pp_i_ltr='G' and x_akr_objectnummer not in (select x_akr_objectnummer from lki_parcel)GROUP BY municip;

Page 32: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

32

Some lessons, cadastral data

• Never trust on front-end and/or middle ware alone for consistency checking check within DBMS

• Even if the errors may not be noticed in the production environment, they may be harmful in the environments of others; e.g. straight ‘circular arcs’

• Not yet all aspects checked; e.g. 1. time intervals of two consecutive versions of an

object should touch2. the complete domain is covered with parcels3. at one moment in time no (straight line or

circular arc) boundary may cross, only touch at end points is allowed

Page 33: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

33

Contents

1. Introduction2. Constraints in a landscape design VR system3. Constraints in a cadastral data set (topology)4. Constraints in a topographic base data set5. Constraints in web feature service transactions 6. Classification of constraints7. Support for constraints8. Conclusions and further research

Page 34: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

34

Designed with constraints included in one single source model• New topographic product TOP10NL (from 1 jan 2006)• New production system: from files to DBMS • New exchange format: GML3-based and NEN3610-v2• Initially constraints designed for validating conversion• However, same constraints will be used during future

production editing

• Constraints specified in one source in own XML-format (by Vertis and Topographic Service)

Page 35: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

35

Types of constraints (as defined by Vertis and Topographic Service)• Single entity, single attribute (thematic)

0 < road.num_lanes <= 10• Single entity, multiple attributes (thematic)

road.A-number <> ‘’ then road.type=‘highway’• Geometry (besides some general rules minimum

length of line and minimum size of area)road.width_class ‘<2m’ then geometry is line else area

• Topology (several subtypes: covering_without_gaps, no_overlap, coincide, …)road, water and terrain may not overlap at same height

• Relationshipevery feature must have at least 1 specified source

Page 36: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

36

XML encoding of domains, ex. 1range type (width of water)

<Domein>  <Naam>dWaterBreedte</Naam>  <Registreren>J</Registreren>  <Beschrijving>Breedte voor Waterdeel</Beschrijving>  <Type>Range</Type>  <DataType>int</DataType>  <CodedValueData/>  <RangeData>  

<Minimum>1</Minimum>  <Maximum>500</Maximum>  <Default>6</Default>  

</RangeData>  <SplitRegel>Duplicate</SplitRegel>  <MergeRegel>DefaultValue</MergeRegel>  

</Domein>

Page 37: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

37

XML encoding of domains, ex. 2enumeration type (type of railroad)<Domein>  

<Naam>dSpoorTypering</Naam>  <Registreren>J</Registreren>  <Beschrijving>Typeringen voor Spoorbaandeel</Beschrijving>  <Type>CodedValue</Type>  <DataType>int</DataType>  <CodedValueData>  

<Code>44</Code>  <Value>verbinding</Value>  <Default>J</Default>  

</CodedValueData>  <CodedValueData>  

<Code>45</Code>  <Value>kruising</Value>  <Default>N</Default>  

</CodedValueData>  <RangeData>  

<Minimum/>  <Maximum/>  <Default/>  

</RangeData>  <SplitRegel>Duplicate</SplitRegel>  <MergeRegel>DefaultValue</MergeRegel>  

</Domein>

Page 38: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

38

Single entity, multiple attributesconstraint ‘att007a’

<AttribuutRegel>  <Nummer>att007a</Nummer>  <VervolgNummer/>  <Categorie/>  <Beschrijving>Als Naam_Aweg is ingevuld,

dan WegType moet 'autosnelweg' bevatten</Beschrijving>  <FoutMelding>WegType bevat niet autosnelweg</FoutMelding>  <TriggerNiveau>1</TriggerNiveau>  <VervolgOperator/>  <FeatureKlasse>EDT_WEG_VLAK</FeatureKlasse>  <AlsAttribuut>NAAM_AWEG</AlsAttribuut>  <AlsOperator>!=</AlsOperator>  <AlsWaarde>""</AlsWaarde>  <DanAttribuut>WEGTYPE</DanAttribuut>  <DanOperator>MVCONTAINS</DanOperator>  <DanWaarde>|autosnelweg|</DanWaarde>  

</AttribuutRegel>

Page 39: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

39

Topology constraint ‘top04’

<AttribuutRegel>  <Nummer>top04</Nummer>  <VervolgNummer/>  <Categorie/>  <Beschrijving>Indien Wegvlak overlapt met Wegvlak

dan moet HOOGTENIVEAU verschillend zijn</Beschrijving>  <FoutMelding>Wegvlak overlapt Wegvlak</FoutMelding>  <TriggerNiveau>1</TriggerNiveau>  <VervolgOperator/>  <FeatureKlasse>EDT_WEG_VLAK</FeatureKlasse>  <AlsAttribuut>OBJECTID</AlsAttribuut>  <AlsOperator>AREAOVERLAPAREA</AlsOperator>  <AlsWaarde>EDT_WEG_VLAK</AlsWaarde>  <DanAttribuut>HOOGTENIVEAU</DanAttribuut>  <DanOperator>!=</DanOperator> <DanWaarde>FEATURE2.HOOGTENIVEAU</DanWaarde>  

</AttribuutRegel>

Page 40: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

40

Relationship (count)constraint ‘brn01’

<AttribuutRegel>  <Nummer>brn01</Nummer>  <VervolgNummer/>  <Categorie/>  <Beschrijving>Iedere feature moet een Bron hebben</Beschrijving>  <FoutMelding>Geen Bron</FoutMelding>  <TriggerNiveau>1</TriggerNiveau>  <VervolgOperator/>  <FeatureKlasse>EDT_WEG_VLAK</FeatureKlasse>  <AlsAttribuut>OBJECTID</AlsAttribuut>  <AlsOperator>&gt;=</AlsOperator>  <AlsWaarde>0</AlsWaarde>  <DanAttribuut>OBJECTID</DanAttribuut>  <DanOperator>BRONCOUNT&gt;</DanOperator>  <DanWaarde>0</DanWaarde>  

</AttribuutRegel>

Page 41: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

41

1. New feature overlapswith existing features2. No source for feature

Page 42: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

42

Some lessons, topographic base data

• Own (XML) encoding of constraints, maybe a standard would have been better; e.g. OCL

• Same encoding of constraints used in different subsystems:1. at data storage side/DBMS check-in and 2. at data edit side

• Constraints not yet included in exchange format: some could possibly included in standard GML/XML; e.g. domains, but more research needed for others

Page 43: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

43

Contents

1. Introduction2. Constraints in a landscape design VR system3. Constraints in a cadastral data set (topology)4. Constraints in a topographic base data set5. Constraints in web feature service transactions 6. Classification of constraints7. Support for constraints8. Conclusions and further research

Page 44: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

44

Constraints in Web Feature Service transactions

Applied to case ‘notary draftsParcel boundary’

MSc-thesisprojectThijs Brentjens

Page 45: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

45

OGC Web Feature Services (WFS)

• Defines interface to retrieve and edit geodata• Based on common web technologies:• HyperText Transfer Protocol (HTTP)• eXtensible Markup Language (XML)• Geography Markup Language (GML)

• Basic WFS: Discovering and querying data• Transactional WFS: Insert, Update, Delete, Lock

Page 46: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

46

Case study: Notary drafts parcel boundary

• Cadastral transaction:• Transfer• Merge• Split

• Notary drafts:• Preliminary boundaries• Annotation

• Legal after surveying

Page 47: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

47

The WFS protocol

• Pose a request (get two types of features):

• XML/GML (geo-information, 2-way directions): <gml:MultiLineString srsName= "http://www.opengis.net/gml/srs/epsg.xml#28992"> <gml:lineStringMember> <gml:LineString> <gml:coordinates decimal="." cs="," ts=" "> 106417204,448719275 106367184,448675614 </gml:coordinates> </gml:LineString> </gml:lineStringMember> </gml:MultiLineString> </cad:SHAPE> <cad:OBJECT_ID>341411971</cad:OBJECT_ID> <cad:CLASSIF>31</cad:CLASSIF> <cad:STATUS_CD>0</cad:STATUS_CD>

http://130.161.150.109:8080/geoserver/wfs/wfs?request= DescribeFeatureType&typeName=DRAFT_BOUNDARY,DRAFT_PARCEL

Page 48: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

48

Page 49: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

49

Evaluation of Transactional WFS

• WFS enables sharing & editing in heterogeneous, interoperable environment possible

• Functions over the Web, limited to simple editing

• Beyond simple editing: application logic?• Integrity constraints only on single features, not

between features (XML/GML schema encoded)• Transferring (general) constraint knowledge to client not

possible• Also constraints on operations (valid actions)?• WFS-T does not support true transactions, as a

transaction may be partially successful

Page 50: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

50

Contents

1. Introduction2. Constraints in a landscape design VR system3. Constraints in a cadastral data set (topology)4. Constraints in a topographic base data set5. Constraints in web feature service transactions 6. Classification of constraints7. Support for constraints8. Conclusions and further research

Page 51: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

51

Classification of constraints,some ‘dimensions’:

1. Number of involved object classes/instances 2. Properties of objects & relationships between

objects 3. Spatial-temporal dimension4. Manner of expression: ‘never may’ or ‘always

must’ 5. Nature of constraint: ‘physical impossible’ or

‘design objective’

Page 52: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

52

1. Number of involved object classes/instances

• One object instance • One property´tree cannot become older than 50 years’

• Two or more properties´tree must be Yucca and must not be higher than 10 m’

• Multiple object instances • Same object class‘two trees may not be closer than 2 m’

• Different object classes‘tree must be south of river’

Page 53: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

53

2. Properties of objects and relationships between objects• Properties• Spatial, thematic, temporal

• Relationships• Topology: no trees and bushes inside water

polygons• Metric: no trees inside the water, except if < 1

meter from edge of water• Direction: trees should be always south of paving

polygons, so people can walk in the sunshine• Quantity: maximum number of 10 plantation

objects in a specified area in the centre of the park

Page 54: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

54

3. Spatial-temporal dimension

• Upto 2D objects (in 2D space)• Upto 3D objects (in 3D space) • Upto 4D Mixed space and time objects

Note that the two involved instances may or may not have the same dimension

Page 55: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

55

4. Expression and 5. Nature

• Expression have meaning for communication between users but only one of the cases is implemented (the ‘cheaper’ one), two types never may or always must‘a tree never may be in water, or street or house’ = ‘a tree always must be in garden, or park’

• The nature has conceptual meaning

• physical impossible ‘tree can not float in the air’ • design objective ‘bush should be south of tree’

Page 56: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

56

Contents

1. Introduction2. Constraints in a landscape design VR system3. Constraints in a cadastral data set (topology)4. Constraints in a topographic base data set5. Constraints in web feature service transactions 6. Classification of constraints7. Support for constraints8. Conclusions and further research

Page 57: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

57

Support for constraintsUML, a good start…

• OMG’s UML is a mainly graphic language, but includes the non-graphic language for specifying constraints; Object Constraint Language (OCL) has 4 types:

1. Invariant: condition that must always be true2. Pre-condition: must be true before operation3. Post-condition: must be true after operation4. Guard: must be true before state transition

• OCL is a formal language

Page 58: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

58

OCL

• Each OCL expression has ‘context’• Two examples of invariants:

1. Area of parcel is at least 5 m2context Perceel inv minimaalOppervlak: self.oppervlakte > 5

2. Parcel must have an owner (associationcontext Perceel inv heeftEigenaar: self.eigenaar -> notEmpty()

• Translate OCL into DDL for DMBS, XML schema documents (xsd), and interaction/edit rules

Page 59: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

59

Support for constraints in DBMS:elementary support

• Three types of constraints in SQL 92 standard1. Domain constraints; e.g. enum or range

types2. General constraints (assertions): any

situation3. Base table constraints: related to table

Page 60: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

60

Assertions (SQL 92 standard)

Example 1a: involving aggregation function one tablecreate assertion size_is_ok check  ((select max(height) from tree) < 10);

Example 1b: same functionality, but stated differently

create assertion size_is_ok2 check  (not exists (select * from tree where height >= 10))

Example 2: involving relationship between 2 tables create assertion tree_not_in_water check  (not exists (select * from tree, water     where inside(tree.loc, water.polygon)));

Assertions are very powerful: any thematic, temporal, topological and geometric condition can be specified (between any number of tables). However, not available in any mainstream DBMS!

Page 61: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

61

Base table constraints (1)

• In theory equivalent to assertions (example 2):create table tree (id integer, height integer, loc point,   constraint tree_not_in_water check     (not exists (select * from water        where inside(loc, water.polygon))));

• However, mainstream DBMSs do not support base table constraints with subselects

• What types of base table constraints are supported?

Page 62: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

62

Base table constraints (2)4 types are supported in Ingres

1. Unique constraintcreate table ape(name char(10) unique not null, ....);

2. Referential constraintcreate table mary(id integer,  ape_name char(10) references ape(name))

3. Primary key constraint create table ape2(name char(10) primary key, ....); create table mary2(id integer,  ape_name foreign key (name) references(ape2));

4. Check constraint, only one with semantic load create table nut(balance integer check (balance > 0),  spending integer);

create table nut2(balance integer, spending integer,  constraint not_too_much check (spending < balance));

Page 63: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

63

Work around for general constraint implementation in DBMSs: triggerscreate trigger not_too_much

 after insert or update of a_value on a_table

  DECLARE     total number;   BEGIN     select sum(a_value) into total from a_table;     if (total >= 100) then       raise_application_error (         num => -20000,         msg => 'Cannot add/update "a_value", sum too big');     end if;   END;

Not pleasant to encode (Oracle example)In practice some parts of code can be generated by CASE

tools; e.g. Oracle's CDM Ruleframe

Page 64: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

64

Support for constraints in DBMS:specific for topology structures

Finally, topology constraints can be better managed within the database (compare to referential integrity):

• Oracle 10g spatial includes some initial support for topological structures (checks topological consistency; e.g. is a loop closed)

• LaserScan Radius topology is a (Oracle) DBMS solution

• Also more ‘middleware’ type of solutions available with support for topology structures; e.g. ESRI geodatabase

Page 65: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

65

Contents

1. Introduction2. Constraints in a landscape design VR system3. Constraints in a cadastral data set (topology)4. Constraints in a topographic base data set5. Constraints in web feature service transactions 6. Classification of constraints7. Support for constraints8. Conclusions and further research

Page 66: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

66

Conclusions

What was shown:

• Several GIS applications & models need constraints

• Classification of constraints• Single source for formal definition of constraints

using OMG’s UML (OCL)• Implementation in DBMS (and in one case also

the edit environment)

Page 67: 1 Constraints in geo-information models and their implementations in systems Peter van Oosterom GIS technology, OTB

67

Further research

• Translation of OCL to XML schema; exchange• Translation of OCL to edit environment• Visual feedback for the user if a constraint is

violated• Visual feedback before a constraint is violated: red

and green edits areas (or red and green operators)• Relationship between consistent data and

operations• An approach to delete, change and add new

constraints and automatic rebuilds of the different subsystems: edits, storage and exchange parts

• Extending the constraints to space-time/simulation• Check for conflicting constraints