1. 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 bene
2. ts 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
de
3. nes 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 de
4. ne how constraints are
solved in a declarative manner. Rules of the language are either simpli
7. the$operator will replace the left hand side with the right hand side. While
propagation rules declared by ! operator will add the constraints declared
on the right hand side when the head of the rule is matched. Simpigation
rules declared by n and $ operators will remove the constraint declared
after the n if and only if the right hand side rule holds.
2 RCC Handler
In our proposed regional connection calculus handler we try to simplify all
relation constraints into connection constraints only. Althought our imple-
mentation was partly successful to simplify most of the relation constraints
into connection constraints there has been some limitations. The 8 base
relations are de
8. ned as binary relations but we represented the relation con-
straints as ternary predicates. This convention has been adopted to avoid
dealing with prolog's method of negating constraints. Thus each relation is
represented as rel(X,Y,T) where rel is any of the de
9. ned relations, X and
Y 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 re
exive and symmetric.
Axioms Rules
(A1) 8x [c(x; x)] (R1) c(X;X; T) $ T = true:
(A2) 8x 8y [c(x; y) ! c(y; x)] (R2) c(X; Y;Z) n c(Y;X; V ) $ Z = V:
Rule 1 de
10. ne the re
exive property by stating that for the connection
constraint 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 following
examples:
| ?- c(street,street,T).
T = true ?
yes
2
11. | ?- c(street,street,false).
no
Rule 2 formulate the symmetric property, stating that for the connection
constraints c(X,Y,Z) and c(Y,X,V) it has to be the case that Z = V. The
fact that rule 2 is a simpigation rule and not a simpli
12. cation one as rule 1
means that if we have in the constraint store both constraints then remove
one of them if Z=V is true otherwise fail. Thus keeping the system consistent
and 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
14. nes consis-
tency by stating that if we have the connection constraints c(X,Y,Z) and
c(X,Y,V).
(R3) c(X; Y;Z) n c(X; Y; V ) $ Z = V
If the head of rule 3 matched remove one of them if in fact Z=V are equal
otherwise fail. It might seem that rules 2 and 3 are sort of the same, but
3
15. the fact is rule 2 head will only match if X and Y are swaped in the two
constraints however the head of rule 1 will match only if they are in the
same 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 thus
for 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 simpli
16. es 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 of
the disconnection constraint is false rather than true or if the truth value of
the disconnection constraint is a variable.
4
17. (R5) c(X; Y; false) n dc(X; Y; T) $ T = true:
(R6) c(X; Y; true) n dc(X; Y; T) $ T = false:
(R7) dc(X; Y; false) $ c(X; Y; true):
The following three examples demonstrates the eect of the extra 3 rules
respectively, 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 de
18. ne
one in terms of the other. Since we are trying to simplify everything to con-
nection constraints. We always simplify a disconnection relation between
regions 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 some
problems and limitations for dealing with this constraint follows.
Axiom Rule
(A4) p(x; y) $ 8z [c(z; x) ! c(z; y)] (R8) p(X; Y; true); c(Z;X; true) !
c(Z; Y; true):
5
20. nes parthood states that X is part of Y if and only
if for all regions that are connected to X it is also connected to Y. We
faced a problem when implementing the rule corresponding for this axiom
because we could not
22. cation rule that enforce a constraint over
all 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 able
to represent parthood using a global constraint. Thus a propagation rule
was used instead of a simpli
23. cation one. The propagation rule (R8) states
that if the constraint store contains the part constraint p(X,Y,true) and
the connection constraint c(Z,X,true) then we propagate the connection
constraint c(Z,Y,true). The following examples demonstrates this eect:
| ?- 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 de
24. ne consistency, idompetence and fail cases for
the part constraint:
(R9) p(X; Y;Z) n 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
26. rst argument of the part constraint is the same as the second argument
of the connection constraint. On the other hand, Rule 10 will be matched
if the
28. rst argument of
the connection constraint. Since the connection constraint is a symmetric
relation and we only keep one version of it in the constraint store we need
these 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
29. rst 2
arguments of both constraints are the same then remove one of them if their
truth values are the same otherwise fail. The following examples shows the
results 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 not
to Y then X cannot be part of Y. The following example demonstrates:
| ?- c(h1,guc,true), c(h1,london,false).
7
30. 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 region
Y 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 simpli
31. cation rule capturing the meaning
of axiom 5. The following is an example that shows the eect of matching
the 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) n pp(X; Y; T) $ T = true:
(R14) p(X; Y; false) n pp(X; Y; T) $ T = false:
(R15) p(Y;X; true) n pp(X; Y; T) $ T = false:
(R16) pp(X; Y; false) $ true j (p(X; Y; false) ; p(Y;X; true)).
Rule 13 states that if the constraint store contains the the constraints
p(X,Y,true) , p(Y,X,false) and pp(X,Y,T) then it should dispose the
proper part constraint if its truth value is true otherwise the system should
fail. The following is an example:
8
32. | ?- 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 rules
are matched and the truth value of the proper part constraint is not false
the 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
33. no
Rule 16 states that if X is not proper part of Y then either X is not part
of 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 Y
and 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 simpli
34. cation rule capturing the meaning
of axiom 6. The following is an example that shows the eect of matching
the 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) n eq(X; Y; T) $ T = true:
(R19) p(X; Y; false) n eq(X; Y; T) $ T = false:
(R20) p(Y;X; false) n eq(X; Y; T) $ T = false:
(R21) eq(X; Y; false) $ true j (p(X; Y; false) ; p(Y;X; false)).
10
35. Rule 18 states that if the constraint store contains the the constraints
p(X,Y,true) , p(Y,X,true) and eq(X,Y,T) then it should dispose the
equality 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 rules
are matched and the truth value of the equality constraint is not false the
system 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
36. Rule 21 states that if X is not equal to Y then either X is not part of Y
or 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 if
and only if there exist a region Z such that it is part of region X and region
Y.
Axiom Rule
(A7) o(x; y) $ 9z [p(z; x) ^ p(z; y)] (R22) p(Z;X; true); p(Z; Y; true)
n o(X; Y; T) $ T = true:
Axiom 7 states that for a region to overlap another there has to exist
a region Z which is part of both regions. The problem here is that we can
not simplify a overlap constraint to such condition as the variables in the
constraints will be arbitrary ones and will never match anything. Thus our
solution was to simplify an overlapping constraint to true if the conditions
exist. In other words, If the constraint store contains the two constraints
stating that a region Z is part of X and Y and it also contains the overlapping
constraint stating that region X overlaps region Y. Then the action is to
simplify the overlapping constraint as it is already satis
37. ed if and only if the
truth value of the overlapping constraint is in fact true. The following is an
example:
| ?- 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
38. 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) n o(X; Y; V ) $ Z = V:
(R24) o(X; Y;Z) n 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 the
overlapping constraint. Rule 23 will remove a duplicate overlapping con-
straint if their truth values are the same otherwise the system will fail. On
the other hand, rule 24 will only match if the
39. rst 2 arguments of both con-
straints are exchanged and will also result in the removal of one of them if
and 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
40. 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 the
parthood constraint did not exist we could have simpli
41. ed both parthood
and overlapping in terms of connection constraints. If this was the case
inconsistencies would have been detected at the connection level, otherwise
we have to handle inconsistency conditions in terms of the constraint itself.
This is the reason we introduced rules 25 and 26, the following are examples
to illustrate the eect 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 simpli
43. | ?- 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) n dr(X; Y; T) $ T = true:
(R30) o(X; Y; true) n dr(X; Y; T) $ T = false:
Rule 28 deals with the opposite case of rule 27, simplifying a false discrete
constraint 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 these
two regions. Then the action that should be taken is to remove the discrete
constraint 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 examples
to demonstrate the eect 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
44. | ?- 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 de
45. nes the partial overlap relation, A region X partially
overlaps region Y if and only if X overlaps Y , X is not part of Y and Y is
not 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 into
overlap 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) n po(X; Y; T) $ T = true:
(R33) o(X; Y; false) n po(X; Y; T) $ T = false
(R34) p(X; Y; true) n po(X; Y; T) $ T = false:
(R35) p(Y;X; true) n po(X; Y; T) $ T = false:
(R36) po(X; Y; false) $
true j (o(X; Y; false) ; p(X; Y; true); p(Y;X; true)):
16
46. Rule 32 states that if the overlapping and parthood constraints that par-
tial overlap constraints was to be simpli
47. ed to were already in the constraint
store then just remove the new partial overlap that is just ariving from the
store if and only if it's truth value is indeed true otherwise fail. Consider
the 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 33
state 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 parthood
constraints, Consider the following examples:
| ?- o(egypt,canada,false), po(egypt,canada,T).
T = false,
17
48. 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 does
not overlap Y or X is part of Y or Y is part of X. Consider the following
example:
| ?- 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 Y
and 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
49. The following are the rest of externally connected rules:
(R38) c(X; Y; true); o(X; Y; false) n ec(X; Y; T) $ T = true:
(R39) c(X; Y; false) n ec(X; Y; T) $ T = false:
(R40) o(X; Y; true) n ec(X; Y; T) $ T = false:
(R41) ec(X; Y; false) $ true j (c(X; Y; false) ; o(X; Y; true)):
Rule 38 states if the necessary conditions for X to be externally connected
to Y hold and the constraint store also contains the externally connection
constraint 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 external
connection 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
50. 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 is
contained 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 proper
part of it and there exist a region Z that is both externally connected to X
and Y.
Axiom Rule
(A11) tpp(x; y) $ pp(x; y)^ (R42) p(X; Y; true); p(Y;X; false);
9Z [ec(z; x) ^ ec(z; y)] c(Z;X; true); o(Z;X; false); c(Z; Y; true);
o(Z; Y; false) n tpp(X; Y; T) $ T = true:
If you notice rule 42 does not simplify a tpp(X,Y,T) into anything but
what it does is that it will simplify it to truth if it's conditions hold. This
is the case because if we simpli
51. ed the constraint to proper parthood and
external connection , nothing will match the external connection constraints
because 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 simpli
52. ed form. Thus the head
of the rule will be matched when the necessary simpli
53. ed conditions for this
constraint hold. Consider the following example:
| ?- pp(X,Y,true), ec(Z,X,true), ec(Z,Y,true), tpp(X,Y,T).
20
54. 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) n 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. While
rules 44-52 handles all failure cases with other constraints, the reason for
needing these rules is as stated above that this constraint will not be sim-
pli
55. ed in terms of other constraints. Consider the following examples:
| ?- tpp(X,Y,true), tpp(X,Y,T).
21
56. 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 part
of Y and there exist a region Z such that it is externally connected to X and
to Y.
Axiom Rule
(A12) ntpp(x; y) $ pp(x; y) (R53) ntpp(X; Y; true) $ pp(X; Y; true);
^: 9Z [ec(z; x) ^ ec(z; y)] tpp(Y;X; false)
Rule 53 states simpli
59. nes the false constraint non-tangential proper part in terms
of 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 de
60. ne the inverse of the previously mentioned con-
straints, the rules will just simplify the inverse constraints in terms of their
corresponding 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 simpli
61. es
every constraint into connection constraints. However, we faced limitations
when dealing with relations that had variables bound to universal quanti
62. ers
or existential ones. We worked around these limitations by not simplifying
these constraints except if their conditions were already in the store and
by handling failure cases for them. The system could be used to check
consistency 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
63. [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