Re: SPARQL GEO and SQL GIS extensions

For those of you working with ARQ, I have some related
experimentation using ARQ 2.5 and an open source RTree
index.  The index is built by first looking at the
graph and storing the URI's into an RTree structure
based on the node's latitude and longitude
(wgs84_pos).  I used LARQ (a lucene index extension)
as a model and adapted the pattern for spatial

geo:nearby(lat lon limit), used in an example query...

PREFIX geo: <java:org.geospatialweb.arqext.
SELECT ?n WHERE { ?s geo:nearby(51.45 -2.5833333 30) .
?s a :Hotel . ?s :name ?n }

nearby() will reduce the graph down to a limited set
of nodes that are "nearest" the given latitude and
longitude, after which you can further restrict the
results, in this example we're looking for only
hotels, and then binding the name to ?n.  To run the
extension you'll need to be familiar with running ARQ
in a java dev environment.  The advantage of the RTree
is that we're not just filtering the RDF, we're
quickly getting  a subset of the graph that is nearest
to our target.  It also supports a bounding  box style

geo:within(lat lon lat2 lon2) 
(lower corner first, then upper corner)

Here's an example of using the functions on a geonames
dump of GB:

Data set:

Extension functions jar (at a minimum you'd need to
add this to your ARQ distribution to run the example):

The ARQ extension implementation is there in the trunk
as well:

Notice the index itself is built by first running a
SPARQL query to select candidate nodes:

PREFIX geo: <>
SELECT ?s ?lat ?lon
WHERE {?s geo:lat ?lat . ?s geo:long ?lon}

So hypothetically, you could make some small changes
and have the index built upon any ontology that has a
lat/lon value.


Never miss a thing.  Make Yahoo your home page.

Received on Monday, 4 February 2008 22:00:45 UTC