Qualitative Spatial Reasoning with Directional and Topological Relations

Awiderangeofapplicationdomainsfromcognitiveroboticstointelligentsystemsencompassingdiverseparadigmssuchasambientintelligenceandubiquitouscomputingenvironmentsrequiretheabilitytorepresentandreasonaboutthespatialaspectsoftheenvironmentwithinwhichanagentorasystemisfunctional .Manyexistingspatialreasonersshareacommonlimitationthatthey donotprovideanycheckingfunctionsforcross-consistencybetweenthedirectionalandthetopologicalrelationset.Theyprovide onlythecheckingfunctionforpath-consistencywithinadirectionalortopologicalrelationset.Thispaperpresentsanefficient spatialreasoningalgorithmworkingonamixtureofdirectionalandtopologicalrelationsbetweenspatialentitiesandthenexplains theimplementationofaspatialreasonerbasedontheproposedalgorithm.Ouralgorithmnotonlyhasthecheckingfunctionfor path-consistencywithineachdirectionalortopologicalrelationset,butalsoprovidesthecheckingfunctionforcross-consistency betweenthem.Thispaperalsopresentsanapplicationsystemdevelopedtodemonstratetheapplicabilityofthespatialreasoner andthenintroducestheresultsoftheexperimentcarriedouttoevaluatetheperformanceofourspatialreasoner.


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 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.

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.
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 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).
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 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 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.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 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).Inherently, 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 Table 3.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.

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 CSD-9 and RCC-8 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 path-consistency check on the relation sets of CSD-9 and RCC-8 using Tables 1 and 2, respectively.And then IsCrossConsistent(,   ) performs the crossconsistency checks between CSD-9 and RCC-8 relations using Table 3.
Algorithm 2 shows the IsPathConsistent(,   ) algorithm, which performs a path-consistency check on the relation sets of CSD-9 and RCC-8 based on relation   , respectively.If the isCSDRelation(  ) step returns the result that   is CSD-9 knowledge, all the items of the CSD-9 knowledge from Set  are stored in Set , while all items of the RCC-8 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 composition-inference 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 path-consistency 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 cross-consistency check between the relations of CSD-9 and RCC-8 based on the relation   .During the convertRelation(  ) step, new cross-spatial 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 high-certainty spatial relations are derived through the intersection of the existing spatial relations and   .The high-certainty 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 high-certainty 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 cross-consistency check IsCrossConsistent(,   ) (1) require  a set of relations,   ∈  (2) ensure   cross-consistent then true; else false (3)   ← convertRelation(  ) (4) (, consistency) ← addRelations(,   ) (5) if !consistency then (6) return false (7) return true Algorithm 3: Algorithm for checking cross-consistency.
(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.

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 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.
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 pelletreasoning engine.
The architecture of the query-processing engine for response to spatial queries is shown in Figure 5.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.

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 CSD-9/RCC-8 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."

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 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 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.
rdf:about="&spatial;101001011"> <rdf:type rdf:resource="&spatial;State"/> <spatial:hasName rdf:datatype="&xsd;string">California </spatial:hasName> <rdfs:comment>California</rdfs:comment> <spatial:westOf rdf:resource="&spatial;101001012"/> <spatial:disconnectedFrom rdf:resource="&spatial;101001016"/> <owl:NamedIndividual  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.

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 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.

Figure 7 :
Figure 7: A screenshot of the GIS Explorer.

Table 4 :
Number of individuals for each class.