Range Queries Involving Spatial Relations : A Performance Analysis Yannis Theodoridis + Department of Electrical and Computer Engineering National Technical University of Athens GREECE 15773 e-mail : theodor@theseas.ntua.gr tel : +30 -1 -7757401 fax : +30 -1 -7784578 Dimitris Papadias * Department of Computer Science and Engineering University of California , San Diego CA 92093-0114 , USA e-mail : dimitris@cs.ucsd.edu tel : +1 -619 -5344187 fax : +1 -619 -5347029 Abstract : Spatial relations are becoming an important aspect of spatial access methods because of the increasing interest on qualitative spatial information processing . In this paper we show how queries involving spatial relations can be transformed to range queries and implemented in existing DBMSs . We provide a performance analysis of B - and R - tree indexing methods to support such queries and we evaluate the analytical formulas using experimental results . The proposed analytical models for the expected retrieval cost of spatial relations are proved to be good guidelines for a spatial query optimiser . + Yannis Theodoridis was partially supported by the Department of Research and Technology of Greece -LRB- PENED ? 91 -RRB- . * Dimitris Papadias was partially supported by NSF - IRI 9221276 . 1 . INTRODUCTION Spatial information is often processed qualitatively , using spatial relations , rather than absolute coordinates . -LSB- TM95 -RSB- describe an example of a computerised system for coordinating first-aid vehicles that uses qualitative spatial constraints to navigate vehicles . Additional cases where spatial relations can be used to solve practical problems involving spatial information can be found in -LSB- PS94 -RSB- . As a result , the formalization , representation and processing of spatial relations has become important for user interfaces and query optimization strategies in Geographic Information Systems -LSB- Fran95 -RSB- , -LSB- CSE95 -RSB- . The significance of spatial relations has also been pointed out by a number of researchers in Spatial and Image Databases , -LSB- PFK94 -RSB- , -LSB- SYH94 -RSB- . The most common types of spatial relations that have been used in geographic applications include topological , direction and distance relations . Topological relations deal with concepts of connectedness and inclusion . According to the 4 - intersection model -LSB- EF91 -RSB- , the most prevalent model in the GIS literature , eight pairwise disjoint relations can be defined using the four intersections between objects ' boundaries and interiors : disjoint , meet , equal , overlap , contains , inside , covers , and covered-by . -LSB- Egen91 -RSB- extended the model by also including intersections among objects ' exteriors -LRB- 9-intersection model -RRB- . Tests with human subjects have shown that the intersection models have potential for defining cognitively meaningful spatial predicates , a fact that makes the above relations a good candidate for commercial systems -LSB- ME94 -RSB- . Direction relations -LRB- north , northeast -RRB- deal with order in space . Unlike the case of topological relations where the intersection models appear to be generally accepted definitions , there are no such definitions of direction relations -LRB- e.g. , is France north or northwest of Italy ? -RRB- . Although experimental findings from Cognitive and Environmental Psychology1 can be used as guidelines for the direction relations that people evoke in everyday reasoning , so far the psychological results are too vague to be helpful in defining direction relations in actual systems . Distance relations -LRB- e.g. , near , far -RRB- involve distance concepts . For example , two objects are assumed to be near if their distance -LRB- however distance is defined -RRB- is less than a predefined threshold . A form of queries closely related to distance , is the nearest neighbour queries -LRB- e.g. , find the 3 objects closest to a reference object -RRB- . The previous types of spatial relations have been studied both independently and in conjunction with each other . -LSB- Fran92 -RSB- , for instance , proposes a method for qualitative reasoning that combines direction with distance relations . Recently the interest about spatial relations has shifted towards Spatial Access Methods . The retrieval of spatial relations in existing DBMSs can be accomplished by maintaining traditional indexes -LRB- e.g. , B-trees2 -RRB- , or , alternatively , by incorporating Abstract Data Types -LRB- ADTs -RRB- with specialised indexes defined by external code -LRB- e.g. , R-trees -RRB- . Furthermore , when using extended-relational systems , like Postgres -LSB- SR86 -RSB- , both indexing methods are available -LRB- or easily included -RRB- and application developers can decide which is the most appropriate for their application needs . In particular , B-trees have been 1A survey and an experimental study regarding the use of direction relations in cognitive spatial reasoning at geographic scales can be found in -LSB- Mark92 -RSB- . 2To be more precise , the implementation used in existing systems is the B + - tree index -LSB- Knut73 -RSB- and , in this paper , we will think of B + - trees when we use the term B-trees . used for the retrieval of direction relations -LSB- TPS95 -RSB- , and R-trees and their variations for direction relations -LSB- PTS94 -RSB- , topological relations -LSB- PTSE95 -RSB- and nearest neighbour queries -LSB- RKV95 -RSB- . In this paper we treat all queries involving spatial relations between region objects as range queries , and we provide an analysis for their performance . The advantage of treating spatial relations as range queries is that we can use well known results to estimate the expected performance . Our work constitutes the first attempt to model the performance of spatial relations since previous work has focused on window queries -LRB- retrieval of objects that share common points with a given object or area -RRB- . The proposed formulas can be used as guidelines by the query optimisers of database systems that support spatial relations , in order to estimate the cost of spatial queries . The paper is organised as follows : In section 2 we describe a set of `` representative '' relations and we demonstrate how they can be retrieved using B - and R-trees . In section 3 we provide analytical models that estimate the performance of each method . Section 4 evaluates the models of section 3 using experimental tests , and section 5 concludes the paper . 2 . RETRIEVAL OF SPATIAL RELATIONS In this paper we will focus on the direction relations east and northeast , the topological relations meet and inside , and some distance relations . For these relations we provide a brief description , we demonstrate their retrieval using MBRs and we outline implementations in spatial data structures . The extension of the results to other relations is straightforward . 2.1 Spatial Relations The relation east -LRB- p , q -RRB- means that the x - coordinates of all points of object p -LRB- primary object3 -RRB- are larger than or equal to the x - coordinates of all points of object q -LRB- reference object -RRB- . That is , the primary object -LRB- p -RRB- must be in the grey area of Figure 1a . Similarly , northeast -LRB- p , q -RRB- means that the x - and y - coordinates of all points of object p are larger than or equal to the x - and y - coordinates of all points of object q -LRB- Figure 1b -RRB- . The relations meet and inside have their usual meaning according to the 4 - intersection model -LRB- Figure 1c , 1d -RRB- . q p q p q p q p east -LRB- p , q -RRB- northeast -LRB- p , q -RRB- meet -LRB- p , q -RRB- inside -LRB- p , q -RRB- Fig. 1 Topological and direction relations In order to define distance relations between objects we will start from distances between points . The distance between two points -LRB- pp_dist -RRB- pi -LRB- pi ? p -RRB- and qj -LRB- qj ? q -RRB- is defined according to the Euclidean metric : pp_dist -LRB- pi , qj -RRB- = -LRB- -RRB- -LRB- -RRB- _ _ _ _ p q p q i x j x i y j y - - 2 2 + -LRB- where pi-x is the x - coordinate of 3The term primary object denotes the object to be located and the term reference object denotes the object in relation to which the primary object is located . point pi , pi-y is the y - coordinate of point pi , and so on -RRB- . Using the distance between points , we define the distance between point pi and object q -LRB- po_dist -RRB- as the minimum distance of pi from any point of q : po_dist -LRB- pi , q -RRB- = min -LRB- pp_dist -LRB- pi , qj -RRB- , '' qj ? q -RRB- . Finally we define the distance from object p to object q as the maximum of all po_distances from the points of p to q : oo_dist -LRB- p , q -RRB- = max -LRB- po_dist -LRB- pi , q -RRB- , '' pj ? p -RRB- . Using the above definitions of distances we define the qualitative relation near as : near -LRB- p , q , k -RRB- ? oo_dist -LRB- p , q -RRB- ? k , that is , all points of p must be within k distance from some point of object q -LRB- Figure 2a -RRB- . Similarly , the relation about -LRB- p , q , k1 , k2 -RRB- , where < k1 < k2 , can be defined as : about -LRB- p , q , k1 , k2 -RRB- ? near -LRB- p , q , k2 -RRB- ? ? $ pi -LRB- po_dist -LRB- pi , q -RRB- ? k1 -RRB- . That is , according to Figure 2b , all points of p are within distance k1 and k2 . q p k k k k q p k2k1 near -LRB- p , q , k -RRB- about -LRB- p , q , k1 , k2 -RRB- Fig. 2 Distance relations We will also consider conjunctions of spatial relations . Figure 3a illustrates a configuration that corresponds to the relation northeast -LRB- p , q -RRB- ? near -LRB- p , q , k -RRB- , while Figure 3b illustrates a configuration for east -LRB- p , q -RRB- ? meet -LRB- p , q -RRB- . q p k k q p northeast -LRB- p , q -RRB- ? near -LRB- p , q , k -RRB- east -LRB- p , q -RRB- ? meet -LRB- p , q -RRB- Fig. 3 Conjunctions of spatial relations Spatial access methods usually store approximations of objects that need only a few points for their representation instead of the objects themselves . Such approximations are used to efficiently retrieve candidates that could satisfy a query . In the next subsection we show how Minimum Bounding Rectangle -LRB- MBR -RRB- approximations can be used in the retrieval of spatial relations . 2.2 Minimum Bounding Rectangles MBRs have been used extensively to approximate objects in Spatial Data Structures and Spatial Reasoning because they need only four numbers for their representation ; in particular , each object p is represented by the four numbers : p ` l-x , p ` l-y , p ` u-x , p ` u-y , where p ` l-x stands for the x - coordinate of the lower/left point of MBR p ' , p ` l-y for the y - coordinate of the lower/left point , p ` u-x for the x - coordinate of the upper/right point and p ` u-y stands for the y - coordinate of the upper/right point . Since the MBRs are only approximations of the actual objects , the spatial relation between MBRs does not necessarily coincide with the spatial relation between the objects . In most cases the MBRs of objects that satisfy a given relation , should satisfy a number of possible relations with respect to the MBR of the reference object . For example , the MBRs of objects that meet a reference object can be related by any topological relation but disjoint -LSB- PTSE95 -RSB- . Figure 4 illustrates three configurations where the MBRs satisfy the relations overlap , meet and contain and the actual objects meet . q p q p p q overlap -LRB- p ' , q ' -RRB- meet -LRB- p ' , q ' -RRB- contains -LRB- p ' , q ' -RRB- Fig. 4 Some configurations of MBRs for which the actual objects meet Furthermore , it can be concluded from Figures 1 , 2 and 3 that all the relations constrain some or all points of the primary MBR to a range -LRB- subdivision -RRB- of space . In case of east , for example , all points of p ' must be in the right semi-plane as defined by the vertical line that passes from q 's eastern boundary . In some cases all the points of the MBRs to be retrieved must be within the range -LRB- e.g. , east -RRB- and this is a sufficient condition for retrieval . In some other cases the range is not a sufficient condition and more specific constraints hold -LRB- e.g. , east ? meet has the same range as east but in this case the MBRs should also meet -RRB- . In general , in order to answer the query `` find all objects p that satisfy the relation R with respect to an object q '' we have to retrieve all MBRs p ' that satisfy certain range constraints with respect to the MBR q ' of object q. Table 1 illustrates the mapping from spatial relations R between actual objects to constraints between MBR coordinates . Although the constraints for east and northeast relations are trivial , the rest require some careful study in order to be clearly understood . For example , the constraints for meet state that the two MBRs may not be disjoint but permits any other topological relation between them , because any not disjoint MBRs may contain objects that meet -LRB- e.g. , Figure 4 -RRB- . Relation Constraints on the p ` l-x , p ` l-y , p ` u-x , p ` u-y parameters with respect to the reference MBR q ' east -LRB- p , q -RRB- p ` l-x ? q ` u-x northeast -LRB- p , q -RRB- -LRB- p ` l-y ? q ` u-y -RRB- ? -LRB- p ` l-x ? q ` u-x -RRB- meet -LRB- p , q -RRB- -LRB- p ` l-y ? q ` u-y -RRB- ? -LRB- p ` u-y ? q ` l-y -RRB- ? -LRB- p ` l-x ? q ` u-x -RRB- ? -LRB- p ` u-x ? q ` l-x -RRB- inside -LRB- p , q -RRB- -LRB- q ` l-y < p ` l-y < q ` u-y -RRB- ? -LRB- q ` l-y < p ` u-y < q ` u-y -RRB- ? -LRB- q ` l-x < p ` l-x < q ` u-x -RRB- ? -LRB- q ` l-x < p ` u-x < q ` u-x -RRB- near -LRB- p , q , k -RRB- -LRB- q ` l-y-k ? p ` l-y ? q ` u-y + k -RRB- ? -LRB- q ` l-y-k ? p ` u-y ? q ` u-y + k -RRB- ? -LRB- q ` l-x-k ? p ` l-x ? q ` u-x + k -RRB- ? -LRB- q ` l-x-k ? p ` u-x ? q ` u-x + k -RRB- about -LRB- p , q , k1 , k2 -RRB- -LRB- q ` l-y-k2 ? p ` l-y ? q ` u-y + k2 -RRB- ? -LRB- q ` l-y-k2 ? p ` u-y ? q ` u-y + k2 -RRB- ? -LRB- q ` l-x-k2 ? p ` l-x ? q ` u-x + k2 -RRB- ? -LRB- q ` l-x-k2 ? p ` u-x ? q ` u-x + k2 -RRB- ? ? -LRB- -LRB- p ` l-y ? q ` u-y + k1 -RRB- ? -LRB- p ` u-y ? q ` l-y-k1 -RRB- ? -LRB- p ` l-x ? q ` u-x + k1 -RRB- ? -LRB- p ` u-x ? q ` l-x-k1 -RRB- -RRB- near -LRB- p , q , k -RRB- ? northeast -LRB- p , q -RRB- -LRB- q ` u-y ? p ` l-y ? q ` u-y + k -RRB- ? -LRB- q ` u-y ? p ` u-y ? q ` u-y + k -RRB- ? -LRB- q ` u-x ? p ` l-x ? q ` u-x + k -RRB- ? -LRB- q ` u-x ? p ` u-x ? q ` u-x + k -RRB- meet -LRB- p , q -RRB- ? east -LRB- p , q -RRB- -LRB- p ` l-x = q ` u-x -RRB- ? -LRB- p ` l-y < q ` u-y -RRB- ? -LRB- p ` u-y > q ` l-y -RRB- Table 1 Constraints for the retrieval of spatial relations using MBRs Because MBRs differ from the actual objects they enclose , they are not always adequate to express the relation between the actual objects . For this reason , spatial queries involve the following two step strategy : First a filter step based on MBRs is used to rapidly eliminate MBRs of objects that could not possibly satisfy the query and select a set of potential candidates . Then during a refinement step each candidate is examined -LRB- by using computational geometry techniques -RRB- and false hits are detected and eliminated . The relations meet and inside require a refinement step -LSB- PTSE95 -RSB- , while east and northeast do not -LSB- PTS94 -RSB- , that is , all MBRs enclose objects that satisfy the query . The distance relations may also need a refinement because near -LRB- p ' , q ' , k -RRB- does not necessarily imply near -LRB- p , q , k -RRB- and vice versa -LRB- the same is true for about -RRB- . If it is not the case that near -LRB- p ' , q ' , k -RRB- , but three out of four vertices of the primary MBR p ' are within k distance -LRB- po_dist -RRB- from q ' -LRB- and one vertex in po_dist > k -RRB- , then p ' may enclose an object that satisfies the relation near -LRB- p , q , k -RRB- -LRB- see Figure 5a -RRB- . Obviously , the same MBR may enclose an object that is not near and a refinement step is needed to make the distinction . If however , two vertices of p ' are further than k distance , then p can not be near -LRB- see Figure 5b -RRB- . This conclusion is based on the observation that each edge of the MBR coincides with at least one point of the enclosed object . If two vertices are further than distance k , it means that at least a whole edge -LRB- and therefore some point of the enclosed object -RRB- is further than k . In some cases it is also possible that the entire MBR is within distance k , but the objects are not near because some -LRB- or all -RRB- points of p are further than k from any point of q -LRB- Figure 5c -RRB- . Thus , the refinement step is needed for all MBRs p ' for which there exist points that are further than k from any point of q ' . Similarly , conjunctions of relations in which one relation needs a refinement step -LRB- northeast ? near , meet ? east -RRB- , also require refinement . k k k k q p k k k k q p k k k q p k k k not near -LRB- p ' , q ' , k -RRB- near -LRB- p , q , k -RRB- not near -LRB- p ' , q ' , k -RRB- not near -LRB- p , q , k -RRB- near -LRB- p ' , q ' , k -RRB- not near -LRB- p , q , k -RRB- Fig. 5 Configurations for which the MBRs satisfy the given constraint but the actual objects do n't In the rest of the section we will demonstrate how we can use existing data structures to retrieve spatial relations . 2.3 Implementation of Spatial Relations The first solution for the retrieval of direction relations includes the maintenance of a group of 4 alphanumeric indexes , such as B-trees . Each index corresponds to one of the four numbers : p ` l-x , p ` l-y , p ` u-x , p ` u-y . Obviously , some relations imply search on one B-tree while others imply search on more B - trees . For instance , the query `` find all objects p that are east of object q '' is transformed to the constraint p ` l-x ? q ` u-x -LRB- see Table 1 -RRB- which is a simple range query in the corresponding B-tree . On the other hand , most queries need to search two or more B-trees and , in a second phase , to compute the intersection of the intermediate answer sets -LRB- for details see -LSB- TPS95 -RSB- -RRB- . In general , the processing of a query of the form `` find all objects p that satisfy a given spatial relation with respect to object q '' using B-trees involves the following steps : Step 1 . Depending on the relation to be retrieved , select the B-trees involved from the set of four indexes . This procedure involves Table 1 . Step 2 . Search each index involved to find the corresponding answer sets . Step 3 . If more than one index is involved , find the intersection set4 . Step 4 . If necessary , follow a refinement step for the selected object IDs . The performance of the retrieval mechanism using B-trees depends significantly on the particular relation because the number of B-trees to be searched relies on the number of constraints that are involved in the definition of the relation . East , for example , involves only one constraint -LRB- p ` l-y ? q ` u-y , -RRB- , while near contains four constraints . As it will be shown later this fact significantly affects the efficiency of retrieval . Another data structure that is efficient for spatial relations is the R-tree . The R-tree -LSB- Gutt84 -RSB- is a height-balanced tree , which consists of intermediate and leaf nodes . The MBRs of the actual data objects are assumed to be stored in the leaf nodes of the tree . Intermediate nodes are built by grouping rectangles at the lower level . An intermediate node is associated with some rectangle which encloses all rectangles that correspond to lower level nodes . The fact that R-trees permit overlap among node entries sometimes leads to unsuccessful hits on the tree structure . The R + - tree -LSB- SRF87 -RSB- and the R * - tree -LSB- BKSS90 -RSB- methods have been proposed to address the problem of performance degradation caused by the overlapping regions or excessive dead-space respectively . In this paper we use R * - trees because we found them to have consistently better performance in the retrieval of spatial relations than both R - and R + - trees -LSB- PT94 -RSB- . In order to retrieve objects that satisfy a spatial relation with respect to a reference object we have to specify the MBRs that could enclose such objects using Table 1 and then to search the intermediate nodes that contain these MBRs . For instance , the intermediate nodes P that could contain MBRs p ' that satisfy the relation east with respect to q ' -LRB- p ` l-x ? q ` u-x -RRB- should satisfy the constraint Pu-x ? q ` u-x . Table 2 presents the constraints for the intermediate nodes for each direction relation of Table 1 . Notice that the same relation between intermediate nodes and the reference MBR holds for all the levels of the tree structure . 4A ? realistic ? assumption is that this procedure is executed in main memory . Relation Constraints for the intermediate Nodes P to be Searched with respect to the reference MBR q ' east -LRB- p , q -RRB- Pu-x ? q ` u-x northeast -LRB- p , q -RRB- -LRB- Pu-x ? q ` u-x -RRB- ? -LRB- Pu-y ? q ` u-y -RRB- meet -LRB- p , q -RRB- -LRB- Pl-y ? q ` u-y -RRB- ? -LRB- Pu-y ? q ` l-y -RRB- ? -LRB- Pl-x ? q ` u-x -RRB- ? -LRB- Pu-x ? q ` l-x -RRB- inside -LRB- p , q -RRB- -LRB- Pl-y < q ` u-y -RRB- ? -LRB- Pu-y > q ` l-y -RRB- ? -LRB- Pl-x < q ` u-x -RRB- ? -LRB- Pu-x > q ` l-x -RRB- near -LRB- p , q , k -RRB- -LRB- Pl-y ? q ` u-y + k -RRB- ? -LRB- Pu-y ? q ` l-y-k -RRB- ? -LRB- Pl-x ? q ` u-x + k -RRB- ? -LRB- Pu-x ? q ` l-x-k -RRB- about -LRB- p , q , k1 , k2 -RRB- -LRB- Pl-y ? q ` u-y + k2 -RRB- ? -LRB- Pu-y ? q ` l-y-k2 -RRB- ? -LRB- Pl-x ? q ` u-x + k2 -RRB- ? -LRB- Pu-x ? q ` l-x-k2 -RRB- ? ? -LRB- -LRB- q ` l-y-k1 ? Pl-y ? q ` u-y + k1 -RRB- ? -LRB- q ` l-y-k1 ? Pu-y ? q ` u-y + k1 -RRB- ? -LRB- q ` l-x-k1 ? Pl-x ? q ` u-x + k1 -RRB- ? -LRB- q ` l-x-k1 ? Pu-x ? q ` u-x + k1 -RRB- -RRB- near -LRB- p , q , k -RRB- ? northeast -LRB- p , q -RRB- -LRB- q ` l-y-k ? Pl-y ? q ` u-y + k -RRB- ? -LRB- Pu-y ? q ` u-y -RRB- ? -LRB- q ` l-x-k ? Pl-x ? q ` u-x + k -RRB- ? -LRB- Pu-x ? q ` u-x -RRB- meet -LRB- p , q -RRB- ? east -LRB- p , q -RRB- -LRB- Pl-y < q ` u-y -RRB- ? -LRB- Pu-y > q ` l-y -RRB- ? -LRB- Pl-x ? q ` u-x -RRB- ? -LRB- Pu-x > q ` u-x -RRB- Table 2 Constraints for intermediate nodes of R-trees In general , the processing of a query of the form `` find all objects p that satisfy a given spatial relation with respect to object q '' using R-trees involves the following steps : Step 1 . Starting from the top node , exclude the intermediate nodes P which could not enclose MBRs that satisfy the spatial relation and recursively search the remaining nodes . This procedure involves Table 2 . Step 2 . Among the leaf nodes retrieved , select the ones that satisfy the spatial relation . This procedure involves Table 1 . Step 3 . If necessary , follow a refinement step for the selected MBRs . Intuitively , R-trees perform better than B-trees in cases where many constraints are involved in the definition of the direction relation of interest . The next section provides a mathematical analysis that supports this argument . 3 . COST ANALYSIS In this section we provide analytical formulas that estimate the performance of B-trees and R-trees on the retrieval of spatial relations . Existing formulas for the expected performance of the above structures focus on traditional retrieval -LRB- matching queries on B-trees -LSB- Yao78 , Come79 , Bato81 -RSB- and overlap queries on R-trees -LSB- FSR87 , PSTW93 , FK94 -RSB- -RRB- . Our work extends previous work and estimates the expected cost -LRB- i.e. , number of disk accesses -RRB- for the retrieval of several types of spatial relations and combinations . In this discussion we assume that both data and query rectangles are uniformly distributed over the unit square address space . This is a reasonable assumption for large data sets randomly distributed over the work space . 3.1 . Analysis of B-trees As explained in section 2 , searching between one and four B-trees is necessary depending on the relation we want to retrieve . Each one of the involved constraints could be grouped in two categories : -LRB- a -RRB- exact matching constraints -LRB- e.g. , p ` l-y = q ` u-y -RRB- and -LRB- b -RRB- partial matching constraints -LRB- e.g. , p ` l-y > q ` u-y , q ` l-y < p ` l-y < q ` u-y -RRB- which are characterised by a range r -LRB- 0 ? r ? 1 -RRB- . If we suppose that the data keys are stored in a B-tree index of height h with L leaf nodes then the average cost C -LRB- r -RRB- for the retrieval of a constraint with range r is -LSB- Come79 -RSB- C r h r L -LRB- -RRB- = + ? -LRB- 1 -RRB- It is obvious that the exact matching constraint is a special case of partial matching constraint -LRB- r = 0 -RRB- . It is also clear that the cost for the retrieval of a relation is the sum of the costs for each constraint involved . In order to compute the expected cost C -LRB- r -RRB- for the retrieval of a constraint characterised by a range r we need to provide equations for the parameters of Eq . 1 , namely h , L , r. Suppose now that m is the maximum number of entries in a B-tree node , c is the average capacity of a node , and N is the total number of keys stored in the leaf nodes . We have the following equations -LSB- Bato81 -RSB- for the average h and L values in order to use them in Eq . 1 : h N m c m = + ? ?? ? ?? 1 log . -LRB- 2 -RRB- L N c m = ? -LRB- 3 -RRB- What remains in order to have a complete expression for Eq . 1 is the value of parameter r which depends on the particular constraint . If we assume that the size of a data object MBR is px . py and the size of a query object MBR is qx . qy then we can provide in Table 3 the values of parameters r according to possible constraints -LRB- the constraints refer only to x - coordinate since constraints for y - coordinate can be expressed in a similar way -RRB- . Constraint Average range r p ` l-x < q ` l-x or p ` u-x > q ` u-x r = -LRB- 1 - qx -RRB- / 2 q ` l-x < p ` l-x < q ` u-x or q ` l-x < p ` u-x < q ` u-x r = qx p ` l-x > q ` u-x or p ` u-x < q ` l-x r = -LRB- 1 - -LRB- 2 . px + qx -RRB- -RRB- / 2 p ` l-x < q ` u-x or p ` u-x > q ` l-x r = -LRB- 1 + qx -RRB- / 2 Table 3 Average values for range r of a constraint Using information from Table 3 and Eq . 2 and 3 we can estimate the expected cost for each constraint -LRB- see Eq . 1 -RRB- . Summing up , the expected cost C -LRB- R , k -RRB- for the retrieval of a spatial relation R with k constraints is : C R k C r h r L i i k i i k -LRB- , -RRB- -LRB- -RRB- -LRB- -RRB- = = + ? = = ? ? 1 1 -LRB- 4 -RRB- 3.2 . Analysis of R-trees Most of the work in the literature has dealt with the expected performance of R-trees for processing overlap queries i.e. , the retrieval of data objects p that share common area with a query window q . More particularly , let N be the total number of data objects indexed in a R-tree , h be the height of the tree , c the average node capacity at every level of the tree and m the maximum number of entries in a node . If we assume that the average node size at level j is nj , x . nj , y -LRB- the root is assumed at level j = h and the leaf-nodes at level j = 1 -RRB- and the average size of a query object MBR is qx . qy then the expected retrieval cost -LRB- number of disk accesses -RRB- of an overlap query using R-trees is -LSB- PSTW93 , FK94 -RSB- -LRB- -RRB- -LRB- -RRB- -LRB- -RRB- C q q N c m n q n q x y j j x x j y y j h -LRB- , -RRB- , , = ? ? + ? + ? ? ? ? ? ? = ? 1 -LRB- 5 -RRB- The expression for computing the height h of the R-tree is similar to that of B-trees -LRB- Eq . 2 -RRB- . If we name N j the number of nodes at level j , and d j the density5 of these nodes then the average node sizes nj , x and nj , y are given by the following equations -LSB- TS95 -RSB- : n n d N j x j y j j , , = = ? ? ? ? 12 -LRB- 6 -RRB- where -LRB- -RRB- -LRB- -RRB- d d c m j j = + - ? ? ? ? ?? ? ? ? ?? - 1 1 1 12 12 2 -LRB- 7 -RRB- and N N c m j j = ? -1 -LRB- 8 -RRB- Therefore , dj and Nj can be computed recursively using d0 and N0 which denote the density d and the amount N respectively of the data object MBRs . Qualitatively , this means that we can estimate the retrieval cost of a window query just with the knowledge of the data set and the query window . Since Eq . 5 expresses the expected performance of R-trees on overlap queries using a query window q , in order to estimate the retrieval cost of a spatial relation R -LRB- p , q -RRB- we need the following transformation : R -LRB- p , q -RRB- fi overlap -LRB- p ' , Q -RRB- . In other words , the retrieval of a spatial relation using R-trees is equivalent -LRB- in terms of cost -RRB- to the retrieval of an overlap query using an appropriate query window Q . The necessary transformation Q for each spatial relation R should take into consideration the corresponding constraint of the intermediate nodes because only these nodes are important when estimating the retrieval cost -LSB- PTSE95 -RSB- . For the spatial relations that we consider in this paper , the appropriate query windows Q are illustrated in Figure 6 . Each query window is an appropriate transformation of the corresponding constraints presented in Table 2 . Notice that meet and inside correspond to the same query window Q . This is a property that can be extracted by examining the constraints of Table 2 . The same property holds in our tests for near and about -LRB- if k = k2 -RRB- because , according to Table 2 , the constraints for the 5We define density of a set of objects as the sum of the object areas divided by the global area . intermediate nodes to be searched for about -LRB- p , q , k1 , k2 -RRB- are identical to the ones for near -LRB- p , q , k2 -RRB- plus some extra constraints which can be evaluated during the refinement step . q ' Q Q q ' q ' Q q ' Q east -LRB- p , q -RRB- northeast -LRB- p , q -RRB- meet -LRB- p , q -RRB- inside -LRB- p , q -RRB- Q k k q ' Q k2 k2 q ' q ' Q k k q ' Q -LRB- line segment -RRB- near -LRB- p , q , k -RRB- about -LRB- p , q , k1 , k2 -RRB- near -LRB- p , q , k -RRB- AND northeast -LRB- p , q -RRB- meet -LRB- p , q -RRB- AND east -LRB- p , q -RRB- Fig. 6 Query windows for the estimation of the retrieval cost 4 . EXPERIMENTAL RESULTS In order to evaluate the quality of the proposed analytical approximations , we compare the expected and the experimental cost for the retrieval of several representative spatial relations using both the B - tree and the R-tree indexing mechanisms . For the experimental tests we used several data files that contained 10,000 data object MBRs with small up to large data sizes -LRB- p x and p y ranged from 0.5 % up to 5 % of global side size respectively -RRB- . The sizes of the reference object MBRs used for the retrieval of spatial relations were equal to the corresponding data object MBRs -LRB- i.e. , p x =p y = q x = q y -RRB- . For the distance relations we set k = 3 . q x -LRB- near -RRB- , k1 = q x and k2 = 3 . q x -LRB- about -RRB- . For each spatial relation we need to define the constraints involved in order to estimate the retrieval cost using B-trees . The constraints for each relation are presented in Table 1 while the ranges for the possible constraints are presented in Table 3 . The expected cost using B-trees is computed by using Eq . 4 , information from Tables 1 and 3 , and the following typical values : - average capacity at leaf nodes c = 0.67 , - maximum number of entries in a node m = 126 -LRB- 1 page of 1024 bytes includes 126 keys . 4 bytes + 127 pointers . 4 bytes + 12 bytes node-overhead -RRB- , - total number of keys N = 10,000 -LRB- as used in our experiments -RRB- . On the other hand , for each spatial relation we need to define a query window in order to estimate the retrieval cost using R-trees . The corresponding query windows for each relation are illustrated in Figure 6 . The expected cost using R-trees is computed by using Eq . 5 , information from Figure 6 and the following typical values : - average node capacity c = 0.67 , - maximum number of entries in a node m = 50 -LRB- 1 page of 1024 bytes includes 50 entries . 4 values per entry . 4 bytes + 50 pointers . 4 bytes + 24 bytes node-overhead -RRB- , - total number of data N = 10,000 . The results for each spatial relation are illustrated in Figure 7 . The experimental results are illustrated with columns and the analytical results with lines . AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA data size -LRB- % of global size -RRB- disk accesses 20406080 100 120 140 160 180 200 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 AAAA AAAAAAAA AAAA B-tree -LRB- exper . -RRB- R-tree -LRB- exper . -RRB- B-tree -LRB- anal . -RRB- R-tree -LRB- anal . -RRB- AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA data size -LRB- % of global size -RRB- disk accesses 20 40 60 80 100 120 140 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 AAAA AAAAAAAA AAAA B-tree -LRB- exper . -RRB- R-tree -LRB- exper . -RRB- B-tree -LRB- anal . -RRB- R-tree -LRB- anal . -RRB- east -LRB- p , q -RRB- northeast -LRB- p , q -RRB- AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA data size -LRB- % of global size -RRB- disk accesses 50 100 150 200 250 300 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 AAAA AAAAAAAA AAAA B-tree -LRB- exper . -RRB- R-tree -LRB- exper . -RRB- B-tree -LRB- anal . -RRB- R-tree -LRB- anal . -RRB- AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA data size -LRB- % of global size -RRB- disk accesses 5 10 15 20 25 30 35 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 AAAA AAAAAAAA AAAA B-tree -LRB- exper . -RRB- R-tree -LRB- exper . -RRB- B-tree -LRB- anal . -RRB- R-tree -LRB- anal . -RRB- meet -LRB- p , q -RRB- inside -LRB- p , q -RRB- AAAA AAAA AAAAAAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA data size -LRB- % of global size -RRB- disk accesses 20406080 100 120 140 160 180 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 AAAA AAAAAAAA AAAA B-tree -LRB- exper . -RRB- R-tree -LRB- exper . -RRB- B-tree -LRB- anal . -RRB- R-tree -LRB- anal . -RRB- AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA data size -LRB- % of global size -RRB- disk accesses 50 100 150 200 250 300 350 400 450 500 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 AAAA AAAAAAAA AAAA B-tree -LRB- exper . -RRB- R-tree -LRB- exper . -RRB- B-tree -LRB- anal . -RRB- R-tree -LRB- anal . -RRB- near -LRB- p , q , k -RRB- about -LRB- p , q , k1 , k2 -RRB- AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA data size -LRB- % of global size -RRB- disk accesses 10 20 30 40 50 60 70 80 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 AAAA AAAAAAAA AAAA B-tree -LRB- exper . -RRB- R-tree -LRB- exper . -RRB- B-tree -LRB- anal . -RRB- R-tree -LRB- anal . -RRB- AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA data size -LRB- % of global size -RRB- disk accesses 20 40 60 80 100 120 140 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 AAAA AAAAAAAA AAAA B-tree -LRB- exper . -RRB- R-tree -LRB- exper . -RRB- B-tree -LRB- anal . -RRB- R-tree -LRB- anal . -RRB- near -LRB- p , q , k -RRB- ? northeast -LRB- p , q -RRB- meet -LRB- p , q -RRB- ? east -LRB- p , q -RRB- Fig. 7 Experimental vs. analytical results The common observation in all the graphs is that the analytical estimate is very close to the experimental results . With the exception of the R-tree estimation for east and northeast , the relative error is usually below 5 % . The weakness of the R-tree model for east and northeast is , more or less , expected because of the very large window queries Q -LRB- see Figure 6 -RRB- that make R-trees an unstable index for these relations . On the other hand , the range of a constraint in a B-tree query does not affect the B-tree retrieval mechanism and , therefore , the B-tree estimate is always very close to the experimental results . The comparison of the B - and R - tree indexing mechanism depends on two factors : the number of constraints involved -LRB- for B-trees -RRB- and the size of the query window Q -LRB- for R-trees -RRB- . For example , B - trees perform better than R-trees when one constraint and large Q are involved -LRB- east -RRB- . When the opposite happens , R-trees perform better than B-trees . Following these guidelines , a spatial query optimiser can predict the efficiency of the one or the other indexing mechanism on the support of several spatial queries . According to our experimental tests , the analytical models of section 3 are proved to be efficient for the estimation of the particular spatial queries that we have implemented using transformation to range queries . Following the same procedure , the performance of other spatial queries can also be estimated with similar accuracy . 5 . CONCLUSION Relations in space are becoming an important aspect of access methods as a result of the increasing interest on qualitative spatial information processing . In this paper we focus on the retrieval of spatial relations using classic alphanumeric -LRB- B-trees -RRB- and spatial -LRB- R-trees -RRB- indexing methods . First we transform queries involving spatial relations into range queries , then we provide analytical formulas for their expected performance -LRB- extending previous work on analysis of indexing methods -RRB- , and finally we evaluate the analytical model . In most cases we found the analytical estimate almost identical to the actual results , a fact that leads to the conclusion that the derived formulas can be used successfully in query optimisers of Geographic Databases in order to estimate the cost of spatial queries . Although we have worked with a small set of representative topological , direction and distance relations , the results are directly applicable to other spatial relations and combinations . Future work can be done : -LRB- a -RRB- to apply the analytical models on specialised spatial relations such as nearest-neighbour or furthest-neighbour and combinations , -LRB- b -RRB- to provide analytical models for other spatial indexing methods , such as Grid files -LSB- NHS84 -RSB- or K-D-B-trees -LSB- Robi81 -RSB- , in order to evaluate their efficiency with respect to the particular spatial relations and -LRB- c -RRB- to derive analytical formulas assuming a general -LRB- non-uniform -RRB- distribution of objects over the work space in order to efficiently support any kind of spatial information . REFERENCES -LSB- Bato81 -RSB- Batory , D.S. , `` B + Trees and Indexed Sequential Files : A Performance Comparison '' , In the Proceedings of ACM SIGMOD Conference , 1981 . -LSB- BKSS90 -RSB- Beckmann , N. , Kriegel , H.P. Schneider , R. , Seeger , B. , `` The R * - tree : an Efficient and Robust Access Method for Points and Rectangles '' , In the Proceedings of ACM SIGMOD Conference , 1990 . -LSB- CSE95 -RSB- Clementini , E. , Sharma , J. , Egenhofer , M. , `` Modeling Topological Spatial Relations : Strategies for Query Processing '' , to appear in the International Journal of Computer and Graphics , 1995 . -LSB- Come79 -RSB- Comer , D. , `` The Ubiquitous B-Tree '' , ACM Computing Surveys , Vol . 11 -LRB- 2 -RRB- , pp. 121-137 , 1979 . -LSB- Egen91 -RSB- Egenhofer , M. , `` Reasoning about Binary Topological Relations '' , In the Proceedings of the Second Symposium on the Design and Implementation of Large Spatial Databases -LRB- SSD -RRB- , Springer Verlag LNCS , 1991 . -LSB- EF91 -RSB- Egenhofer , M. , Franzosa R. , `` Point-Set Topological Spatial Relations '' , International Journal of Geographic Information Systems , Vol 5 -LRB- 2 -RRB- , pp. 160-174 , 1991 . -LSB- FSR87 -RSB- Faloutsos , C. , Sellis , T. , Roussopoulos , N. , `` Analysis of Object Oriented Spatial Access Methods '' , In the Proceedings of ACM SIGMOD Conference , 1987 . -LSB- FK94 -RSB- Faloutsos , C. , Kamel , I. , `` Beyond Uniformity and Independence : Analysis of R-trees Using the Concept of Fractal Dimension '' , In the Proceedings of the 13th ACM PODS Symposium , 1994 . -LSB- Fran92 -RSB- Frank , A.U. , `` Qualitative Spatial Reasoning about Distances and Directions in Geographic Space '' , Journal of Visual Languages and Computing , Vol . 3 , pp . 343-371 , 1992 . -LSB- Fran95 -RSB- Frank , A.U. , `` Qualitative Spatial Reasoning : Cardinal Directions as an Example '' , to appear in the International Journal of Geographic Information Systems , 1995 . -LSB- Gutt84 -RSB- Guttman , A. , `` R-trees : A Dynamic Index Structure for Spatial Searching '' , In the Proceedings of ACM SIGMOD Conference , 1984 . -LSB- Knut73 -RSB- Knuth , D. , `` The Art of Computer Programming , vol .3 : Sorting and Searching '' , Addison-Wesley , 1973 . -LSB- Mark92 -RSB- Mark , D. , `` Counter-Intuitive Geographic ` Facts ' : Clues for Spatial Reasoning at Geographic Scales '' , In the Proceedings of International Conference GIS - From Space to Territory : Theories and Methods of Spatio-Temporal Reasoning in Geographic Space , 1992 . -LSB- ME94 -RSB- Mark , D. , Egenhofer , M. , `` Calibrating the Meaning of Spatial Predicates from Natural Language : Line Region Relations '' , In the Proceedings of the 6th International Symposium on Spatial Data Handling -LRB- SDH -RRB- , Taylor Francis , 1994 . -LSB- NHS84 -RSB- Nievergelt , J. , Hinterberger , H. , Sevcik , K.C. , `` The Grid File : An Adaptable , Symmetric Multikey file Structure '' , ACM Transactions on Database Systems , Vol 9 -LRB- 1 -RRB- , pp . 38-71 , 1984 . -LSB- PSTW93 -RSB- Pagel , B. , Six , H. , Toben , H. , Widmayer , P. , `` Towards an Analysis of Range Query Performance '' , In the Proceedings of the 12th ACM PODS Symposium , 1993 . -LSB- PFK94 -RSB- Papadias , D. , Frank , A.U. , Koubarakis , M. , `` Constraint-Based Reasoning in Geographic Databases : The Case of Symbolic Arrays '' , In the Proceedings of the 2nd ICLP Workshop on Deductive Databases , 1994 . -LSB- PS94 -RSB- Papadias , D. , Sellis , T. , `` The Qualitative Representation of Spatial Knowledge in two - dimensional Space '' , Very Large Data Bases Journal , Special Issue on Spatial Databases , Vol 3 -LRB- 4 -RRB- , pp. 479-516 , 1994 . -LSB- PTS94 -RSB- Papadias , D. , Theodoridis , Y. , Sellis , T. , `` The Retrieval of Direction Relations Using R-trees '' , In the Proceedings of the 5th Conference on Database and Expert Systems Applications -LRB- DEXA -RRB- , 1994 . -LSB- PT94 -RSB- Papadias , D. , Theodoridis , Y. , `` Spatial Relations , Minimum Bounding Rectangles and Spatial Data Structures '' , Technical Report , KDBSLAB-TR-94-06 , National Technical University of Athens , Greece , 1994 . -LSB- PTSE95 -RSB- Papadias , D. , Theodoridis , Y. , Sellis , T. , Egenhofer , M. , `` Topological Relations in the World of Minimum Bounding Rectangles : a Study with R-trees '' , In the Proceedings of ACM SIGMOD Conference , 1995 . -LSB- Robi81 -RSB- Robinson , J.T. , `` The K-D-B-Tree : A Search Structure for Large Multidimensional Dynamic Indexes '' , In the Proceedings of ACM SIGMOD Conference , 1981 . -LSB- RKV95 -RSB- Roussopoulos , N. , Kelley , F. , Vincent , F. , `` Nearest Neighbor Queries '' , In the Proceedings of ACM SIGMOD Conference , 1995 . -LSB- SRF87 -RSB- Sellis , T. , Roussopoulos , N. , Faloutsos , C. , `` The R + - tree : A Dynamic Index for Multi-Dimensional Objects '' , In the Proceedings of the 13th Very Large Data Bases Conference , 1987 . -LSB- SR86 -RSB- Stonebraker , M. , Rowe , L. , `` The Design of Postgres '' , In the Proceedings of ACM SIGMOD Conference , 1986 . -LSB- SYH94 -RSB- Sistla , P. , Yu , C. , Haddad , R. , `` Reasoning about Spatial Relationships in Picture Retrieval Systems '' , In the Proceedings of the 20th Very Large Data Bases Conference , 1994 . -LSB- TPS95 -RSB- Theodoridis , Y. , Papadias , D. , Stefanakis , E. , `` Supporting Direction Relations in Spatial Database Systems '' , Technical Report , KDBSLAB-TR-95-02 , National Technical University of Athens , Athens , Greece , 1995 . -LSB- TS95 -RSB- Theodoridis , Y. , Sellis , T. , `` Indexing Point and Non-point Spatial Data : A Performance Analysis '' , Technical Report , KDBSLAB-TR-95-03 , National Technical University of Athens , Athens , Greece , 1995 . -LSB- TM95 -RSB- Topaloglou , T. , Mylopoulos , Y. , `` Spatial Databases with Partial Information : Representation and Reasoning '' , Submitted . -LSB- Yao78 -RSB- Yao , A.C. , `` On Random 2-3 Trees '' , Acta Informatica , Vol . 9 -LRB- 2 -RRB- , pp. 159-168 , 1978 .

O O O B I O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O