This project has retired. For details please refer to its Attic page.
Apache Marmotta - GeoSPARQL

GeoSPARQL

The OGC GeoSPARQL standard supports representing and querying geospatial data on the Semantic Web. GeoSPARQL defines a vocabulary for representing geospatial data in RDF, and it defines an extension to the SPARQL query language for processing geospatial data. In addition, GeoSPARQL is designed to accommodate systems based on qualitative spatial reasoning and systems based on quantitative spatial computations.

In cooperation with the GSoC2015, in version 3.4.0 we have added GeoSPARQL support to our SPARQL implementation.

Warning! Because some portability issues, GeoSPARQL support has not been shipped as part of any public release. We expect to manage to solve it in a future release. In the meantime, you need to build branch MARMOTTA-584 manually from the source code.

Further technical details can be found in the wiki.

Besides our mailing lists, if you are interested about geospatial technologies in a broader way, there is a dedicated geospatial@apache.org mailing list as a common space with other projects, both within Apache (e.g., SIS) and externally (e.g., Eclipse LocationTech).

Maven Artifact

The GeoSPARQL implementation is available in the kiwi-geosparql module. To include it in a project that uses the KiWi Triple Store, you need to add the following dependency to your Maven project:

 <dependency>
     <groupId>org.apache.marmotta</groupId>
     <artifactId>kiwi-geosparql</artifactId>
     <version>3.4.0-SNAPSHOT</version>
 </dependency>

Installation Considerations

Please, take into account that GeoSPARQL support is only available when you are using PostgreSQL as backend for KiWi.

In PostgreSQL, it is necessary to install the PostGIS extension into the Marmotta database. Depending on your operating system and distribution, this might also require installation of additional software packages (under Debian: postgis). To install the postgis extension, connect to the database as superuser and run:

CREATE EXTENSION IF NOT EXISTS postgis; 

Example

The following query shows an example how to use the extension for the language:

PREFIX geoes: <http://geo.marmotta.es/ontology#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>

SELECT DISTINCT ?labelMunicipios 
WHERE {  
  ?subject a <http://geo.marmotta.es/ontology#provincia>.
  ?subject rdfs:label "Madrid"@es.
  ?subject geoes:hasExactGeometry ?geo.
  ?geo geo:asWKT ?wkt.
  
  ?subject2 a <http://geo.marmotta.es/ontology#municipio>.
  ?subject2 rdfs:label ?labelMunicipios.
  ?subject2 geoes:hasExactGeometry ?geo2.
  ?geo2 geo:asWKT ?wkt2.
  
  FILTER (geof:sfContains(?wkt, ?wkt2))
} 
ORDER BY ?labelMunicipios
LIMIT 10

You can find more usage examples at the user documentation.