# Qualitative Spatial Reasoning with Directional and Topological Relations

Authors: Sangha Nam; Incheol Kim
Journal: Mathematical Problems in Engineering
 (2015)

---

## Abstract

A wide range of application domains from cognitive robotics to intelligent systems encompassing diverse paradigms such as ambient intelligence and ubiquitous computing environments require the ability to represent and reason about the spatial aspects of the environment within which an agent or a system is functional. Many existing spatial reasoners share a common limitation that they do not provide any checking functions for cross-consistency between the directional and the topological relation set. They provide only the checking function for path-consistency within a directional or topological relation set. This paper presents an efficient spatial reasoning algorithm working on a mixture of directional and topological relations between spatial entities and then explains the implementation of a spatial reasoner based on the proposed algorithm. Our algorithm not only has the checking function for path-consistency within each directional or topological relation set, but also provides the checking function for cross-consistency between them. This paper also presents an application system developed to demonstrate the applicability of the spatial reasoner and then introduces the results of the experiment carried out to evaluate the performance of our spatial reasoner.


---

## Body

## 1. Introduction

A wide range of application domains from cognitive robotics to intelligent systems encompassing diverse paradigms such as ambient intelligence and ubiquitous computing environments [1, 2] require the ability to represent and reason about the spatial aspects of the environment within which an agent or a system is functional [3]. Qualitative reasoning is concerned with capturing everyday commonsense knowledge of the physical world with a limited set of symbols and relationships and manipulating it in a nonnumerical manner. The subfield of qualitative reasoning that is concerned with representation and reasoning of space is called qualitative spatial reasoning (QSR) [4].The main aim of research in qualitative spatial reasoning (QSR) is to develop powerful representation formalisms that account for the multimodality of space in a cognitively acceptable way. CSD- (cone-shaped directional-) 9 [5] and RCC- (region connection calculi-) 8 [6] are well-known qualitative spatial formalisms for representing and reasoning about the directional and the topological relationships between spatial entities. Some implementations of spatial reasoner based on these formalisms include SOWL [7], PelletSpatial [8], and CHOROS [9]. SOWL is a framework for handling spatiotemporal knowledge in OWL, the standard semantic web language. Both RCC-8 topological and CSD-9 directional relations are integrated in SOWL. The SOWL reasoner is capable of inferring new relations and checking their consistency. The reasoner is realized by a set of SWRL [10] rules operating on spatiotemporal relations. PelletSpatial is a spatial reasoner that adopts a highly efficient algorithm for checking path-consistency in a RCC-8 topological relation set. CHOROS is an extension of PelletSpatial to add CSD-9 directional reasoning facility. However, all these existing spatial reasoners share a common limitation that they do not provide any checking functions for cross-consistency between the CSD-9 directional relation set and the RCC-8 topological relation set. They provide only the checking function for path-consistency within a directional or topological relation set.In this paper, we present an efficient spatial reasoning algorithm working on a mixture of CSD-9 directional and RCC-8 topological relations, and then we explain the implementation of a spatial reasoner based on the proposed algorithm. Our algorithm not only has the checking function for path-consistency within each directional or topological relation set, but also provides the checking function for cross-consistency between them. We also present an application system developed to demonstrate the applicability of the spatial reasoner and then introduce the results of the experiment carried out to evaluate the performance of our spatial reasoner.


## 2. Design of Spatial Reasoner

### 2.1. Spatial Knowledge Representation

The first requirement in the design of a spatial reasoner is to decide how to represent the spatial knowledge required for the inference. This is the spatial knowledge representation. In this paper, we assume that a spatial knowledge base used for reasoning is represented by triple statements (subject, predicate, and object) according to RDF/OWL, a semantic web-standard ontology language. Each location covered by the knowledge base is defined as an element that belongs to the GeoInstance class.Figure1 shows a statement or fact that builds the spatial knowledge base. Relations of direction, boundary, and containment between two spaces or locations (GeoInstance) are represented using the spatial property defined in CSD-9 and RCC-8. For example, the directional relation between two spaces, “the state of Oregon in the USA is located to the north of the state of California,” can be represented by (Oregon north of California).Figure 1
Triple statement representation.The spatial reasoning of CSD-9 and RCC-8 assumes a knowledge type that represents relations between spaces. The CSD- (cone-shaped directional-) 9 theory assumes that a direction relation between two arbitrary points on a two-dimensional space can be represented, if one point is set, by one of nine directions: East (E), West (W), South (S), North (N), North East (NE), North West (NW), South East (SE), South West (SW), and Identical (O) for the direction of the other point as shown in Figure2.Figure 2
The set of CSD-9 directional relations.The RCC- (region connection calculi-) 8 theory assumes that boundary and containment relations between two arbitrary regions on a two dimensional space can be represented by one of eight relations: disconnected (DC), externally connected (EC), partially overlapping (PO), equal (EQ), tangential proper part (TPP), tangential proper part inverse (TPPi), nontangential proper part (NTPP), and nontangential proper part inverse (NTPPi) as shown in Figure3. That is, the CSD-9 spatial knowledge expresses a directional relation between two spaces in terms of points whereas the RCC-8 spatial knowledge expresses a relation of boundary and containment between two spaces in terms of regions. Most real-world spaces or locations can be interpreted as either a single point or single region that represents multifaceted characteristics. Thus, CSD-9 and RCC-8 spatial knowledge can be utilized complementarily to express and infer diverse relations between real-world spaces.Figure 3
The set of RCC-8 topological relations.


### 2.2. Spatial Inference Rule

The CSD-9 spatial inference rules, which are applied to the spatial knowledge base represented by nine directional relations, can be summarized by the composition table shown in Table1.Table 1
Composition table for CSD-9 relations.
N
NE
E
SE
S
SW
W
NW
O
N
N
N, NE
N, NE, E
N, NE, E, SE
N, NE, E, SE, S, SW, W, NW, O
N, SW, W, NW
N, W, NW
N, NW
N, O
NE
N, NE
NE
NE, E
NE, E, SE
NE, E, SE, S
N, NE, E, SE, S, SW, W, NW, O
N, NE, W, NW
N, NE, NW
NE, O
E
N, NE, E
NE, E
E
E, SE
E, SE, S
E, SE, S, SW
N, NE, E, SE, S, SW, W, NW, O
N, NE, E, NW
E, O
SE
N, NE, E, SE
NE, E, SE
E, SE
SE
SE, S
SE, S, SW
SE, S, SW, W
N, NE, E, SE, S, SW, W, NW, O
SE, O
S
N, NE, E, SE, S, SW, W, NW, O
NE, E, SE, S
E, SE, S
SE, S
S
S, SW
S, SW, W
S, SW, W, NW
S, O
SW
N, SW, W, NW
N, NE, E, SE, S, SW, W, NW, O
E, SE, S, SW
SE, S, SW
S, SW
SW
SW, W
SW, W, NW
SW, O
W
N, W, NW
N, NE, W, NW
N, NE, E, SE, S, SW, W, NW, O
SE, S, SW, W
S, SW, W
SW, W
W
W, NW
W, O
NW
N, NW
N, NE, NW
N, NE, E, NW
N, NE, E, SE, S, SW, W, NW, O
S, SW, W, NW
SW, W, NW
W, NW
NW
NW, O
O
N, O
NE, O
E, O
SE, O
S, O
SW, O
W, O
NW, O
N, NE, E, SE, S, SW, W, NW, OTable1 suggests that if items in the horizontal row and vertical column are simultaneously true, a new composition can be produced from the facts that are listed in the cell where the corresponding row and column intersect. For example, if location “A” is located at north of location “B” (A N B) and “B” is located in the northeast of location “C” (B NE C), then “A” may be located north or northeast of “C” (A [N, NE] C). This is inferred as a new fact. When a relation between two spaces is defined by a definite relation as shown above, for example, (A N B) and (B NE C), these facts are called “defined relations.” On the other hand, when a relation between two spaces cannot be definitely defined, for example (A [N, NE] C) as shown above, this relation is called a “disjunctive relation.” The RCC-8 spatial inference rules, which use a similar method, can be summarized by the composition table shown in Table 2. For example, when “A” is bordered with “B” (A EC B) and “B” contains “C” completely without intersection (B NTPPi C), a new fact can be inferred that “A” and “C” are separated from each other (A DC C).Table 2
Composition table for RCC-8 relations.
DC
EC
PO
TPP
NTPP
TPPi
NTPPi
EQ
DC
DC, EC, PO, TPP, NTPP, TPPi, NTPPi, EQ
DC, EC, PO, TPP, NTPP
DC, EC, PO, TPP, NTPP
DC, EC, PO, TPP, NTPP
DC, EC, PO, TPP, NTPP
DC
DC
DC
EC
DC, EC, PO,TPPi, NTPPi
DC, EC, PO, TPP, TPPi, EQ
DC, EC, PO, TPP, NTPP
EC, PO, TPP,NTPP
PO, TPP, NTPP
DC, EC
DC
EC
PO
DC, EC, PO,TPPi, NTPPi
DC, EC, PO,TPPi, NTPPi
DC, EC, PO, TPP, NTPP, TPPi, NTPPi, EQ
PO, TPP, NTPP
PO, TPP,NTPP
DC, EC, PO,TPPi, NTPPi
DC, EC, PO,TPPi, NTPPi
PO
TPP
DC
DC, EC
DC, EC, PO, TPP, NTPP
TPP, NTPP
NTPP
DC, EC, PO, TPP, TPPi, EQ
DC, EC, PO,TPPi, NTPPi
TPP
NTPP
DC
DC
DC, EC, PO, TPP, NTPP
NTPP
NTPP
DC, EC, PO, TPP, NTPP
DC, EC, PO, TPP, NTPP, TPPi, NTPPi, EQ
NTPP
TPPi
DC, EC, PO,TPPi, NTPPi
EC, PO, TPPi,NTPPi
PO, TPPi, NTPPi
PO, TPP, TPPi, EQ
PO, TPP, NTPP
TPPi, NTPPi
NTPPi
TPPi
NTPPi
DC, EC, PO,TPPi, NTPPi
PO, TPPi,NTPPi
PO, TPPi,NTPPi
PO, TPPi,NTPPi
PO, TPP, NTPP, TPPi, NTPPi, EQ
NTPPi
NTPPi
NTPPi
EQ
DC
EC
PO
TPP
NTPP
TPPi
NTPPi
EQInherently, CSD-9 and RCC-8 are independent theories that provide distinct spatial knowledge representations and inference methods from a different viewpoint. However, as explained earlier, in many real-world spaces and locations, it is necessary that the directional relations of CSD-9 and containment relations of RCC-8 be represented and inferred simultaneously. In such cases, a spatial reasoning algorithm that requires integrated inference must determine whether a new fact can be inferred in terms of RCC-8 containment relations from the facts that represent the CSD-9 directional relations or whether the inference must be produced conversely. In this paper, the conversion rules between CSD-9 and RCC-8 relations were determined via analysis of a special knowledge base representing various cases as shown in Table3. In Table 3, a single fact that represents a CSD-9 O relation suggests a fact that satisfies one relation from {EQ, PO, TPP, NTPP, TPPi, NTPPi} of the RCC-8 relations. Similarly, an item that represents CSD-9 relations of {N, NE, E, SE, S, SW, W, NW} suggests that one of the RCC-8 relations {DC, EC, PO} can be satisfied. Conversely, relations of {EQ, PO, TPP, NTPP, TPPi, NTPPi} from RCC-8 suggest a CSD-9 O relation. Relations of {DC, EC, PO} from RCC-8 suggest that one of the CSD-9 relations of {N, NE, E, SE, S, SW, W, NW} can be satisfied. Thus, once defined or disjunctive relations that correspond to each case are determined from a knowledge base, they can be converted to newly suggested defined relations or disjunctive relations. For example, when the state of California completely contains the city of LA (California NTPPi LA), the state of California cannot be assumed to be located at any of the eight directions therefore the state of California and LA are interpreted as an Identical relation (California O LA). If two regions satisfy a PO relation, that is, partially overlapped, depending on how the centers of the two regions are located, their relation can be interpreted as being either Identical (O) or one of the remaining eight directions.Table 3
Conversion table between CSD-9 directional and RCC-8 topological relations.
Directional relations
Topological relations
O
EQ, PO, TPP, NTPP, TPPi, NTPPi
N, NE, E, SE, S, SW, W, NW
DC, EC, PO


### 2.3. Spatial Reasoning Algorithm

In this paper, we design a spatial reasoning algorithm based on the spatial inference rules summarized in Tables1, 2, and 3.Algorithm1 summarizes the overall process of the spatial reasoning algorithm. This algorithm consists of detailed steps that check the consistency of Set N of CSD-9 and RCC-8 spatial relations contained in the knowledge base. If Set N is an empty set or all spatial relations satisfy consistency, the algorithm is terminated successfully (Lines 1~4). The inverseComplete(N) and equalsComplete(N) steps process N to infer all the inverse and equals relations. For example, with regard to a single spatial relation of (A N B), the inverse relation (B S A) and equal relations (A O A) and (B O B) are inferred (Lines 5~6). For all the spatial relations created, the checks IsPathConsistent(N, R
a
b) and IsCrossConsistent(N, R
a
b) are performed iteratively based on the spatial relation R
a
b. If an inconsistency of the knowledge base is detected, inference is interrupted (Lines 7~11). IsPathConsistent(N, R
a
b) performs a path-consistency check on the relation sets of CSD-9 and RCC-8 using Tables 1 and 2, respectively. And then IsCrossConsistent(N, R
a
b) performs the cross-consistency checks between CSD-9 and RCC-8 relations using Table 3.Algorithm 1:Algorithm for spatial reasoning.
SpatialReasoning(N)
(1)require  N a set of defined relations
(2)ensure  N consistent then true; else false
(3)if  N = ∅  then
(4)return true
(5)N
←inverseComplete(N)
(6)N
←equalsComplete(N)
(7)for  R
a
b
∈
N  do
(8)if  !isPathConsistent(N, R
a
b)  then
(9)return  false
(10)if  !isCrossConsistent(N, R
a
b) then
(11)return  false
(12)return  trueAlgorithm2 shows the IsPathConsistent(N, R
a
b) algorithm, which performs a path-consistency check on the relation sets of CSD-9 and RCC-8 based on relation R
a
b, respectively. If the isCSDRelation(R
a
b) step returns the result that R
a
b is CSD-9 knowledge, all the items of the CSD-9 knowledge from Set N are stored in Set M, while all items of the RCC-8 knowledge from Set N are stored in Set M (Lines 3~6). Then, the composeRelations(R
a
b, S
b
c) and AddRelations(N, T
a
c) steps are performed iteratively with regard to the items of knowledge (S
b
c) that enable composition inference with R
a
b from M. During the composeRelations(R
a
b, S
b
c) step, a new spatial relation is derived through the composition-inference process of R
a
b and S
b
c as mentioned in Section 2.2. Next, during the AddRelations(N, T
a
c) step, while a new spatial relation is stored in Set N, it is determined whether a new spatial relation satisfies the consistency with the existing relations (Lines 7~12). Using the path-consistency check, a new spatial relation is derived that can be composed from the existing spatial relations.Algorithm 2:Algorithm for checking path-consistency.
IsPathConsistent(N, R
a
b)
(1)require  N a set of relations, R
a
b
∈
N
(2)ensure  R
a
b path-consistent then true; else false
(3)if  isCSDRelation(R
a
b) then
(4)M
←getCSDRelations(N)
(5)else
(6)M
←getRCCRelations(N)
(7)for  S
b
c
∈
M  do
(8)T
a
c
←composeRelations(R
a
b, S
b
c)
(9)              (N, consistency) ←addRelations(N, T
a
c)
(10)if !consistency
then
(11)return false
(12)return trueAlgorithm3 shows the IsCrossConsistent(N, R
a
b) algorithm that performs the cross-consistency check between the relations of CSD-9 and RCC-8 based on the relation R
a
b. During the convertRelation(R
a
b) step, new cross-spatial relations are derived from the implications of the single spatial relation R
a
b using conversion Table 3 (Line 3). For example, a new topological relation (A [DC, EC, PO] B) that is implied by the directional relation (A N B) between the two spaces “A” and “B” is derived. Then, Set U
a
b containing the newly derived spatial relations is integrated to Set N through AddRelations(N, U
a
b) followed by another consistency check (Lines 4~6).Algorithm 3:Algorithm for checking cross-consistency.
IsCrossConsistent(N, R
a
b)
(1)require  N a set of relations, R
a
b
∈
N
(2)ensure  R
a
b cross-consistent then true; else false
(3)U
a
b
←convertRelation(R
a
b)
(4)      (N, consistency) ←addRelations(N, U
a
b)
(5)if !consistency
then
(6)return false
(7)return trueAlgorithm4 shows the AddRelations(N, V
a
b) algorithm that adds relation V
a
b to Set N of the spatial relations and simultaneously checks the consistency between the relations. Relation V
a
b corresponds to a new spatial relation obtained through the composition or conversion process. If the certainty of this spatial relation is 0%, it is determined that it is not necessary to add this relation to Set N and thus the operation is terminated (Lines 2~3). Otherwise, it determines what spatial relation existed previously between “a” and “b” from Set N. If an existing spatial relation is not found, relation V
a
b is added to Set N (Lines 4~6). If an existing spatial relation is found, the high-certainty spatial relations are derived through the intersection of the existing spatial relations and V
a
b. The high-certainty spatial relations are added to Set N and the existing spatial relations are removed. However, if the above intersection is an empty set, which means that the consistency is not met between the existing spatial relations and new spatial relations, inconsistency of the spatial relations is returned (Lines 7~15). For example, where the directional relation of (A [N, E] B) between two spaces “A” and “B” exists in the existing Set N, and a new directional relation of (A [N, NE] B) is to be added to it, the high-certainty spatial relation (X
a
b), which is (A N B), is derived through an intersection between the two. Finally, X
b
a, which is an inverse relation of X
a
b, is added to Set N using a recursive call of the function.Algorithm 4:Algorithm for adding new relations.
AddRelations(N, V
a
b)
(1)require  N, V
a
b relation
(2)if  V = ℣
then
(3)return
(4)W
a
b
←
{
R
i
j
∣
i
=
a, j = b, R
i
j
∈
N
}
(5)if  ∄  W
a
b  then
(6)X
a
b
←
V
a
b
(7)else
(8)X
a
b
←
V
a
b
∩
W
a
b
(9)if  X
a
b = ∅  then
(10)consistency = false
(11)return
(12)if  W
a
b = X
a
b  then
(13)return
(14)N
←
N
∖
{
W
a
b
}
(15)N
←
N
∪
{
X
a
b
}
(16)addRelations(N, X
b
a)The spatial reasoning algorithm, in which a cross-consistency check step is extended in this paper, has three advantages compared to existing spatial reasoning algorithms. First, the amount of knowledge derived from inference increases. For example, in “LA is located northwest of San Diego (LA NW SD)” where spatial knowledge from a directional viewpoint exists although spatial knowledge of the topological viewpoint between LA and San Diego is not indicated, the following knowledge can be inferred using the conversion table (LA [DC, EC, PO] SD). Moreover, the certainty of the inferred knowledge increases. For example, the following two cases “LA is located southeast or identical of San Francisco (LA [SE, O] SF)” where the spatial knowledge of the direction viewpoint exists and “LA and San Francisco are separated (LA DC SF)” where the spatial knowledge of the topological viewpoint exists are assumed. Here, certainty can be added to the spatial knowledge of uncertainty from a directional viewpoint using the cross-consistency check (LA SE SF). Finally, additional validation on incorrect spatial knowledge can be performed. For example, let us assume that “San Francisco is located northwest of San Diego (SF NW SD)” where the spatial knowledge from a directional viewpoint exists and “San Francisco contains San Diego (SF TPPi SD)” where spatial knowledge from a topological viewpoint exists. Here, using the cross-consistency check, incorrect spatial knowledge can be detected.


## 2.1. Spatial Knowledge Representation

The first requirement in the design of a spatial reasoner is to decide how to represent the spatial knowledge required for the inference. This is the spatial knowledge representation. In this paper, we assume that a spatial knowledge base used for reasoning is represented by triple statements (subject, predicate, and object) according to RDF/OWL, a semantic web-standard ontology language. Each location covered by the knowledge base is defined as an element that belongs to the GeoInstance class.Figure1 shows a statement or fact that builds the spatial knowledge base. Relations of direction, boundary, and containment between two spaces or locations (GeoInstance) are represented using the spatial property defined in CSD-9 and RCC-8. For example, the directional relation between two spaces, “the state of Oregon in the USA is located to the north of the state of California,” can be represented by (Oregon north of California).Figure 1
Triple statement representation.The spatial reasoning of CSD-9 and RCC-8 assumes a knowledge type that represents relations between spaces. The CSD- (cone-shaped directional-) 9 theory assumes that a direction relation between two arbitrary points on a two-dimensional space can be represented, if one point is set, by one of nine directions: East (E), West (W), South (S), North (N), North East (NE), North West (NW), South East (SE), South West (SW), and Identical (O) for the direction of the other point as shown in Figure2.Figure 2
The set of CSD-9 directional relations.The RCC- (region connection calculi-) 8 theory assumes that boundary and containment relations between two arbitrary regions on a two dimensional space can be represented by one of eight relations: disconnected (DC), externally connected (EC), partially overlapping (PO), equal (EQ), tangential proper part (TPP), tangential proper part inverse (TPPi), nontangential proper part (NTPP), and nontangential proper part inverse (NTPPi) as shown in Figure3. That is, the CSD-9 spatial knowledge expresses a directional relation between two spaces in terms of points whereas the RCC-8 spatial knowledge expresses a relation of boundary and containment between two spaces in terms of regions. Most real-world spaces or locations can be interpreted as either a single point or single region that represents multifaceted characteristics. Thus, CSD-9 and RCC-8 spatial knowledge can be utilized complementarily to express and infer diverse relations between real-world spaces.Figure 3
The set of RCC-8 topological relations.


## 2.2. Spatial Inference Rule

The CSD-9 spatial inference rules, which are applied to the spatial knowledge base represented by nine directional relations, can be summarized by the composition table shown in Table1.Table 1
Composition table for CSD-9 relations.
N
NE
E
SE
S
SW
W
NW
O
N
N
N, NE
N, NE, E
N, NE, E, SE
N, NE, E, SE, S, SW, W, NW, O
N, SW, W, NW
N, W, NW
N, NW
N, O
NE
N, NE
NE
NE, E
NE, E, SE
NE, E, SE, S
N, NE, E, SE, S, SW, W, NW, O
N, NE, W, NW
N, NE, NW
NE, O
E
N, NE, E
NE, E
E
E, SE
E, SE, S
E, SE, S, SW
N, NE, E, SE, S, SW, W, NW, O
N, NE, E, NW
E, O
SE
N, NE, E, SE
NE, E, SE
E, SE
SE
SE, S
SE, S, SW
SE, S, SW, W
N, NE, E, SE, S, SW, W, NW, O
SE, O
S
N, NE, E, SE, S, SW, W, NW, O
NE, E, SE, S
E, SE, S
SE, S
S
S, SW
S, SW, W
S, SW, W, NW
S, O
SW
N, SW, W, NW
N, NE, E, SE, S, SW, W, NW, O
E, SE, S, SW
SE, S, SW
S, SW
SW
SW, W
SW, W, NW
SW, O
W
N, W, NW
N, NE, W, NW
N, NE, E, SE, S, SW, W, NW, O
SE, S, SW, W
S, SW, W
SW, W
W
W, NW
W, O
NW
N, NW
N, NE, NW
N, NE, E, NW
N, NE, E, SE, S, SW, W, NW, O
S, SW, W, NW
SW, W, NW
W, NW
NW
NW, O
O
N, O
NE, O
E, O
SE, O
S, O
SW, O
W, O
NW, O
N, NE, E, SE, S, SW, W, NW, OTable1 suggests that if items in the horizontal row and vertical column are simultaneously true, a new composition can be produced from the facts that are listed in the cell where the corresponding row and column intersect. For example, if location “A” is located at north of location “B” (A N B) and “B” is located in the northeast of location “C” (B NE C), then “A” may be located north or northeast of “C” (A [N, NE] C). This is inferred as a new fact. When a relation between two spaces is defined by a definite relation as shown above, for example, (A N B) and (B NE C), these facts are called “defined relations.” On the other hand, when a relation between two spaces cannot be definitely defined, for example (A [N, NE] C) as shown above, this relation is called a “disjunctive relation.” The RCC-8 spatial inference rules, which use a similar method, can be summarized by the composition table shown in Table 2. For example, when “A” is bordered with “B” (A EC B) and “B” contains “C” completely without intersection (B NTPPi C), a new fact can be inferred that “A” and “C” are separated from each other (A DC C).Table 2
Composition table for RCC-8 relations.
DC
EC
PO
TPP
NTPP
TPPi
NTPPi
EQ
DC
DC, EC, PO, TPP, NTPP, TPPi, NTPPi, EQ
DC, EC, PO, TPP, NTPP
DC, EC, PO, TPP, NTPP
DC, EC, PO, TPP, NTPP
DC, EC, PO, TPP, NTPP
DC
DC
DC
EC
DC, EC, PO,TPPi, NTPPi
DC, EC, PO, TPP, TPPi, EQ
DC, EC, PO, TPP, NTPP
EC, PO, TPP,NTPP
PO, TPP, NTPP
DC, EC
DC
EC
PO
DC, EC, PO,TPPi, NTPPi
DC, EC, PO,TPPi, NTPPi
DC, EC, PO, TPP, NTPP, TPPi, NTPPi, EQ
PO, TPP, NTPP
PO, TPP,NTPP
DC, EC, PO,TPPi, NTPPi
DC, EC, PO,TPPi, NTPPi
PO
TPP
DC
DC, EC
DC, EC, PO, TPP, NTPP
TPP, NTPP
NTPP
DC, EC, PO, TPP, TPPi, EQ
DC, EC, PO,TPPi, NTPPi
TPP
NTPP
DC
DC
DC, EC, PO, TPP, NTPP
NTPP
NTPP
DC, EC, PO, TPP, NTPP
DC, EC, PO, TPP, NTPP, TPPi, NTPPi, EQ
NTPP
TPPi
DC, EC, PO,TPPi, NTPPi
EC, PO, TPPi,NTPPi
PO, TPPi, NTPPi
PO, TPP, TPPi, EQ
PO, TPP, NTPP
TPPi, NTPPi
NTPPi
TPPi
NTPPi
DC, EC, PO,TPPi, NTPPi
PO, TPPi,NTPPi
PO, TPPi,NTPPi
PO, TPPi,NTPPi
PO, TPP, NTPP, TPPi, NTPPi, EQ
NTPPi
NTPPi
NTPPi
EQ
DC
EC
PO
TPP
NTPP
TPPi
NTPPi
EQInherently, CSD-9 and RCC-8 are independent theories that provide distinct spatial knowledge representations and inference methods from a different viewpoint. However, as explained earlier, in many real-world spaces and locations, it is necessary that the directional relations of CSD-9 and containment relations of RCC-8 be represented and inferred simultaneously. In such cases, a spatial reasoning algorithm that requires integrated inference must determine whether a new fact can be inferred in terms of RCC-8 containment relations from the facts that represent the CSD-9 directional relations or whether the inference must be produced conversely. In this paper, the conversion rules between CSD-9 and RCC-8 relations were determined via analysis of a special knowledge base representing various cases as shown in Table3. In Table 3, a single fact that represents a CSD-9 O relation suggests a fact that satisfies one relation from {EQ, PO, TPP, NTPP, TPPi, NTPPi} of the RCC-8 relations. Similarly, an item that represents CSD-9 relations of {N, NE, E, SE, S, SW, W, NW} suggests that one of the RCC-8 relations {DC, EC, PO} can be satisfied. Conversely, relations of {EQ, PO, TPP, NTPP, TPPi, NTPPi} from RCC-8 suggest a CSD-9 O relation. Relations of {DC, EC, PO} from RCC-8 suggest that one of the CSD-9 relations of {N, NE, E, SE, S, SW, W, NW} can be satisfied. Thus, once defined or disjunctive relations that correspond to each case are determined from a knowledge base, they can be converted to newly suggested defined relations or disjunctive relations. For example, when the state of California completely contains the city of LA (California NTPPi LA), the state of California cannot be assumed to be located at any of the eight directions therefore the state of California and LA are interpreted as an Identical relation (California O LA). If two regions satisfy a PO relation, that is, partially overlapped, depending on how the centers of the two regions are located, their relation can be interpreted as being either Identical (O) or one of the remaining eight directions.Table 3
Conversion table between CSD-9 directional and RCC-8 topological relations.
Directional relations
Topological relations
O
EQ, PO, TPP, NTPP, TPPi, NTPPi
N, NE, E, SE, S, SW, W, NW
DC, EC, PO


## 2.3. Spatial Reasoning Algorithm

In this paper, we design a spatial reasoning algorithm based on the spatial inference rules summarized in Tables1, 2, and 3.Algorithm1 summarizes the overall process of the spatial reasoning algorithm. This algorithm consists of detailed steps that check the consistency of Set N of CSD-9 and RCC-8 spatial relations contained in the knowledge base. If Set N is an empty set or all spatial relations satisfy consistency, the algorithm is terminated successfully (Lines 1~4). The inverseComplete(N) and equalsComplete(N) steps process N to infer all the inverse and equals relations. For example, with regard to a single spatial relation of (A N B), the inverse relation (B S A) and equal relations (A O A) and (B O B) are inferred (Lines 5~6). For all the spatial relations created, the checks IsPathConsistent(N, R
a
b) and IsCrossConsistent(N, R
a
b) are performed iteratively based on the spatial relation R
a
b. If an inconsistency of the knowledge base is detected, inference is interrupted (Lines 7~11). IsPathConsistent(N, R
a
b) performs a path-consistency check on the relation sets of CSD-9 and RCC-8 using Tables 1 and 2, respectively. And then IsCrossConsistent(N, R
a
b) performs the cross-consistency checks between CSD-9 and RCC-8 relations using Table 3.Algorithm 1:Algorithm for spatial reasoning.
SpatialReasoning(N)
(1)require  N a set of defined relations
(2)ensure  N consistent then true; else false
(3)if  N = ∅  then
(4)return true
(5)N
←inverseComplete(N)
(6)N
←equalsComplete(N)
(7)for  R
a
b
∈
N  do
(8)if  !isPathConsistent(N, R
a
b)  then
(9)return  false
(10)if  !isCrossConsistent(N, R
a
b) then
(11)return  false
(12)return  trueAlgorithm2 shows the IsPathConsistent(N, R
a
b) algorithm, which performs a path-consistency check on the relation sets of CSD-9 and RCC-8 based on relation R
a
b, respectively. If the isCSDRelation(R
a
b) step returns the result that R
a
b is CSD-9 knowledge, all the items of the CSD-9 knowledge from Set N are stored in Set M, while all items of the RCC-8 knowledge from Set N are stored in Set M (Lines 3~6). Then, the composeRelations(R
a
b, S
b
c) and AddRelations(N, T
a
c) steps are performed iteratively with regard to the items of knowledge (S
b
c) that enable composition inference with R
a
b from M. During the composeRelations(R
a
b, S
b
c) step, a new spatial relation is derived through the composition-inference process of R
a
b and S
b
c as mentioned in Section 2.2. Next, during the AddRelations(N, T
a
c) step, while a new spatial relation is stored in Set N, it is determined whether a new spatial relation satisfies the consistency with the existing relations (Lines 7~12). Using the path-consistency check, a new spatial relation is derived that can be composed from the existing spatial relations.Algorithm 2:Algorithm for checking path-consistency.
IsPathConsistent(N, R
a
b)
(1)require  N a set of relations, R
a
b
∈
N
(2)ensure  R
a
b path-consistent then true; else false
(3)if  isCSDRelation(R
a
b) then
(4)M
←getCSDRelations(N)
(5)else
(6)M
←getRCCRelations(N)
(7)for  S
b
c
∈
M  do
(8)T
a
c
←composeRelations(R
a
b, S
b
c)
(9)              (N, consistency) ←addRelations(N, T
a
c)
(10)if !consistency
then
(11)return false
(12)return trueAlgorithm3 shows the IsCrossConsistent(N, R
a
b) algorithm that performs the cross-consistency check between the relations of CSD-9 and RCC-8 based on the relation R
a
b. During the convertRelation(R
a
b) step, new cross-spatial relations are derived from the implications of the single spatial relation R
a
b using conversion Table 3 (Line 3). For example, a new topological relation (A [DC, EC, PO] B) that is implied by the directional relation (A N B) between the two spaces “A” and “B” is derived. Then, Set U
a
b containing the newly derived spatial relations is integrated to Set N through AddRelations(N, U
a
b) followed by another consistency check (Lines 4~6).Algorithm 3:Algorithm for checking cross-consistency.
IsCrossConsistent(N, R
a
b)
(1)require  N a set of relations, R
a
b
∈
N
(2)ensure  R
a
b cross-consistent then true; else false
(3)U
a
b
←convertRelation(R
a
b)
(4)      (N, consistency) ←addRelations(N, U
a
b)
(5)if !consistency
then
(6)return false
(7)return trueAlgorithm4 shows the AddRelations(N, V
a
b) algorithm that adds relation V
a
b to Set N of the spatial relations and simultaneously checks the consistency between the relations. Relation V
a
b corresponds to a new spatial relation obtained through the composition or conversion process. If the certainty of this spatial relation is 0%, it is determined that it is not necessary to add this relation to Set N and thus the operation is terminated (Lines 2~3). Otherwise, it determines what spatial relation existed previously between “a” and “b” from Set N. If an existing spatial relation is not found, relation V
a
b is added to Set N (Lines 4~6). If an existing spatial relation is found, the high-certainty spatial relations are derived through the intersection of the existing spatial relations and V
a
b. The high-certainty spatial relations are added to Set N and the existing spatial relations are removed. However, if the above intersection is an empty set, which means that the consistency is not met between the existing spatial relations and new spatial relations, inconsistency of the spatial relations is returned (Lines 7~15). For example, where the directional relation of (A [N, E] B) between two spaces “A” and “B” exists in the existing Set N, and a new directional relation of (A [N, NE] B) is to be added to it, the high-certainty spatial relation (X
a
b), which is (A N B), is derived through an intersection between the two. Finally, X
b
a, which is an inverse relation of X
a
b, is added to Set N using a recursive call of the function.Algorithm 4:Algorithm for adding new relations.
AddRelations(N, V
a
b)
(1)require  N, V
a
b relation
(2)if  V = ℣
then
(3)return
(4)W
a
b
←
{
R
i
j
∣
i
=
a, j = b, R
i
j
∈
N
}
(5)if  ∄  W
a
b  then
(6)X
a
b
←
V
a
b
(7)else
(8)X
a
b
←
V
a
b
∩
W
a
b
(9)if  X
a
b = ∅  then
(10)consistency = false
(11)return
(12)if  W
a
b = X
a
b  then
(13)return
(14)N
←
N
∖
{
W
a
b
}
(15)N
←
N
∪
{
X
a
b
}
(16)addRelations(N, X
b
a)The spatial reasoning algorithm, in which a cross-consistency check step is extended in this paper, has three advantages compared to existing spatial reasoning algorithms. First, the amount of knowledge derived from inference increases. For example, in “LA is located northwest of San Diego (LA NW SD)” where spatial knowledge from a directional viewpoint exists although spatial knowledge of the topological viewpoint between LA and San Diego is not indicated, the following knowledge can be inferred using the conversion table (LA [DC, EC, PO] SD). Moreover, the certainty of the inferred knowledge increases. For example, the following two cases “LA is located southeast or identical of San Francisco (LA [SE, O] SF)” where the spatial knowledge of the direction viewpoint exists and “LA and San Francisco are separated (LA DC SF)” where the spatial knowledge of the topological viewpoint exists are assumed. Here, certainty can be added to the spatial knowledge of uncertainty from a directional viewpoint using the cross-consistency check (LA SE SF). Finally, additional validation on incorrect spatial knowledge can be performed. For example, let us assume that “San Francisco is located northwest of San Diego (SF NW SD)” where the spatial knowledge from a directional viewpoint exists and “San Francisco contains San Diego (SF TPPi SD)” where spatial knowledge from a topological viewpoint exists. Here, using the cross-consistency check, incorrect spatial knowledge can be detected.


## 3. Implementation and Application

### 3.1. Implementation

Based on the spatial reasoning algorithm presented before, a qualitative spatial reasoner was implemented using the Java programming language. As shown in Figure4, the reasoner consists of a spatial reasoning engine that derives new pieces of spatial knowledge from existing knowledge bases and a pellet-reasoning engine that derives new pieces of RDF/OWL knowledge. The spatial reasoning engine is then composed of a path-consistency checker and a cross-consistency checker. The former is responsible for consistency checking of the spatial relations sets CSD-9 and RCC-8, respectively.Figure 4
The qualitative spatial reasoner.The latter is responsible for cross-consistency checking between them. Previously defined composition and conversion tables are used to perform the consistency check. The knowledge base is divided into CSD-9/RCC-8 spatial relations and general RDF/OWL relations using a knowledge parser. The CSD-9/RCC-8 spatial relations are utilized to derive new spatial relations via the consistency check of the spatial reasoning engine. The general RDF/OWL relations are utilized to derive new RDF/OWL relations using the pellet-reasoning engine.The architecture of the query-processing engine for response to spatial queries is shown in Figure5. When a user submits a SPARQL-type spatial query including one or more spatial relations to the query-processing engine, it is transferred to the spatial query processor using a query parser. The spatial query processor attempts to determine an answer to the query using the spatial reasoning engine and obtains intermediate solutions for the spatial query. Then, the general RDF/OWL query processor seeks a solution to the query using the pellet-reasoning engine. The solution is combined with the spatial query processing results that are then returned to the user.Figure 5
The query processing engine.


### 3.2. Application

In order to investigate the applicability of our spatial reasoner, we construct a sample spatial knowledge base using an ontology editor called Protégé. This spatial knowledge base contains some geographic information on the United States of America (USA), consisting of a total of nine classes, 127 individuals, and 1,900 spatial statements. Table4 shows the number of individuals included in the sample knowledge base.Table 4
Number of individuals for each class.
Continent
Country
State
County
City
1
3
42
30
34
Ocean
Mountain
Lake
River
2
2
7
6More than 80% of the individuals consist of states, counties, and cities. Several mountains, lakes, and rivers are also included to represent various pieces of spatial knowledge.Figure6 shows an example of the spatial knowledge. It is represented in the RDF statements. Each statement describes the ID, class type, name, description, and spatial relationships of the CSD-9/RCC-8 with other individuals.Figure 6
Example of spatial knowledge.Figure7 shows a screenshot of the geographic information system explorer using the spatial reasoner and spatial knowledge base. A user can select a region on the left side of the screen. The right side of the screen is configured for a user to select a spatial property to query the selected region in the Google map. For example, the query “Where is a place that is bordered by Texas and is located northwest of Texas?” would respond with “New Mexico.”Figure 7
A screenshot of the GIS Explorer.


## 3.1. Implementation

Based on the spatial reasoning algorithm presented before, a qualitative spatial reasoner was implemented using the Java programming language. As shown in Figure4, the reasoner consists of a spatial reasoning engine that derives new pieces of spatial knowledge from existing knowledge bases and a pellet-reasoning engine that derives new pieces of RDF/OWL knowledge. The spatial reasoning engine is then composed of a path-consistency checker and a cross-consistency checker. The former is responsible for consistency checking of the spatial relations sets CSD-9 and RCC-8, respectively.Figure 4
The qualitative spatial reasoner.The latter is responsible for cross-consistency checking between them. Previously defined composition and conversion tables are used to perform the consistency check. The knowledge base is divided into CSD-9/RCC-8 spatial relations and general RDF/OWL relations using a knowledge parser. The CSD-9/RCC-8 spatial relations are utilized to derive new spatial relations via the consistency check of the spatial reasoning engine. The general RDF/OWL relations are utilized to derive new RDF/OWL relations using the pellet-reasoning engine.The architecture of the query-processing engine for response to spatial queries is shown in Figure5. When a user submits a SPARQL-type spatial query including one or more spatial relations to the query-processing engine, it is transferred to the spatial query processor using a query parser. The spatial query processor attempts to determine an answer to the query using the spatial reasoning engine and obtains intermediate solutions for the spatial query. Then, the general RDF/OWL query processor seeks a solution to the query using the pellet-reasoning engine. The solution is combined with the spatial query processing results that are then returned to the user.Figure 5
The query processing engine.


## 3.2. Application

In order to investigate the applicability of our spatial reasoner, we construct a sample spatial knowledge base using an ontology editor called Protégé. This spatial knowledge base contains some geographic information on the United States of America (USA), consisting of a total of nine classes, 127 individuals, and 1,900 spatial statements. Table4 shows the number of individuals included in the sample knowledge base.Table 4
Number of individuals for each class.
Continent
Country
State
County
City
1
3
42
30
34
Ocean
Mountain
Lake
River
2
2
7
6More than 80% of the individuals consist of states, counties, and cities. Several mountains, lakes, and rivers are also included to represent various pieces of spatial knowledge.Figure6 shows an example of the spatial knowledge. It is represented in the RDF statements. Each statement describes the ID, class type, name, description, and spatial relationships of the CSD-9/RCC-8 with other individuals.Figure 6
Example of spatial knowledge.Figure7 shows a screenshot of the geographic information system explorer using the spatial reasoner and spatial knowledge base. A user can select a region on the left side of the screen. The right side of the screen is configured for a user to select a spatial property to query the selected region in the Google map. For example, the query “Where is a place that is bordered by Texas and is located northwest of Texas?” would respond with “New Mexico.”Figure 7
A screenshot of the GIS Explorer.


## 4. Experiment

An experiment was conducted to evaluate the performance of the spatial reasoning algorithm proposed in this paper using the spatial reasoner and spatial knowledge base described previously. In each experiment, the performances of the CHOROS mode spatial reasoning algorithm (CSD/RCC) that performs only path consistency on CSD-9 and RCC-8 and the proposed algorithm (CSD/RCC+CC) that introduces the cross-consistency check in addition to the CSD/RCC were compared.In the first experiment, the two algorithms were compared in terms of the amount of new knowledge derived from the inference results from a quantitative aspect. The experiment result is shown in Figure8. The graphs clearly demonstrate that the volume of new knowledge generated by the reasoning algorithm (CSD/RCC+CC) proposed in this paper has increased to a substantially greater extent, compared to the CHOROS mode spatial reasoning algorithm (CSD/RCC), as the scale of spatial knowledge base increases according to the reasoning inputted. This result indicates that the proposed algorithm is considerably better in terms of inference capability that derives new knowledge compared to the CHOROS mode algorithm.Figure 8
Number of inferred facts.In the second experiment, the two algorithms were compared in terms of reasoning response time. The experiment result is shown in Figure9. As shown in the figure, the proposed spatial reasoning algorithm (CSD/RCC+CC) reasoning response time increased faster compared to the CHOROS mode spatial reasoning algorithm (CSD/RCC) as the size of the spatial knowledge base increased. This result can be explained by the following. First, the proposed algorithm requires more computation effort for the cross-consistency check compared to the CHOROS mode algorithm. Further, as the amount of spatial knowledge derived from inference increases, the composition and conversion between items of knowledge must be performed more frequently. As a result the total number of iterations performed by the algorithm increases.Figure 9
Reasoning time.In the third experiment, the two algorithms were compared in terms of certainty of the inferred knowledge. The experiment result is shown in Figure10. Certainty of the inferred knowledge was measured by a ratio of defined relations to the derived relations. As shown in the figure, the proposed spatial reasoning algorithm (CSD/RCC+CC) had a higher level of certainty than the CHOROS mode spatial reasoning algorithm (CSD/RCC). This result shows that the proposed algorithm has superior inference capability compared to the CHOROS mode algorithm even though more pieces of knowledge were derived.Figure 10
Ratio of defined relations.


## 5. Conclusion

CSD- (cone-shaped directional-) 9 and RCC- (region connection calculi-) 8 are well-known qualitative spatial formalisms for representing and reasoning about the directional and the topological relationships between spatial entities. Based upon CSD-9 and RCC-8, we proposed an efficient algorithm for reasoning about directional and topological relationships between spatial entities. In contrast to previous ones, our spatial reasoning algorithm contains not only path-consistency checking over the CSD-9 directional or RCC-8 topological relation set, but also cross-consistency checking between two different sets, to produce the complete entailments. In order to investigate the applicability of our spatial reasoner, we developed a geographic information system (GIS) explorer as an application. In this application, our reasoner performs effectiveknowledge materialization to enrich the initial spatial knowledge base and then to enable more rich answers provided to the given queries. We also ensured the high performance of our spatial reasoner through quantitative experiments performed on a large knowledge base. In the experiments, our reasoner showed better inference capability that derives new knowledge compared to the existing ones, such as CHOROS.In future, our research highlights would be focused on the following points. On the one hand, we will optimize and scale up our spatial reasoner so as to further improve the performance. On the other hand, our system will be extended for many useful applications such as knowledge management [11], Semantic Web [12, 13], geographical information systems (GIS) [14], intelligent tutoring [15], robot navigation, and spatial planning.



---

*Source: 902043-2015-07-26.xml*