Advanced Modeling and Services Based Mathematics for Ubiquitous Computing
View this Special IssueResearch Article  Open Access
Qualitative Spatial Reasoning with Directional and Topological Relations
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 crossconsistency between the directional and the topological relation set. They provide only the checking function for pathconsistency 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 pathconsistency within each directional or topological relation set, but also provides the checking function for crossconsistency 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.
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 (coneshaped directional) 9 [5] and RCC (region connection calculi) 8 [6] are wellknown 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 RCC8 topological and CSD9 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 pathconsistency in a RCC8 topological relation set. CHOROS is an extension of PelletSpatial to add CSD9 directional reasoning facility. However, all these existing spatial reasoners share a common limitation that they do not provide any checking functions for crossconsistency between the CSD9 directional relation set and the RCC8 topological relation set. They provide only the checking function for pathconsistency within a directional or topological relation set.
In this paper, we present an efficient spatial reasoning algorithm working on a mixture of CSD9 directional and RCC8 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 pathconsistency within each directional or topological relation set, but also provides the checking function for crossconsistency 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 webstandard ontology language. Each location covered by the knowledge base is defined as an element that belongs to the GeoInstance class.
Figure 1 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 CSD9 and RCC8. 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).
The spatial reasoning of CSD9 and RCC8 assumes a knowledge type that represents relations between spaces. The CSD (coneshaped directional) 9 theory assumes that a direction relation between two arbitrary points on a twodimensional 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 Figure 2.
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 Figure 3. That is, the CSD9 spatial knowledge expresses a directional relation between two spaces in terms of points whereas the RCC8 spatial knowledge expresses a relation of boundary and containment between two spaces in terms of regions. Most realworld spaces or locations can be interpreted as either a single point or single region that represents multifaceted characteristics. Thus, CSD9 and RCC8 spatial knowledge can be utilized complementarily to express and infer diverse relations between realworld spaces.
2.2. Spatial Inference Rule
The CSD9 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 Table 1.

Table 1 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 RCC8 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).

Inherently, CSD9 and RCC8 are independent theories that provide distinct spatial knowledge representations and inference methods from a different viewpoint. However, as explained earlier, in many realworld spaces and locations, it is necessary that the directional relations of CSD9 and containment relations of RCC8 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 RCC8 containment relations from the facts that represent the CSD9 directional relations or whether the inference must be produced conversely. In this paper, the conversion rules between CSD9 and RCC8 relations were determined via analysis of a special knowledge base representing various cases as shown in Table 3. In Table 3, a single fact that represents a CSD9 O relation suggests a fact that satisfies one relation from {EQ, PO, TPP, NTPP, TPPi, NTPPi} of the RCC8 relations. Similarly, an item that represents CSD9 relations of {N, NE, E, SE, S, SW, W, NW} suggests that one of the RCC8 relations {DC, EC, PO} can be satisfied. Conversely, relations of {EQ, PO, TPP, NTPP, TPPi, NTPPi} from RCC8 suggest a CSD9 O relation. Relations of {DC, EC, PO} from RCC8 suggest that one of the CSD9 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.

2.3. Spatial Reasoning Algorithm
In this paper, we design a spatial reasoning algorithm based on the spatial inference rules summarized in Tables 1, 2, and 3.
Algorithm 1 summarizes the overall process of the spatial reasoning algorithm. This algorithm consists of detailed steps that check the consistency of Set of CSD9 and RCC8 spatial relations contained in the knowledge base. If Set is an empty set or all spatial relations satisfy consistency, the algorithm is terminated successfully (Lines 1~4). The inverseComplete() and equalsComplete() steps process 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(, ) and IsCrossConsistent(, ) are performed iteratively based on the spatial relation . If an inconsistency of the knowledge base is detected, inference is interrupted (Lines 7~11). IsPathConsistent(, ) performs a pathconsistency check on the relation sets of CSD9 and RCC8 using Tables 1 and 2, respectively. And then IsCrossConsistent(, ) performs the crossconsistency checks between CSD9 and RCC8 relations using Table 3.

Algorithm 2 shows the IsPathConsistent(, ) algorithm, which performs a pathconsistency check on the relation sets of CSD9 and RCC8 based on relation , respectively. If the isCSDRelation() step returns the result that is CSD9 knowledge, all the items of the CSD9 knowledge from Set are stored in Set , while all items of the RCC8 knowledge from Set are stored in Set (Lines 3~6). Then, the composeRelations(, ) and AddRelations(, ) steps are performed iteratively with regard to the items of knowledge () that enable composition inference with from . During the composeRelations(, ) step, a new spatial relation is derived through the compositioninference process of and as mentioned in Section 2.2. Next, during the AddRelations(, ) step, while a new spatial relation is stored in Set , it is determined whether a new spatial relation satisfies the consistency with the existing relations (Lines 7~12). Using the pathconsistency check, a new spatial relation is derived that can be composed from the existing spatial relations.

Algorithm 3 shows the IsCrossConsistent(, ) algorithm that performs the crossconsistency check between the relations of CSD9 and RCC8 based on the relation . During the convertRelation() step, new crossspatial relations are derived from the implications of the single spatial relation 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 containing the newly derived spatial relations is integrated to Set through AddRelations(, ) followed by another consistency check (Lines 4~6).

Algorithm 4 shows the AddRelations(, ) algorithm that adds relation to Set of the spatial relations and simultaneously checks the consistency between the relations. Relation 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 and thus the operation is terminated (Lines 2~3). Otherwise, it determines what spatial relation existed previously between “a” and “b” from Set . If an existing spatial relation is not found, relation is added to Set (Lines 4~6). If an existing spatial relation is found, the highcertainty spatial relations are derived through the intersection of the existing spatial relations and . The highcertainty spatial relations are added to Set 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 , and a new directional relation of (A [N, NE] B) is to be added to it, the highcertainty spatial relation (), which is (A N B), is derived through an intersection between the two. Finally, , which is an inverse relation of , is added to Set using a recursive call of the function.

The spatial reasoning algorithm, in which a crossconsistency 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 crossconsistency 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 crossconsistency 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 Figure 4, the reasoner consists of a spatial reasoning engine that derives new pieces of spatial knowledge from existing knowledge bases and a pelletreasoning engine that derives new pieces of RDF/OWL knowledge. The spatial reasoning engine is then composed of a pathconsistency checker and a crossconsistency checker. The former is responsible for consistency checking of the spatial relations sets CSD9 and RCC8, respectively.
The latter is responsible for crossconsistency checking between them. Previously defined composition and conversion tables are used to perform the consistency check. The knowledge base is divided into CSD9/RCC8 spatial relations and general RDF/OWL relations using a knowledge parser. The CSD9/RCC8 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 pelletreasoning engine.
The architecture of the queryprocessing engine for response to spatial queries is shown in Figure 5. When a user submits a SPARQLtype spatial query including one or more spatial relations to the queryprocessing 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 pelletreasoning engine. The solution is combined with the spatial query processing results that are then returned to the user.
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. Table 4 shows the number of individuals included in the sample knowledge base.

More 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.
Figure 6 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 CSD9/RCC8 with other individuals.
Figure 7 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.”
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 CSD9 and RCC8 and the proposed algorithm (CSD/RCC+CC) that introduces the crossconsistency 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 Figure 8. 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.
In the second experiment, the two algorithms were compared in terms of reasoning response time. The experiment result is shown in Figure 9. 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 crossconsistency 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.
In the third experiment, the two algorithms were compared in terms of certainty of the inferred knowledge. The experiment result is shown in Figure 10. 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.
5. Conclusion
CSD (coneshaped directional) 9 and RCC (region connection calculi) 8 are wellknown qualitative spatial formalisms for representing and reasoning about the directional and the topological relationships between spatial entities. Based upon CSD9 and RCC8, 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 pathconsistency checking over the CSD9 directional or RCC8 topological relation set, but also crossconsistency 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 effective knowledge 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.
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
Acknowledgment
This work was supported by the IT R&D program of MSIP/KEIT (10044494, WiseKB: Big data based selfevolving knowledge base and reasoning platform).
References
 O. Akcay and O. Altan, “Spatial relations and inferences for context aware visualization,” in Proceedings of the 14th International Symposium for Spatial Data Handling, pp. 484–486, 2010. View at: Google Scholar
 I. Seifert, S. Bertel, and T. Barkowsky, “Assistance for spatiotemporal planning in ubiquitous computing environments based on mental models,” in Proceedings of the International Workshop on Artificial Intelligence in Mobile Systems, pp. 9–14, 2004. View at: Google Scholar
 F. Dylla and M. Bhatt, “Qualitative spatial scene modeling for ambient intelligence environments,” in Proceedings of the 1st International Conference on Intelligent Robotics and Applications, pp. 716–725, 2008. View at: Google Scholar
 J. Chen, A. G. Cohn, D. Liu, S. Wang, J. Ouyang, and Q. Yu, “A survey of qualitative spatial representations,” The Knowledge Engineering Review, vol. 30, no. 1, pp. 106–136, 2015. View at: Publisher Site  Google Scholar
 D. J. Peuquet and Z. CiXiang, “An algorithm to determine the directional relationship between arbitrarilyshaped polygons in the plane,” Pattern Recognition, vol. 20, no. 1, pp. 65–74, 1987. View at: Publisher Site  Google Scholar
 J. Renz, “Maximal tractable fragments of the region connection calculus: a complete analysis,” in Proceedings of the 16th International Joint Conference on Artificial Intelligence (IJCAI '99), pp. 448–454, August 1999. View at: Google Scholar
 S. Batsakis and E. G. Petrakis, “SOWL: a framework for handling spatiotemporal information in OWL 2.0,” in Proceedings of the 5th International Symposium on RuleBased Reasoning, Programming, and Applications (RuleML '11), pp. 242–249, 2011. View at: Google Scholar
 M. Stocker and E. Sirin, “PelletSpatial: a hybrid RCC8 and RDF/OWL reasoning and query engine,” in Proceedings of the 6th International Workshop on OWL Experiences and Directions, 2009. View at: Google Scholar
 G. Christodoulou, E. G. Petrakis, and S. Batsakis, “Qualitative spatial reasoning using topological and directional information in OWL,” in Proceedings of IEEE the 24th International Conference on Tools with Artificial Intelligence, pp. 596–602, 2012. View at: Google Scholar
 I. Horrocks, P. F. PatelSchneider, H. Boley, S. Tabet, B. Grosof, and M. Dean, “SWRL: a semantic web rule language combining OWL and RuleML,” W3C member submission , 2004. View at: Google Scholar
 M. Brahami, B. Atmani, and N. Matta, “Dynamic knowledge mapping guided by data mining: application on healthcare,” Journal of Information Processing Systems, vol. 9, no. 1, pp. 1–30, 2013. View at: Publisher Site  Google Scholar
 H. Hsueh, C. Chen, and K. Huang, “Generating metadata from web documents: a systematic approach,” HumanCentric Computing and Information Sciences, vol. 3, no. 7, pp. 1–17, 2013. View at: Publisher Site  Google Scholar
 R. Y. Shtykh and Q. Jin, “A humancentric integrated approach to web information search and sharing,” HumanCentric Computing and Information Sciences, vol. 1, no. 2, pp. 1–37, 2011. View at: Publisher Site  Google Scholar
 S.Y. Noh and S. K. Gadia, “A model comparison for spatiotemporal data in ubiquitous environments: a case study,” Journal of Information Processing Systems, vol. 7, no. 4, pp. 635–652, 2011. View at: Publisher Site  Google Scholar
 E. Elsayed, K. Eldahshan, and S. Tawfeek, “Automatic evaluation technique for certain types of open questions in semantic learning systems,” HumanCentric Computing and Information Sciences, vol. 3, article 19, 2013. View at: Publisher Site  Google Scholar
Copyright
Copyright © 2015 Sangha Nam and Incheol Kim. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.