Top Banner
Region connection calculus using constraint handling rules Ahmed Ashmawy Department of Computer Engineering German University in Cairo June 30, 2009 Abstract In this paper we propose a handler implementation for representing and reasoning about spatial region connection calculus in the form of constraints. Regions are used as our primitive spatial entities rather than dimensionless points. Our proposal interpret the 8 base relations of RCC-8 in terms of connectedness relation. The system could be used to detect inconsistencies in a model or infer relations from it. 1 Introduction Time and space are two very important concepts of commonsense knowl- edge [1]. Space however is much more complex than time due to it’s multi dimensionality [2]. While it is important to represent and reason about space in a quantitative manner, alot of benefits can be gained from being able to represent and reason about space in a qualitative manner. Repre- sentation and reasoning about space in a qualitative manner is alot closer to how humans think than a quantitative manner. Region connection calculus defines qualitative relations between spatial regions. What we will propose is a RCC handler that deals with these relations in the form of constraints. The proposed RCC handler is implemented using constraint handling rules (CHR). CHR is a high-level language designed for writing constraint solvers [3]. The language gives the user the ability to define how constraints are solved in a declarative manner. Rules of the language are either simplifica- tion, propagation or simpagation rules [3]. Simplification rules declared by 1
24
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: paper

Region connection calculus using constraint

handling rules

Ahmed AshmawyDepartment of Computer Engineering

German University in Cairo

June 30, 2009

Abstract

In this paper we propose a handler implementation for representingand reasoning about spatial region connection calculus in the form ofconstraints. Regions are used as our primitive spatial entities ratherthan dimensionless points. Our proposal interpret the 8 base relationsof RCC-8 in terms of connectedness relation. The system could beused to detect inconsistencies in a model or infer relations from it.

1 Introduction

Time and space are two very important concepts of commonsense knowl-edge [1]. Space however is much more complex than time due to it’s multidimensionality [2]. While it is important to represent and reason aboutspace in a quantitative manner, alot of benefits can be gained from beingable to represent and reason about space in a qualitative manner. Repre-sentation and reasoning about space in a qualitative manner is alot closer tohow humans think than a quantitative manner. Region connection calculusdefines qualitative relations between spatial regions. What we will proposeis a RCC handler that deals with these relations in the form of constraints.

The proposed RCC handler is implemented using constraint handling rules(CHR). CHR is a high-level language designed for writing constraint solvers[3]. The language gives the user the ability to define how constraints aresolved in a declarative manner. Rules of the language are either simplifica-tion, propagation or simpagation rules [3]. Simplification rules declared by

1

Page 2: paper

the↔ operator will replace the left hand side with the right hand side. Whilepropagation rules declared by → operator will add the constraints declaredon the right hand side when the head of the rule is matched. Simpigationrules declared by \ and ↔ operators will remove the constraint declaredafter the \ if and only if the right hand side rule holds.

2 RCC Handler

In our proposed regional connection calculus handler we try to simplify allrelation constraints into connection constraints only. Althought our imple-mentation was partly successful to simplify most of the relation constraintsinto connection constraints there has been some limitations. The 8 baserelations are defined as binary relations but we represented the relation con-straints as ternary predicates. This convention has been adopted to avoiddealing with prolog’s method of negating constraints. Thus each relation isrepresented as rel(X,Y,T) where rel is any of the defined relations, X andY are two regions and T is the truth value of such relation.

2.1 Axioms handling rules

In this section we will show how we converted RCC axioms into correspond-ing constraint handling rules.

2.1.1 Connection

The connection constraint state that there is a connection between two re-gions. The dyadic relation is reflexive and symmetric.

Axioms Rules(A1) ∀x [c(x, x)] (R1) c(X, X, T ) ↔ T = true.(A2) ∀x ∀y [c(x, y) → c(y, x)] (R2) c(X, Y, Z) \ c(Y,X, V ) ↔ Z = V.

Rule 1 define the reflexive property by stating that for the connectionconstraint c(X,X,T) it has to be the case that T is true. Otherwise the con-straint will introduce inconsistency and thus failing. Consider the followingexamples:

| ?- c(street,street,T).

T = true ?yes

2

Page 3: paper

| ?- c(street,street,false).

no

Rule 2 formulate the symmetric property, stating that for the connectionconstraints c(X,Y,Z) and c(Y,X,V) it has to be the case that Z = V. Thefact that rule 2 is a simpigation rule and not a simplification one as rule 1means that if we have in the constraint store both constraints then removeone of them if Z=V is true otherwise fail. Thus keeping the system consistentand non-redundant. Consider the following examples:

| ?- c(house,street,X), c(street,house,V).

X = V,c(house,street,V) ?

yes| ?- c(house,street,X), c(street,house,true).

X = true,c(house,street,true) ?

yes| ?- c(house,street,X), c(street,house,false).

X = false,c(house,street,false) ?

yes| ?- c(house,street,true), c(street,house,false).

no

The third and final rule for the connection constraint defines consis-tency by stating that if we have the connection constraints c(X,Y,Z) andc(X,Y,V).

(R3) c(X, Y, Z) \ c(X, Y, V ) ↔ Z = V

If the head of rule 3 matched remove one of them if in fact Z=V are equalotherwise fail. It might seem that rules 2 and 3 are sort of the same, but

3

Page 4: paper

the fact is rule 2 head will only match if X and Y are swaped in the twoconstraints however the head of rule 1 will match only if they are in thesame order. Consider the following examples:

| ?- c(street,house,X), c(street,house,Y).

Y = X,c(street,house,X) ?

yes| ?- c(street,house,X), c(street,house,true).

X = true,c(street,house,true) ?

yes| ?- c(street,house,false), c(street,house,true).

no

2.1.2 Disconnection

The disconnection constraint is the negation of the connection one and thusfor our system dealing with it is straight forward.

Axiom Rule(A3) dc(x, y) ↔ ¬ c(x, y) (R4) dc(X, Y, true) ↔ c(X, Y, false).

Rule 4 simplifies a disconnection constraint dc(X,Y,true) into it’s cor-responding negation connection constraint c(X,Y,false). Consider the fol-lowing example:

| ?- dc(ground,ceiling,true).

c(ground,ceiling,false) ?

yes

The following 3 rules deal with the other cases when the truth value ofthe disconnection constraint is false rather than true or if the truth value ofthe disconnection constraint is a variable.

4

Page 5: paper

(R5) c(X, Y, false) \ dc(X, Y, T ) ↔ T = true.

(R6) c(X, Y, true) \ dc(X, Y, T ) ↔ T = false.

(R7) dc(X, Y, false) ↔ c(X, Y, true).

The following three examples demonstrates the effect of the extra 3 rulesrespectively, notice that the system always remove the disconnection con-straint from the constraint store and replace it with it’s corresponding con-nection one. That is the case because we do not need both, we can defineone in terms of the other. Since we are trying to simplify everything to con-nection constraints. We always simplify a disconnection relation betweenregions into it’s corresponding connection relation.

| ?- c(ground,ceiling,false), dc(ground,ceiling,T).

T = true,c(ground,ceiling,false) ?

yes| ?- c(ground,ceiling,true), dc(ground,ceiling,T).

T = false,c(ground,ceiling,true) ?

yes| ?- dc(ground,ceiling,false).

c(ground,ceiling,true) ?

yes

2.1.3 Part

The following constraint represent parthood between two regions. We dis-cuss the part axiom and it’s corresponding rules. A discussion of the someproblems and limitations for dealing with this constraint follows.

Axiom Rule(A4) p(x, y) ↔ ∀z [c(z, x) → c(z, y)] (R8) p(X, Y, true), c(Z, X, true) →

c(Z, Y, true).

5

Page 6: paper

Axiom 4 that defines parthood states that X is part of Y if and onlyif for all regions that are connected to X it is also connected to Y. Wefaced a problem when implementing the rule corresponding for this axiombecause we could not find a simplification rule that enforce a constraint overall connection constraints. For this matter we needed a global constraint ,one in which we could enforce certain properties over n-variables. However,we did not keep track of our regions in a set or a list so we were not ableto represent parthood using a global constraint. Thus a propagation rulewas used instead of a simplification one. The propagation rule (R8) statesthat if the constraint store contains the part constraint p(X,Y,true) andthe connection constraint c(Z,X,true) then we propagate the connectionconstraint c(Z,Y,true). The following examples demonstrates this effect:

| ?- p(bathroom,house,true), c(tub,bathroom,true).

p(bathroom,house,true),c(tub,bathroom,true),c(tub,house,true) ?

yes

| ?- p(bathroom,apartment,true), p(apartment,building,true),c(tub,bathroom,true).

p(bathroom,apartment,true),p(apartment,building,true),c(tub,bathroom,true),c(tub,apartment,true),c(tub,building,true) ?

yes

The following 3 rules define consistency, idompetence and fail cases forthe part constraint:

(R9) p(X, Y, Z) \ p(X, Y, V ) ↔ Z = V.

(R10) p(X, Y, true), c(X, Z, true) → c(Z, Y, true).

(R11) c(Z, X, true), c(Z, Y, false) → p(X,Y, false).

6

Page 7: paper

The difference between Rule 8 and 10 is that rule 8 will be matched ifthe first argument of the part constraint is the same as the second argumentof the connection constraint. On the other hand, Rule 10 will be matchedif the first argument of part constraint is the same as the first argument ofthe connection constraint. Since the connection constraint is a symmetricrelation and we only keep one version of it in the constraint store we needthese two rules for the parthood constraint.

Rule 9 states that if our constraint store contains the constraint p(X,Y,Z)and it received another parthood constraint p(X,Y,V) where the first 2arguments of both constraints are the same then remove one of them if theirtruth values are the same otherwise fail. The following examples shows theresults of matching this rule:

| ?- p(bathroom,house,X), p(bathroom,house,Y).

Y = X,p(bathroom,house,X) ?

yes| ?- p(bathroom,house,X), p(bathroom,house,true).

X = true,p(bathroom,house,true) ?

yes| ?- p(bathroom,house,X), p(bathroom,house,false).

X = false,p(bathroom,house,false) ?

yes| ?- p(bathroom,house,true), p(bathroom,house,false).

no

Rule 11 states that if there is a region Z that is connected to X but notto Y then X cannot be part of Y. The following example demonstrates:

| ?- c(h1,guc,true), c(h1,london,false).

7

Page 8: paper

c(h1,guc,true),c(h1,london,false),p(guc,london,false) ?

yes

2.1.4 Proper part

The proper part constraint states that the region X is a proper part of regionY if and only if X is a part of Y and Y is not a part of X.

Axiom Rule(A5) pp(x, y) ↔ p(x, y) ∧ ¬ p(y, x) (R12) pp(X, Y, true) ↔

p(X, Y, true), p(Y, X, false).

Rule 12 is a straight forward simplification rule capturing the meaningof axiom 5. The following is an example that shows the effect of matchingthe head of this rule:

| ?- pp(bathroom,house,true).

p(bathroom,house,true),p(house,bathroom,false) ?

yes

The following are the rest of the proper part rules:

(R13) p(X, Y, true), p(Y, X, false) \ pp(X,Y, T ) ↔ T = true.

(R14) p(X, Y, false) \ pp(X, Y, T ) ↔ T = false.

(R15) p(Y,X, true) \ pp(X, Y, T ) ↔ T = false.

(R16) pp(X, Y, false) ↔ true | (p(X, Y, false) ; p(Y, X, true)).

Rule 13 states that if the constraint store contains the the constraintsp(X,Y,true) , p(Y,X,false) and pp(X,Y,T) then it should dispose theproper part constraint if its truth value is true otherwise the system shouldfail. The following is an example:

8

Page 9: paper

| ?- p(bathroom,house,true), p(house,bathroom,false),pp(bathroom,house,T).

T = true,p(bathroom,house,true),p(house,bathroom,false) ?

yes| ?- p(bathroom,house,true), p(house,bathroom,false),pp(bathroom,house,true).

p(bathroom,house,true),p(house,bathroom,false) ?

yes| ?- p(bathroom,house,true), p(house,bathroom,false),pp(bathroom,house,false).

no

Rules 14 and 15 matches are to match the negation of the p(X,Y,true) ∧p(Y,X,false)which is p(X,Y,false) ∨ p(Y,X,true).If either of the rulesare matched and the truth value of the proper part constraint is not falsethe system fails. The following are examples:

| ?- p(house,bathroom,false), pp(house,bathroom,T).

T = false,p(house,bathroom,false) ?

yes| ?- p(bathroom,house,true), pp(house,bathroom,T).

T = false,p(bathroom,house,true) ?

yes| ?- p(bathroom,house,true), pp(house,bathroom,false).

p(bathroom,house,true) ?

yes| ?- p(bathroom,house,true), pp(house,bathroom,true).

9

Page 10: paper

no

Rule 16 states that if X is not proper part of Y then either X is not partof Y or Y is part of X. The following is an example:

| ?- pp(house,bathroom,false).

p(house,bathroom,false) ? ;

p(bathroom,house,true) ? ;

no

2.1.5 Equality

The equality axiom states that X is equal to Y if and only if X is part of Yand Y is part of X.

Axiom Rule(A6) eq(x, y) ↔ p(x, y) ∧ p(y, x) (R17) eq(X, Y, true) ↔ p(X, Y, true),

p(Y,X, true).

Rule 17 is a straight forward simplification rule capturing the meaningof axiom 6. The following is an example that shows the effect of matchingthe head of this rule:

| ?- eq(house,street,true).

p(house,street,true),p(street,house,true) ?

yes

The following are the rest of the equality constraint rules:

(R18) p(X, Y, true), p(Y, X, true) \ eq(X, Y, T ) ↔ T = true.

(R19) p(X, Y, false) \ eq(X, Y, T ) ↔ T = false.

(R20) p(Y,X, false) \ eq(X, Y, T ) ↔ T = false.

(R21) eq(X, Y, false) ↔ true | (p(X, Y, false) ; p(Y, X, false)).

10

Page 11: paper

Rule 18 states that if the constraint store contains the the constraintsp(X,Y,true) , p(Y,X,true) and eq(X,Y,T) then it should dispose theequality constraint if its truth value is true otherwise the system should fail.The following is an example:

| ?- p(guc,johns_university,true), p(johns_university,guc,true), eq(guc,johns_university,T).

T = true,p(guc,johns_university,true),p(johns_university,guc,true) ?yes| ?- p(guc,johns_university,true), p(johns_university,guc,true), eq(guc,johns_university,true).

p(guc,johns_university,true),p(johns_university,guc,true) ?yes| ?- p(guc,johns_university,true), p(johns_university,guc,true), eq(guc,johns_university,false).

no

Rules 19 and 20 matches are to match the negation of the p(X,Y,true) ∧p(Y,X,true)which is p(X,Y,false) ∨ p(Y,X,false).If either of the rulesare matched and the truth value of the equality constraint is not false thesystem fails. The following are examples:

| ?- p(guc,johns_university,false) , eq(guc,johns_university,T).

T = false,p(guc,johns_university,false) ?yes| ?- p(johns_university,guc,false), eq(guc,johns_university,T).

T = false,p(johns_university,guc,false) ?yes| ?- p(johns_university,guc,false), eq(guc,johns_university,true).

no

11

Page 12: paper

Rule 21 states that if X is not equal to Y then either X is not part of Yor Y is not part of X. The following is an example:

| ?- eq(house,stree,false).

p(house,stree,false) ? ;

p(stree,house,false) ? ;

no

2.1.6 Overlapping

This constraint represent overlapping relation, region X overlaps region Y ifand only if there exist a region Z such that it is part of region X and regionY.

Axiom Rule(A7) o(x, y) ↔ ∃z [p(z, x) ∧ p(z, y)] (R22) p(Z, X, true), p(Z, Y, true)

\ o(X, Y, T ) ↔ T = true.

Axiom 7 states that for a region to overlap another there has to exista region Z which is part of both regions. The problem here is that we cannot simplify a overlap constraint to such condition as the variables in theconstraints will be arbitrary ones and will never match anything. Thus oursolution was to simplify an overlapping constraint to true if the conditionsexist. In other words, If the constraint store contains the two constraintsstating that a region Z is part of X and Y and it also contains the overlappingconstraint stating that region X overlaps region Y. Then the action is tosimplify the overlapping constraint as it is already satisfied if and only if thetruth value of the overlapping constraint is in fact true. The following is anexample:

| ?- p(street1,cairo,true), p(street1,giza,true), o(cairo,giza,T).

T = true,p(street1,cairo,true),p(street1,giza,true) ?

yes| ?- p(street1,cairo,true), p(street1,giza,true), o(cairo,giza,true).

12

Page 13: paper

p(street1,cairo,true),p(street1,giza,true) ?

yes| ?- p(street1,cairo,true), p(street1,giza,true), o(cairo,giza,false).

no

The following are the rest of the overlapping rules:

(R23) o(X, Y, Z) \ o(X,Y, V ) ↔ Z = V.

(R24) o(X, Y, Z) \ o(Y, X, V ) ↔ Z = V.

(R25) c(X, Y, false), o(X, Y, true) <=> fail

(R26) c(Y,X, false), o(X, Y, true) <=> fail.

Rule 23 and 24 handles idompetence and symmetry properties for theoverlapping constraint. Rule 23 will remove a duplicate overlapping con-straint if their truth values are the same otherwise the system will fail. Onthe other hand, rule 24 will only match if the first 2 arguments of both con-straints are exchanged and will also result in the removal of one of them ifand only if their truth values are the same otherwise it the system will fail.The following are examples:

| ?- o(cairo,giza,true), o(cairo,giza,T).

T = true,o(cairo,giza,true) ?

yes| ?- o(cairo,giza,true), o(cairo,giza,true).

o(cairo,giza,true) ?

yes| ?- o(cairo,giza,true), o(cairo,giza,false).

13

Page 14: paper

no| ?- o(cairo,giza,true), o(giza,cairo,T).

T = true,o(cairo,giza,true) ?

yes| ?- o(cairo,giza,true), o(giza,cairo,true).

o(cairo,giza,true) ?

yes| ?- o(cairo,giza,true), o(giza,cairo,fail).

no

If the limitations stated above for the overlapping constraint and theparthood constraint did not exist we could have simplified both parthoodand overlapping in terms of connection constraints. If this was the caseinconsistencies would have been detected at the connection level, otherwisewe have to handle inconsistency conditions in terms of the constraint itself.This is the reason we introduced rules 25 and 26, the following are examplesto illustrate the effect of both rules:

| ?- c(canada,egypt,false), o(canada,egypt,true).

no| ?- c(egypt,canada,false), o(canada,egypt,true).

no

2.1.7 Discrete

A region is discrete from another if and only both regions do not overlap.

Axiom Rule(A8) dr(x, y) ↔ ¬ o(x, y) (R27) dr(X, Y, true) ↔ o(X, Y, false)

The following is an example showing the simplification of discrete con-straints in terms of overlapping constraint:

14

Page 15: paper

| ?- dr(egypt,canada,true).

o(egypt,canada,false) ?

yes

The following are the rest of the discrete rules:

(R28) dr(X, Y, false) ↔ o(X, Y, true).

(R29) o(X, Y, false) \ dr(X, Y, T ) ↔ T = true.

(R30) o(X, Y, true) \ dr(X, Y, T ) ↔ T = false.

Rule 28 deals with the opposite case of rule 27, simplifying a false discreteconstraint into a true overlapping one. The following is an example:

| ?- dr(cairo,egypt,false).

o(cairo,egypt,true) ?

yes

Rule 29 however states that if the constraint store contains a false over-lapping constraint between two regions and a discrete constraint of thesetwo regions. Then the action that should be taken is to remove the discreteconstraint from the store if and only if its truth value is true otherwise fail.Rule 30 states the opposite condition of rule 29, the following are examplesto demonstrate the effect of both rules:

| ?- o(canada,egypt,false), dr(canada,egypt,T).

T = true,o(canada,egypt,false) ?

yes| ?- o(canada,egypt,false), dr(canada,egypt,true).

o(canada,egypt,false) ?

yes

15

Page 16: paper

| ?- o(canada,egypt,false), dr(canada,egypt,false).

no| ?- o(cairo,egypt,true), dr(cairo,egypt,T).

T = false,o(cairo,egypt,true) ?

2.1.8 Partially overlap

This constraint defines the partial overlap relation, A region X partiallyoverlaps region Y if and only if X overlaps Y , X is not part of Y and Y isnot part of X.

Axiom Rule(A9) po(x, y) ↔ o(x, y) ∧ ¬ p(x, y) (R31) po(X, Y, true) ↔∧¬ p(y, x) o(X, Y, true), p(X, Y, false), p(Y,X, false).

Rule 31 states that for every partial overlap constraint , simplify it intooverlap and parthood constraints. Consider the following example:

| ?- po(cairo,giza,true).

o(cairo,giza,true),p(cairo,giza,false),p(giza,cairo,false) ?

yes

The following are the rest of partial overlap rules:

(R32) o(X, Y, true), p(X, Y, false), p(Y, X, false) \ po(X, Y, T ) ↔ T = true.

(R33) o(X, Y, false) \ po(X,Y, T ) ↔ T = false

(R34) p(X, Y, true) \ po(X, Y, T ) ↔ T = false.

(R35) p(Y,X, true) \ po(X, Y, T ) ↔ T = false.

(R36) po(X, Y, false) ↔true | (o(X, Y, false) ; p(X,Y, true); p(Y,X, true)).

16

Page 17: paper

Rule 32 states that if the overlapping and parthood constraints that par-tial overlap constraints was to be simplified to were already in the constraintstore then just remove the new partial overlap that is just ariving from thestore if and only if it’s truth value is indeed true otherwise fail. Considerthe following examples:

| ?- o(cairo,giza,true), p(cairo,giza,false), p(giza,cairo,false), po(cairo,giza,T).

T = true,o(cairo,giza,true),p(cairo,giza,false),p(giza,cairo,false) ?

yes| ?- o(cairo,giza,true), p(cairo,giza,false), p(giza,cairo,false), po(cairo,giza,true).

o(cairo,giza,true),p(cairo,giza,false),p(giza,cairo,false) ?

yes| ?- o(cairo,giza,true), p(cairo,giza,false), p(giza,cairo,false), po(cairo,giza,false).

no

Rules 33, 34 and 35 handles the negation of partial overlapping condi-tions, that is the negation of o(X,Y, true) ∧ p(X, Y, false) ∧ p(Y,X, false)which is o(X, Y, false) ∨ p(X, Y, true) ∨ p(Y, X, true). Thus what rule 33state is that if the constraint store contains the false overlap constraint be-tween X and Y and the partial overlap constraint between the two regions,then remove the partial overlap constraint if and only if it’s truth is false oth-erwise fail. Rule 34 and 35 are the captures the same logic but for parthoodconstraints, Consider the following examples:

| ?- o(egypt,canada,false), po(egypt,canada,T).

T = false,

17

Page 18: paper

o(egypt,canada,false) ?

yes| ?- o(egypt,canada,false), po(egypt,canada,true).

no| ?- p(cairo,egypt,true), po(cairo,egypt,T).

T = false,p(cairo,egypt,true) ?

yes| ?- p(cairo,egypt,true), po(cairo,egypt,true).

no| ?- p(egypt,cairo,true), po(cairo,egypt,true).

no

Rule 36 states that if X doesnt not partially overlap Y then either X doesnot overlap Y or X is part of Y or Y is part of X. Consider the followingexample:

| ?- po(egypt,canada,false).

o(egypt,canada,false) ? ;

p(egypt,canada,true) ? ;

p(canada,egypt,true) ? ;

no

2.1.9 Externally connected

Region X is externally connected to Y if and only if X is connected to Yand X does not overlap Y.

Axiom Rule(A10) ec(x, y) ↔ c(x, y) ∧ ¬ o(x, y) (R37) ec(X, Y, true) ↔ c(X, Y, true)

, o(X, Y, false).

18

Page 19: paper

The following are the rest of externally connected rules:

(R38) c(X, Y, true), o(X, Y, false) \ ec(X, Y, T ) ↔ T = true.

(R39) c(X, Y, false) \ ec(X, Y, T ) ↔ T = false.

(R40) o(X, Y, true) \ ec(X,Y, T ) ↔ T = false.

(R41) ec(X, Y, false) ↔ true | (c(X, Y, false) ; o(X, Y, true)).

Rule 38 states if the necessary conditions for X to be externally connectedto Y hold and the constraint store also contains the externally connectionconstraint then it will be remove if and only if its truth value is true other-wise fail. However, rules 39 , 40 and 41 handles the false cases of externalconnection between two regions. Consider the following examples:

| ?- c(street1,street2,true), o(street1,street2,false), ec(street1,street2,T).

T = true,c(street1,street2,true),o(street1,street2,false) ?

yes| ?- c(street1,street2,true), o(street1,street2,false), ec(street1,street2,true).

c(street1,street2,true),o(street1,street2,false) ?

yes| ?- c(street1,street2,true), o(street1,street2,false), ec(street1,street2,false).

no| ?-| ?- c(street1,street2,false), ec(street1,street2,T).

T = false,c(street1,street2,false) ?

19

Page 20: paper

yes| ?- o(street1,street2,true), ec(street1,street2,T).

T = false,o(street1,street2,true) ?

yes| ?- ec(street1,street2,false).

c(street1,street2,false) ? ;

o(street1,street2,true) ? ;

no

2.1.10 Tangential Proper Part

Informally a region X is tangential proper part of another region Y if it iscontained withing Y and part of its exterior touches Y’s exterior. Formally,a region X is tangential proper part of region Y if and only if it is a properpart of it and there exist a region Z that is both externally connected to Xand Y.

Axiom Rule(A11) tpp(x, y) ↔ pp(x, y)∧ (R42) p(X,Y, true), p(Y,X, false),∃Z [ec(z, x) ∧ ec(z, y)] c(Z, X, true), o(Z, X, false), c(Z, Y, true),

o(Z, Y, false) \ tpp(X, Y, T ) ↔ T = true.

If you notice rule 42 does not simplify a tpp(X,Y,T) into anything butwhat it does is that it will simplify it to truth if it’s conditions hold. Thisis the case because if we simplified the constraint to proper parthood andexternal connection , nothing will match the external connection constraintsbecause they contain an arbitrary region Z. Not to mention, Since it’s con-dition constraints are proper parthood and external connection, these con-ditions if they hold will be in terms of their simplified form. Thus the headof the rule will be matched when the necessary simplified conditions for thisconstraint hold. Consider the following example:

| ?- pp(X,Y,true), ec(Z,X,true), ec(Z,Y,true), tpp(X,Y,T).

20

Page 21: paper

T = true,p(X,Y,true),p(Y,X,false),c(Z,X,true),c(Z,Y,true),o(Z,X,false),o(Z,Y,false) ?

yes| ?- pp(X,Y,true), ec(Z,X,true), ec(Z,Y,true), tpp(X,Y,false).

no

The following are the rest of the rules for this constraint:

(R43) tpp(X, Y, Z) \ tpp(X, Y, V ) ↔ Z = V.

(R44) tpp(X, Y, true), tppi(X, Y, true) ↔ fail.

(R45) tpp(X, Y, true), c(X, Y, true), o(X, Y, false) ↔ fail.

(R46) tpp(X, Y, true), o(X, Y, true), p(X, Y, false), p(Y,X, false) ↔ fail.

(R47) tpp(X, Y, true), p(X,Y, true), p(Y,X, true) ↔ fail.

(R48) tpp(X, Y, true), c(X, Y, false) ↔ fail.

(R49) tpp(X, Y, true), c(Y,X, false) ↔ fail.

(R50) tpp(X, Y, true), o(X, Y, false) ↔ fail.

(R51) tpp(X, Y, true), o(Y, X, false) ↔ fail.

(R52) tpp(X, Y, true), p(X, Y, false) ↔ fail.

Rule 43 handles idompetence and consistency for this constraint. Whilerules 44-52 handles all failure cases with other constraints, the reason forneeding these rules is as stated above that this constraint will not be sim-plified in terms of other constraints. Consider the following examples:

| ?- tpp(X,Y,true), tpp(X,Y,T).

21

Page 22: paper

T = true,tpp(X,Y,true) ?

yes| ?- tpp(X,Y,true), tpp(X,Y,false).

no| ?- tpp(X,Y,true), po(X,Y,true).

no| ?- tpp(X,Y,true), ec(X,Y,true).

no| ?- tpp(X,Y,true), dc(X,Y,true).

no

2.1.11 Non tangential proper part

A region X is a non tangential proper part of region Y if X is a proper partof Y and there exist a region Z such that it is externally connected to X andto Y.

Axiom Rule(A12) ntpp(x, y) ↔ pp(x, y) (R53) ntpp(X, Y, true) ↔ pp(X, Y, true),∧¬ ∃Z [ec(z, x) ∧ ec(z, y)] tpp(Y, X, false)

Rule 53 states simplifies non-tangential proper parthood in terms properparthood and tangential proper parthood.

| ?- ntpp(X,Y,true).

p(X,Y,true),p(Y,X,false),tpp(X,Y,false) ?

yes

(R55) ntpp(X, Y, false) ↔ true | (pp(X, Y, false) ; tpp(X, Y, true)).

22

Page 23: paper

Rule 55 defines the false constraint non-tangential proper part in termsof proper parthood and tangential proper parthood.

| ?- ntpp(X,Y,false).

p(X,Y,true),p(Y,X,false) ? ;

tpp(X,Y,false) ? ;

no

2.1.12 Inverses

The following rules define the inverse of the previously mentioned con-straints, the rules will just simplify the inverse constraints in terms of theircorresponding constraints.

(R56) ppi(X, Y, Z) ↔ pp(Y,X, Z).

(R57) tppi(X, Y, Z) ↔ tpp(Y,X, Z).

(R58) ntppi(X, Y, Z) ↔ ntpp(Y,X, Z).

(R59) pi(X, Y, Z) ↔ p(Y,X, Z).

3 Conclusion

In summary, our target was to implement the RCC handler that simplifiesevery constraint into connection constraints. However, we faced limitationswhen dealing with relations that had variables bound to universal quantifiersor existential ones. We worked around these limitations by not simplifyingthese constraints except if their conditions were already in the store andby handling failure cases for them. The system could be used to checkconsistency of spatial descriptions in terms of these relations and constraints.Let alone, infering relations from these descriptions.

4 References

[1] J. Renz, B. Nebel. Qualitative spatial reasoning using constraint calculi.

23

Page 24: paper

[2] A. Cohn, B. Bennett, J. Gooday, N. Gotts. Qualitative spatial representa-tion and reasoning with the region connection calculus.

[3] T.Fruhwirth. Constraint handling rules.

24