Introduction
GeoSPARQL is a standard for representation and querying of geospatial linked data for the Semantic Web from the Open Geospatial Consortium (OGC). It provides:
A vocabulary for representing geospatial data in RDF.
An extension to the SPARQL query language for processing geospatial data.
On top of the standard GeoSPARQL functions, AllegroGraph also implemented a few useful extentions, including Geohash indexing as well as proximity queries.
There is a tutorial demonstrating how to use GeoSPARQL in AllegroGraph using AllegroGraph's Python APIs. This tutorial can be found at https://github.com/franzinc/agraph-examples/blob/master/geosparql/geosparql-tutorial.ipynb.
We implement much the functionality specified by the Consortium. Here is a discussion of the implementation followed by a list of what is implemented.
GeoSPARQL contains a small spatial domain OWL ontology that allow literal representations of geometries to be associated with spatial features and for features to be associated with other features using spatial relations. GeoSPARQL also contains SPARQL extension function definitions that can be used to calculate relations between spatial objects. Several other supporting assets are also contained within GeoSPARQL such as vocabularies of Simple Feature types and data validators. The namespace for the GeoSPARQL ontology is
<http://www.opengis.net/ont/geosparql#>
The suggested prefix for this namespace is geo
. The namespace for the GeoSPARQL functions is
<http://www.opengis.net/def/function/geosparql/>
The suggested prefix for this namespace is geof
. That is, queries should have these prefixes defined:
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
See the Namespaces and query options for information on defining namespaces to the system so PREFIXes need not be added to every query.
Here are the implemented features. Each (except the AllegroGraph-specific extensions) is described in detail in the OGC GeoSPARQL - A Geographic Query Language for RDF Data document (search for the name without the prefix).
Serialization format (recognized in AllgroGraph):
- geo:wktLiteral
- geo:asWKT
- geo:geoJSONLiteral
- geo:asGeoJSON
Simple Features Relation Family provided as magic properties
- geo:sfEquals
- geo:sfDisjoint
- geo:sfDisjoint
- geo:sfTouches
- geo:sfWithin
- geo:sfContains
- geo:sfOverlaps
- geo:sfCrosses
Simple Features Relation Family provided as SPARQL functions
- geof:sfEquals
- geof:sfDisjoint
- geof:sfDisjoint
- geof:sfTouches
- geof:sfWithin
- geof:sfContains
- geof:sfOverlaps
- geof:sfCrosses
Egenhofer Relation Family provided as SPARQL functions
- geof:ehEquals
- geof:ehDisjoint
- geof:ehMeet
- geof:ehOverlap
- geof:ehCovers
- geof:ehCoveredBy
- geof:ehInside
- geof:ehContains
RCC8 Relation Family provided as SPARQL functions
- geof:rcc8eq
- geof:rcc8dc
- geof:rcc8ec
- geof:rcc8po
- geof:rcc8tppi
- geof:rcc8tpp
- geof:rcc8ntpp
- geof:rcc8ntppi
Non-topological Query Functions
- geof:isEmpty
- geof:convexHull
- geof:intersection
- geof:union
- geof:difference
- geof:symDifference
- geof:envelope
- geof:centroid
- geof:getSRID
- geof:distance
**Franz's extentions (provided as magic properties. The geoext
namespace expands to http://franz.com/ns/allegrograph/3ns-allegrograph-3.0-geosparql-ext.html.0/geosparql/ext#
)
- geoext:haversineDistance
- geoext:buildGeohashIndex
- geoext:rebuildGeohashIndex
- geoext:nearby