<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:space="preserve" xmlns="http://www.tei-c.org/ns/1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 https://raw.githubusercontent.com/kermitt2/grobid/master/grobid-home/schemas/xsd/Grobid.xsd"
 xmlns:xlink="http://www.w3.org/1999/xlink">
	<teiHeader xml:lang="en">
		<fileDesc>
			<titleStmt>
				<title level="a" type="main">The Space package: Tight Integration Between Space and Semantics</title>
			</titleStmt>
			<publicationStmt>
				<publisher/>
				<availability status="unknown"><licence/></availability>
			</publicationStmt>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author>
							<persName><forename type="first">Willem</forename><surname>Robert Van Hage</surname></persName>
							<affiliation key="aff0">
								<orgName type="institution">Vrije Universiteit Amsterdam</orgName>
								<address>
									<addrLine>de Boelelaan 1081a</addrLine>
									<postCode>1081HV</postCode>
									<settlement>Amsterdam</settlement>
									<country key="NL">the Netherlands</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Jan</forename><surname>Wielemaker</surname></persName>
							<email>j.wielemaker@cs.vu.nl</email>
							<affiliation key="aff0">
								<orgName type="institution">Vrije Universiteit Amsterdam</orgName>
								<address>
									<addrLine>de Boelelaan 1081a</addrLine>
									<postCode>1081HV</postCode>
									<settlement>Amsterdam</settlement>
									<country key="NL">the Netherlands</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Guus</forename><surname>Schreiber</surname></persName>
							<email>schreiber@cs.vu.nl</email>
							<affiliation key="aff0">
								<orgName type="institution">Vrije Universiteit Amsterdam</orgName>
								<address>
									<addrLine>de Boelelaan 1081a</addrLine>
									<postCode>1081HV</postCode>
									<settlement>Amsterdam</settlement>
									<country key="NL">the Netherlands</country>
								</address>
							</affiliation>
						</author>
						<title level="a" type="main">The Space package: Tight Integration Between Space and Semantics</title>
					</analytic>
					<monogr>
						<imprint>
							<date/>
						</imprint>
					</monogr>
					<idno type="MD5">EDA781F3748C5A5090D85124B1F0D8B1</idno>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
		<encodingDesc>
			<appInfo>
				<application version="0.7.2" ident="GROBID" when="2023-03-25T02:58+0000">
					<desc>GROBID - A machine learning software for extracting information from scholarly documents</desc>
					<ref target="https://github.com/kermitt2/grobid"/>
				</application>
			</appInfo>
		</encodingDesc>
		<profileDesc>
			<abstract>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>Interpretation of spatial features often requires combined reasoning over geometry and semantics. We introduce the Space package, an open source SWI-Prolog extension that provides spatial indexing capabilities. Together with the existing semantic web reasoning capabilities of SWI-Prolog, this allows efficient integration of spatial and semantic queries and provides an infrastructure for declarative programming with space and semantics.</p></div>
			</abstract>
		</profileDesc>
	</teiHeader>
	<text xml:lang="en">
		<body>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1">Introduction</head><p>Geographical Information Systems have been used successfully to analyze spatial concepts for about five decades. The use of ontologies in such analyses is a relatively recent development (cf. <ref type="bibr" target="#b2">[3,</ref><ref type="bibr" target="#b3">4,</ref><ref type="bibr" target="#b6">7]</ref>). A limitation of current state-of-the-art GISs is that they do not support semantics. Most GISs use local identifiers for features as opposed to global URIs. Information about the features is usually stored with "flat" attribute-value pairs. Most GISs do not natively support hierarchical typing of features, property hierarchies, or rules. On the other hand, most semantic reasoning systems support very little "concrete domain" reasoning, limiting themselves to logical inference. Complex analysis of spatial concepts, such as the interpretation of moving object behavior <ref type="bibr" target="#b10">[11,</ref><ref type="bibr" target="#b11">12]</ref>, or the classification of terraced houses based on their relative position <ref type="bibr" target="#b8">[9]</ref>, requires software that can deal with both spatial and semantic aspects of features.</p><p>This paper presents an infrastructure to reason declaratively over spatial objects. We introduce the Space package, a module for SWI-Prolog that provides spatial indexing. More information about the package can be found at http://www.swi-prolog.org/ pldoc/package/space.html and the source code itself can be downloaded from the GIT repository at http://www.swi-prolog.org/git/space.git. <ref type="foot" target="#foot_0">1</ref>In Sec. 2 we will discuss the motivation for this work. In Sec. 3 we compare the Space package to related work. In Sec. 4 we will describe the interface of the Space package in detail. In Sec. 5 we will describe the architecture of the package and technical implementation issues. In Sec. <ref type="bibr" target="#b5">6</ref> we give an indication of the performance of the system. In Sec. 7 we describe a practical use-case. In Sec. 8 we discuss future work related to the Space package. And in Sec. 9 we wrap up with a conclusion.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2">Logic Programming and Spatial Reasoning</head><p>The goal of our work is to provide an infrastructure for declarative programming over both space and semantics. We choose to do this in SWI-Prolog, because it provides a fast declarative rule-based reasoning platform that provides smooth integration to a general-purpose programming language (cf. <ref type="bibr" target="#b7">[8]</ref>), and because of its support of semantic web technology <ref type="bibr" target="#b14">[15]</ref>. However, it does not provide support for geometric operations and spatial indexing. For these two tasks we use external libraries, respectively Geometry Engine Open Source (GEOS) <ref type="foot" target="#foot_1">2</ref> and the Spatial Index Library<ref type="foot" target="#foot_2">3</ref>  <ref type="bibr" target="#b4">[5]</ref>. We had to take the following important decision when designing the Space package:</p><p>1. We had to decide at which level of abstraction we make our declarative interface. Some things are easier to write declaratively (e.g. symbolic spatial reasoning, like Region Connection Calculus (RCC-8) <ref type="bibr" target="#b1">[2]</ref>), while other things are easier to write imperatively. In section 4 we will describe the interface we chose and motivate our decisions.</p><p>2. We had to decide how profoundly the integration between spatial and semantic constructs should be. There are many possible degrees of integration. On one side of the spectrum it would have been possible to wrap existing GISs as a service or with a database wrapper and disclose this to the rest of Prolog through a declarative interface. On the other side, it would have been possible to write a basic GIS in Prolog. It is very hard to write an efficient query optimizer on a loosely coupled system that combines two different kinds of indices. We decided on an interface that allows us to reuse existing libraries, while still allowing tight enough integration to be able to write query optimization routines that use properties of both the spatial and the semantic index.</p><p>3. We had to bridge the gap between spatial databases and geometric operations on one side and pure Prolog predicates on the other in some way. Pure Prolog predicates should always have the same behavior, regardless of the instantiation order determined by the program context. They work though unification of variable arguments, not by side effects like destructive assignment. In section 5 we discuss the implementation issues of spatial queries as pure prolog predicates.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">Related Work</head><p>The three systems that are most similar to the Space package are: Franz Inc.'s Alle-groGraph <ref type="foot" target="#foot_3">4</ref> ; the Jena <ref type="bibr" target="#b9">[10]</ref> extension Geospatialweb<ref type="foot" target="#foot_4">5</ref> ; and the framework built around Jena and PostGIS by Lüscher et al. <ref type="foot" target="#foot_5">6</ref> for the classification of types of houses <ref type="bibr" target="#b8">[9]</ref>. Alle-groGraph and SWI-Prolog have native RDF and RDFS++ <ref type="bibr" target="#b0">[1]</ref> support, and use a DIG interface for interfacing with an external DL reasoner <ref type="bibr" target="#b14">[15]</ref>. Geospatialweb uses Jena for storage, which also uses an external system for DL reasoning. AllegroGraph is built on the Allegro Common Lisp sytem, which also has Prolog rule support. Jena has a forward chaining rule reasoner. <ref type="foot" target="#foot_6">7</ref> The greatest functional difference between the Space package and AllegroGraph is that in AllegroGraph shapes are lists of coordinates, not typed structures; that it only supports polygons as queries, not as indexable objects; and that it does not support nearest neighbor queries. Geospatialweb does support nearest neighbor queries, but only on points. It does not support any other type of shapes. These points are directly derived from W3C WGS84 lat and long properties in RDF. They are not first class citizens like in the Space package. The system by Lüscher et al. uses PostGIS, which is a more powerful spatial query system than the Spatial Index Library used by the Space package. However, as opposed to the Space package, it loosely couples space and semantics. This makes it hard to control the performance of complex queries in such a system, because the two separate engines each have their own query optimizers that are unable to anticipate based on each other's statistics. For nearest neighbor queries this more relevant than for containment and intersection queries, because nearest neighbor queries are potentially unbounded in space. For example, consider the query "Find the nearest Chinese restaurant that serves vegetarian dishes.". The spatial database knows the heuristics about where the nearest features are. Perhaps it even knows where the nearest restaurants are if there is an attribute:value pair type:restaurant, but the nearest restaurant matching the two very different semantic constraints ChineseRestaurant u 9serves:VegetarianDish could very well be on the other side of the earth even though there are many nearby restaurants. The spatial index has no access to heuristics about semantics.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4">The Space package Interface</head><p>The interface of the Space package was designed to make declarative multimodal statements easy to write. For example, "Scientists born near Amsterdam", using the DBpedia data set looks like: scientist_born_near_amsterdam(Scientist, BirthPlace) :-rdfs_individual_of(Scientist, db:'Scientist'), rdf(Scientist, dbp:birthPlace, BirthPlace), uri_shape(AmsterdamURI, AmsterdamShape), space_nearest(AmsterdamShape, BirthPlace).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.1">Shapes as Prolog Terms</head><p>The central objects of the Space package are pairs, hu;si of a URI, u, and its associated shape, s. The URIs are linked to the shapes with the uri shape/2 predicate. This is illustrated in figure 1. We will support all OpenGIS Simple Features, points, linestrings, polygons (with 0 holes), multi-points, multi-polygons, and geometry collections; and some utility shapes like box and circle regions. <ref type="foot" target="#foot_7">8</ref>Both the URIs and the shapes are represented as Prolog terms. This makes them first-class Prolog citizens, which allows the construction and transformation of shapes using regular Prolog clauses, or Definite Clause Grammars (DCGs). We support input from locations encoded in RDF with the W3C WGS84 vocabulary <ref type="foot" target="#foot_8">9</ref> and with the GeoRSS Simple properties and the GeoRSS where property leading to an XML literal consisting of a GML element. <ref type="foot" target="#foot_9">10</ref> The uri shape/2 predicate searches for URI-Shape pairs in SWI-Prolog's RDF triple store. It matches URIs to Shapes by using WGS84 and GeoRSS properties. For example, a URI u is associated with the shape s =point(lat;long) if the triple store contains the triples: hu; wgs84 pos:lat ; lati and hu; wgs84 pos:long ; longi; or when it contains one of the following triples: hu; georss:point;"lat long"i or hu; georss:where;"&lt;gml:Point&gt;&lt;gml:pos&gt; lat long &lt;/gml:pos&gt;&lt;/gml:Point&gt;"i. The XML literal containing the GML description of the geometric shape is parsed with a DCG that can also be used to generate GML from Prolog shape terms.  </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.2">Adding, Removing, and Bulkloading Shapes</head><p>The spatial index can be modified in two ways: By inserting or retracting single URIshape pairs respectively using the space assert/3, or the space retract/3 predicate; or by loading many pairs at once using the space bulkload/2 predicate or its parameterless counterpart space index all/0 which simply loads all the shapes it can find with the uri shape/2 predicate into the default index. The former method is best for small manipulations of indices, while the latter method is best for the loading of large numbers of URI-shape pairs into an index. The Space package can deal with multiple indices to make it possible to divide sets of features. Indices are identified with a name handle, which can be any Prolog atom. <ref type="foot" target="#foot_10">11</ref> The actual indexing of the shapes is per-formed using lazy evaluation (i.e. indexing is delayed as long as possible.) Assertions and retractions are put on a queue that belongs to an index. The queue is committed to the index whenever a query is performed, or when a different kind of modification is called for (i.e. when the queue contains assertions and a retraction is requested or vice versa). Index modification operations are illustrated in figure <ref type="figure">2</ref>. An indication of the performance of bulkloading and single assertions is given in figure <ref type="figure" target="#fig_5">9</ref>  Fig. <ref type="figure">2</ref>. The space assert/3 and space retract/3 predicates put modifications to the index in a queue that is processed by space index/1 before the execution of a query on the index (lazy evaluation). ex:myoffice is a QName using an example namespace.</p><p>%% space_bulkload(:Closure, +IndexName) is det. %% uri_shape(?URI, ?Shape) is nondet. ?-space_bulkload(uri_shape, demo_index). true.</p><p>Fig. <ref type="figure">3</ref>. Bulkloading is done with the space bulkload/2 predicate, which creates a new index of all URI-Shape pairs it can find with the supplied predicate. In this example we use the uri shape/2 predicate from the space module to find candidates for indexing.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3">Query types</head><p>We chose the three most common spatial query types as our basic building blocks: containment, intersection, and nearest neighbor. These three query types are implemented as pure Prolog predicates, respectively space contains/3, space intersects/3, and space nearest/3. These predicates work completely analogously, taking an index handle and a query shape to retrieve the URI of a shape matching the query, which is bound to the second argument. Any successive calls to the predicate try to re-instantiate the second argument with a different matching URI. This is illustrated in figure <ref type="figure">4</ref>. The results of containment and intersection queries are instantiated in no particular order, while the nearest neighbor results are instantiated in order of increasing distance to the query shape. The space nearest bounded/4 predicate is a containment query based on space nearest/3, which returns objects within a certain range of the query shape in order of increasing distance. An indication of the performance of nearest neighbor queries is given in figure <ref type="figure" target="#fig_5">9</ref>  </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.4">Importing and Exporting Shapes</head><p>Besides supporting input from RDF we support input and output for other standards, like GML, <ref type="foot" target="#foot_11">12</ref> KML <ref type="foot" target="#foot_12">13</ref> and WKT. <ref type="foot" target="#foot_13">14</ref> All shapes can be converted from and to these standards with the gml shape/2, kml shape/2, and wkt shape/2 predicates. An illustration of this is shown in figure <ref type="figure">5</ref>.</p><p>% Convert a WKT shape into GML and KML ?-wkt_shape('POINT ( 52.3325 4.8673 )', Shape), % instantiate from WKT gml_shape(GML, Shape), kml_shape(KML, Shape). Shape = point(52.3325, 4.8673), GML = '&lt;gml:Point&gt;&lt;gml:pos&gt;52.3325 4.8673&lt;/gml:pos&gt;&lt;/gml:Point&gt;', KML = '&lt;Point&gt;&lt;coordinates&gt;4.8673,52.3325&lt;/coordinates&gt;&lt;/Point&gt;' . Fig. <ref type="figure">5</ref>. Converting a WKT geometry object into a Prolog shape term, and converting it to GML and KML. The conversion can be done in any direction between these formats using the same predicates with different variables instantiated.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.5">Integration of Space and Semantics</head><p>The non-deterministic implementation of the queries makes them behave like a lazy stream of solutions. (i.e. Computation to find results is delayed until a result is explicitly requested. If only one result is requested then the computation to find additional results is never performed.) This allows tight integration with other types of reasoning, like RDF(S) reasoning or other Prolog rules. An example of combined RDFS and spatial reasoning is shown in figure <ref type="figure" target="#fig_1">6</ref>.  Integration of multiple spatial queries can be done in the same way. Since the queries return URIs an intermediate URI-Shape predicate is necessary to get a shape that can be used as a query. An example is shown in figure <ref type="figure" target="#fig_2">7</ref>.</p><formula xml:id="formula_0">%</formula><p>% Find features inside nearby polygons. ?-uri_shape(ex:myoffice, Office), space_nearest(Office, NearURI), uri_shape(NearURI, NearShape), % look up the shape of the URI 'Near' NearShape = polygon(_), % assert that it must be a polygon space_contains(NearShape, Contained). </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5">Architecture</head><p>The Space package consists of C++ and Prolog code. The division into components is shown in figure <ref type="figure" target="#fig_3">8</ref>. The main component is the Prolog module space. All parsing and generation of input and output formats is done in Prolog. All index manipulation is done through the foreign language interface (FLI) from Prolog to C++. The space bulkload/2 predicate also communicates back across the FLI from C++ to Prolog, allowing the indexing functions to ask for candidates to index from the Prolog database, for example, by calling the uri shape/2 predicate.  </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.1">Incremental Search and Non-determinism</head><p>The three search operations provided by the Space package all yield their results incrementally, i.e. one at a time. Prolog predicates actually do not have return values, but instantiate parameters. Multiple return values are returned by subsequently instantiating the same variable, so the first call to a predicate can make different variable instantiations than the second call. This standard support of non-deterministic behavior makes it easy to write incremental algorithms in Prolog. Internally, the search operations are handled by C++ functions that work on an R*tree index from the Spatial Index Library <ref type="bibr" target="#b4">[5]</ref>. The C++ functions are accessed with the SWI-Prolog foreign language interface. To implement non-deterministic behavior the query functions have to store their state between successive calls and Prolog has to be aware which state is relevant to every call.</p><p>The Spatial Index library does not include an incremental nearest neighbor, so we implemented an adaptation of the algorithm described in <ref type="bibr" target="#b5">[6]</ref>. The original algorithm emits results, for example, with a callback function, without breaking from the search loop that finds all matches. Our adaptation breaks the search loop at every matching object and stores a handle to the state (including the priority queue) so that it can restart the search loop where it left off. This makes it possible to tie the query strategy into the non-deterministic foreign language interface of SWI-Prolog with very little time overhead.</p><p>Currently, so few systems exist that can deal with space and semantics that there are no existing benchmarks for queries that require both. In order to give an impression of the performance of the Space package we have computed the CPU time and memory costs of some typical bulkloading, assert/retract, and 10.000 nearest neighbor query statements (nearest neighbor being the slowest query type) on an arbitrary selection of the LinkedGeoData 15 set of OpenStreetMap data. We used a Intel Core 2 Duo 2.66GHz with 4GB of main memory and 6MB of L2 Cache, and a bus speed of 1.07GHz. A million points load from RDF in memory in about four minutes. A nearest neighbor query takes around 0.8s to retrieve 10.000 matches, regardless of the size of the index. Bulkloading is takes linear time to load points into memory, while single assertions take exponential time. For small data sets (hundreds of points) bulkloading is only a slightly faster than single assertions, but at 100.000 points the difference is already over a factor 10. An overview is shown in figure <ref type="figure" target="#fig_5">9</ref>. Given the decreasing price of memory we decided to use a memory store by default, although the Space package can be set to use a file store with a memory buffer. Memory use in version 0.1.1 lies around 250B per point. The overhead is larger for smaller data sets.   To show the applicability of the Space package we refer to a paper <ref type="bibr" target="#b12">[13]</ref> in which describe using the Space package to reason over ship behavior. For this we use ship location information from AIS messages <ref type="foot" target="#foot_14">16</ref> and we extended GeoNames<ref type="foot" target="#foot_15">17</ref> with locations of harbors. On top of these two sources we define declarative rules to qualify ship behavior. One example of such rule is the definition of trip. By means of a compression algorithm the streams of AIS messages are segmented into intervals where a ship is speeding up, slowing down or stopped. A trip can then be defined as stopped near a harbor (GeoNames featureCode H.HBR, then :stopped for a while, and then stopped near a different harbor. On top of such trips, defining the behavior of a ferry can be done by declaring that there are consecutive trips that lead back to the same harbor. The connection between the Space package, RDF reasoning, and behavior rules is illustrated in figure <ref type="figure" target="#fig_0">10</ref>.</p><p>stopped_at_harbor(Segment, Harbor) :stopped(Segment), % semantics of behavior % fetch location of segment location_of_segment(Segment,Location) % find nearest place within margin space_nearest_bounded(Location, Harbor, 0.175), % call spatial index rdf(Harbor, geo:featureCode, geo:'H.HBR'). % semantics of place Fig. <ref type="figure" target="#fig_0">10</ref>. Selected SWI-Prolog rules that illustrate the linking of domain-level data to place and behavior semantics using the Space package. The rules in this example come from code used to classify ferry behavior described in <ref type="bibr" target="#b12">[13]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="8">Future Work</head><p>At this moment, in version 0.1.1, the Space package only supports points, box regions and polygons with optional holes, but not linestrings and various kinds of multi-shapes.</p><p>In the near future we will completely support the GML Simple Feature Specification. We would like to extend the Space package with support for common GIS file formats with some methods to connect URIs to the shapes that come from such files. A possible implementation for this could be in the form of a database connector for PostGIS. This would also allow the Space package to consult PostGIS for complex geospatial queries and geometric operations. For a better performance analysis, and comparison to the systems mentioned in section 3, we will set up a set of representative spatial-semantic queries. Further future work is to make a query optimizer that combines heuristics from the SWI-Prolog Semantic Web Library and Space package along the lines of <ref type="bibr" target="#b13">[14]</ref>. This will allow us to take advantage of the tight integration between space and semantic offered by the Space package.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="9">Conclusion</head><p>We presented the Space package, an open source library that adds spatial indexing capabilities to SWI-Prolog and allows declarative programming over spatial concepts. The two main strengths of the Space package are its tight integration with the rest of SWI-Prolog, which allows relatively easy query optimization for multimodal queries; and its declarative interface, which allows the formulation of short, understandable code, while not limiting expressivity. The Space package supports common geospatial and web standards, such as GML, KML and WKT, and in combination with RDF: GeoRSS Simple and GML, and the W3C Basic Geo (WGS84) Vocabulary.</p></div><figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_0"><head>Fig. 1 .</head><label>1</label><figDesc>Fig.1. Examples of supported shapes that can be used both as data and queries in Space package version 0.1.1. Shapes are associated to a URI by the uri shape/2 predicate and verified with the shape/1 predicate.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_1"><head>Fig. 6 .</head><label>6</label><figDesc>Fig. 6. Example code showing tight integration of a spatial query and RDFS reasoning. Query optimization would involve reordering the predicates.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_2"><head>Fig. 7 .</head><label>7</label><figDesc>Fig. 7. Example code showing nested spatial queries.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_3"><head>Fig. 8 .</head><label>8</label><figDesc>Fig. 8. The architecture of the Space package.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_4"><head></head><label></label><figDesc>results size of data set in number of points</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_5"><head>Fig. 9 .</head><label>9</label><figDesc>Fig. 9. Tentative performance figures on LinkedGeoData points: (upper left) CPU time taken to bulkload n points; (upper right) Memory taken to load n points; (lower left) CPU time taken to bulkload versus to make single assertions; (lower right) CPU time taken to computer 10.000 nearest neighbors on varying data set sizes, about constant around 0.8s. All figures concern version 0.1.1 of the Space package.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_6"><head></head><label></label><figDesc>15 http://linkedgeodata.org/ and http://www.openstreetmap.org/</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_1"><head></head><label></label><figDesc>in section 6.</figDesc><table><row><cell cols="2">%% space_assert(+URI, +Shape, +IndexName) is det.</cell></row><row><cell cols="2">%% space_retract(+URI, +Shape, +IndexName) is det.</cell></row><row><cell>%% space_index(+IndexName) is det.</cell><cell></cell></row><row><cell cols="2">?-space_assert(ex:myoffice, point(52.3325,4.8673),</cell></row><row><cell cols="2">demo_index). % only adds it to the 'demo_index' queue</cell></row><row><cell>true.</cell><cell></cell></row><row><cell cols="2">?-space_contains(box(point(52.3324,4.8621), point(52.3348,4.8684)),</cell></row><row><cell>Cont, demo_index).</cell><cell></cell></row><row><cell cols="2">% uses 'demo_index', so triggers a call to space_index('demo_index').</cell></row><row><cell>Cont = 'http://www.example.org/myoffice' .</cell><cell>% first instantiation, etc.</cell></row></table></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_2"><head></head><label></label><figDesc>in section 6.</figDesc><table><row><cell cols="2">%% space_contains(+QueryShape, -ContainedURI, +IndexName) is nondet.</cell></row><row><cell cols="2">%% space_intersects(+QueryShape, -IntersectedURI, +IndexName) is nondet.</cell></row><row><cell cols="2">%% space_nearest(+QueryShape, -NearURI, +IndexName) is nondet.</cell></row><row><cell cols="2">%% space_nearest_bounded(+Query, -NearURI, +Range, +IndexName) is nondet.</cell></row><row><cell cols="2">?-space_nearest(point(52.3325,4.8673), N, demo_index).</cell></row><row><cell>N = 'http://sws.geonames.org/2759113/' ;</cell><cell>% retry, ask for more</cell></row><row><cell>N = 'http://sws.geonames.org/2752058/' ;</cell><cell>% retry</cell></row><row><cell>N = 'http://sws.geonames.org/2754074/' .</cell><cell>% cut, satisfied</cell></row></table><note>Fig.4. Three types of queries: containment, intersection, and incremental nearest neighbor. All query types return one value, a URI, at a time. There exist short notations of these predicates with arity two that automatically use the default index.</note></figure>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="1" xml:id="foot_0">or git://www.swi-prolog.org/home/pl/git/space.git</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_1">http://geos.refractions.net/</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="3" xml:id="foot_2">http://trac.gispython.org/spatialindex/</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="4" xml:id="foot_3">http://www.franz.com/agraph/</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="5" xml:id="foot_4">http://code.google.com/p/geospatialweb/, http://geosparql.appspot.com/</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="6" xml:id="foot_5">http://www.dagstuhl.de/Materials/Files/09/09161/09161.LuescherPatrick. Slides.pdf</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="7" xml:id="foot_6">http://jena.hpl.hp.com/juc2006/proceedings/reynolds/rules-slides.ppt</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="8" xml:id="foot_7">The current version of the Space package, 0.1.1, only supports points and polygons (with holes) and box regions. Development on the other shape types is underway.</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="9" xml:id="foot_8">http://www.w3.org/2003/01/geo/</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="10" xml:id="foot_9">cf. http://georss.org/</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="11" xml:id="foot_10">Every predicate in the Space package that must be given an index handle also has an abbreviated version without the index handle argument which automatically uses the default index.</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="12" xml:id="foot_11">http://www.opengeospatial.org/standards/gml</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="13" xml:id="foot_12">http://code.google.com/apis/kml/</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="14" xml:id="foot_13">http://en.wikipedia.org/wiki/Well-known_text</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="16" xml:id="foot_14">http://en.wikipedia.org/wiki/Automatic_Identification_System</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="17" xml:id="foot_15">http://www.geonames.org/</note>
		</body>
		<back>

			<div type="acknowledgement">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Acknowledgements</head><p>Thanks go to Marios Hadjieleftheriou and Véronique Malaisé. This work has been carried out as a part of the Poseidon project in cooperation with Thales Nederland, under the responsibilities of the Embedded Systems Institute (ESI). This project is partially supported by the Dutch Ministry of Economic Affairs under the BSIK03021 program.</p></div>
			</div>

			<div type="references">

				<listBibl>

<biblStruct xml:id="b0">
	<monogr>
		<title level="m" type="main">Semantic Web for the Working Ontologist</title>
		<author>
			<persName><forename type="first">Dean</forename><surname>Allemang</surname></persName>
		</author>
		<author>
			<persName><forename type="first">James</forename><surname>Hendler</surname></persName>
		</author>
		<imprint>
			<date type="published" when="2008">2008</date>
			<publisher>Morgan Kaufmann</publisher>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b1">
	<analytic>
		<title level="a" type="main">A system handling rcc-8 queries on 2d regions representable in the closure algebra of half-planes</title>
		<author>
			<persName><forename type="first">Brandon</forename><surname>Bennett</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Amar</forename><surname>Isli</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Anthony</forename><forename type="middle">G</forename><surname>Cohn</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Methodology and Tools in Knowledge-Based Systems</title>
				<imprint>
			<date type="published" when="1998">1998</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b2">
	<analytic>
		<title level="a" type="main">Ontologies for intelligent search and semantic translation in spatial data infrastructures</title>
		<author>
			<persName><forename type="first">L</forename><surname>Bernard</surname></persName>
		</author>
		<author>
			<persName><forename type="first">U</forename><surname>Einspanier</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Haubrock</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Hübner</surname></persName>
		</author>
		<author>
			<persName><forename type="first">W</forename><surname>Kuhn</surname></persName>
		</author>
		<author>
			<persName><forename type="first">R</forename><surname>Lessing</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Lutz</surname></persName>
		</author>
		<author>
			<persName><forename type="first">U</forename><surname>Visser</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Photogrammetrie -Fernerkundung -Geoinformation</title>
		<imprint>
			<biblScope unit="issue">6</biblScope>
			<biblScope unit="page" from="451" to="462" />
			<date type="published" when="2003">2003. 2003</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b3">
	<analytic>
		<title level="a" type="main">Ontology-driven geographic information systems</title>
		<author>
			<persName><forename type="first">Frederico</forename><forename type="middle">T</forename><surname>Fonseca</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Max</forename><forename type="middle">J</forename><surname>Egenhofer</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proceedings of the 7th ACM international symposium on Advances in geographic information systems</title>
				<meeting>the 7th ACM international symposium on Advances in geographic information systems<address><addrLine>New York, NY, USA</addrLine></address></meeting>
		<imprint>
			<publisher>ACM</publisher>
			<date type="published" when="1999">1999</date>
			<biblScope unit="page" from="14" to="19" />
		</imprint>
	</monogr>
	<note>GIS &apos;99</note>
</biblStruct>

<biblStruct xml:id="b4">
	<analytic>
		<title level="a" type="main">Sail: A spatial index library for efficient application integration</title>
		<author>
			<persName><forename type="first">Marios</forename><surname>Hadjieleftheriou</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Erik</forename><surname>Hoel</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Vassilis</forename><forename type="middle">J</forename><surname>Tsotras</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Geoinformatica</title>
		<imprint>
			<biblScope unit="volume">9</biblScope>
			<biblScope unit="issue">4</biblScope>
			<date type="published" when="2005">2005</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b5">
	<analytic>
		<title level="a" type="main">Distance browsing in spatial databases</title>
		<author>
			<persName><forename type="first">R</forename><surname>Gísli</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Hanan</forename><surname>Hjaltason</surname></persName>
		</author>
		<author>
			<persName><surname>Samet</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">ACM Transactions on Database Systems (TODS)</title>
		<imprint>
			<biblScope unit="volume">24</biblScope>
			<biblScope unit="issue">2</biblScope>
			<biblScope unit="page" from="265" to="318" />
			<date type="published" when="1999">1999</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b6">
	<analytic>
		<title level="a" type="main">Geospatial semantic web: Architecture of ontologies</title>
		<author>
			<persName><forename type="first">Dave</forename><surname>Kolas</surname></persName>
		</author>
		<author>
			<persName><forename type="first">John</forename><surname>Hebeler</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Mike</forename><surname>Dean</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">GeoSpatial Semantics</title>
				<meeting><address><addrLine>Berlin / Heidelberg</addrLine></address></meeting>
		<imprint>
			<publisher>Springer</publisher>
			<date type="published" when="2005">2005</date>
			<biblScope unit="page" from="183" to="194" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b7">
	<analytic>
		<title level="a" type="main">Openrulebench: An analysis of the performance of rule engines</title>
		<author>
			<persName><forename type="first">Senlin</forename><surname>Liang</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Paul</forename><surname>Fodor</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Hui</forename><surname>Wan</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Michael</forename><surname>Kifer</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proceedings of the 17th International World Wide Web Conference (WWW2008)</title>
				<meeting>the 17th International World Wide Web Conference (WWW2008)</meeting>
		<imprint>
			<date type="published" when="2008">2008</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b8">
	<analytic>
		<title level="a" type="main">Integrating ontological modelling and bayesian inference for urban pattern classification in topographic vector data</title>
		<author>
			<persName><forename type="first">Patrick</forename><surname>Lüscher</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Robert</forename><surname>Weibel</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Dirk</forename><surname>Burghardt</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Computers, Environment and Urban Systems</title>
				<imprint>
			<date type="published" when="2009">2009</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b9">
	<analytic>
		<title level="a" type="main">Jena: A semantic web toolkit</title>
		<author>
			<persName><forename type="first">Brian</forename><surname>Mcbride</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">IEEE Internet Computing</title>
		<imprint>
			<biblScope unit="volume">6</biblScope>
			<biblScope unit="issue">6</biblScope>
			<biblScope unit="page" from="55" to="59" />
			<date type="published" when="2002">2002</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b10">
	<analytic>
		<title level="a" type="main">Developing an interactions ontology for characterising pedestrian movement behavior</title>
		<author>
			<persName><forename type="first">Daniel</forename><surname>Orellana</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Chiara</forename><surname>Renso</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Movement-Aware Applications for Sustainable Mobility: Technologies and Approaches</title>
				<editor>
			<persName><forename type="first">Monica</forename><surname>Wachowicz</surname></persName>
		</editor>
		<imprint>
			<publisher>IGI Global Publishing</publisher>
			<date type="published" when="2009">2009</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b11">
	<analytic>
		<title level="a" type="main">Uncovering interaction patterns in mobile outdoor gaming</title>
		<author>
			<persName><forename type="first">Daniel</forename><surname>Orellana</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Monica</forename><surname>Wachowicz</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Natalia</forename><surname>Andrienko</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Gennady</forename><surname>Andrienko</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">International Conference on Advanced Geographic Information Systems &amp; Web Services</title>
				<imprint>
			<date type="published" when="2009">2009</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b12">
	<analytic>
		<title level="a" type="main">Combining ship trajectories and semantics with the simple event model (sem)</title>
		<author>
			<persName><forename type="first">Willem</forename><surname>Robert Van Hage</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Véronique</forename><surname>Malaisé</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Gerben</forename><surname>De Vries</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Guus</forename><surname>Schreiber</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Maarten</forename><surname>Van Someren</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proceedings of the 1st ACM International Workshop on Events in Multimedia</title>
				<meeting>the 1st ACM International Workshop on Events in Multimedia</meeting>
		<imprint>
			<publisher>Sheridan Publishers</publisher>
			<date type="published" when="2009">2009</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b13">
	<analytic>
		<title level="a" type="main">An optimized semantic web query language implementation in prolog</title>
		<author>
			<persName><forename type="first">Jan</forename><surname>Wielemaker</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proceedings of the 21st International Conference on Logic Programming</title>
				<meeting>the 21st International Conference on Logic Programming</meeting>
		<imprint>
			<publisher>ICLP</publisher>
			<date type="published" when="2005">2005. 2005</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b14">
	<analytic>
		<title level="a" type="main">Swi-prolog and the web</title>
		<author>
			<persName><forename type="first">Jan</forename><surname>Wielemaker</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Zhisheng</forename><surname>Huang</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Lourens</forename><surname>Van Der Meij</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Theory and Practice of Logic Programming</title>
				<editor>
			<persName><forename type="first">A</forename><surname>Bossi</surname></persName>
		</editor>
		<imprint>
			<publisher>Cambridge University Press</publisher>
			<date type="published" when="2008">2008</date>
			<biblScope unit="volume">8</biblScope>
			<biblScope unit="page" from="363" to="392" />
		</imprint>
	</monogr>
</biblStruct>

				</listBibl>
			</div>
		</back>
	</text>
</TEI>
