MELODIES Final Event

Demo data
GeoTriples distributable archive (Unix/Linux/Windows)


Publishing geospatial data as Linked Open Geospatial Data

stRML Specification


Assuming git, Maven and Java installed:

$ git clone
$ cd GeoTriples
$ mvn package
$ java -jar target/geotriples-<version>-cmd.jar [Options] [Argument]

[Optional: Add an alias for executing the jar file with command `geotriples-cmd`]
$ echo "alias geotriples-cmd='java -jar `pwd`/target/geotriples-<version>-cmd.jar'" >> ~/.bashrc

GeoTriples Modes

GeoTriples consists of three modules. The Mapping Generator which automatically produces an R2RML/RML mapping file according to the input source's schema, the R2RML/RML processor which processes an R2RML/RML mapping and generates an RDF graph, and finally the Ontology Based Data Access (OBDA) module that evaluates stSPARQL/GeoSPARQL queries over a relational database.

Automatic generation of R2RML/RML mappings

$ geotriples-cmd generate_mapping -b baseURI [-u user] [-p password] [-d driver] [-o mappingFile] [-rml] jdbcURL
$ geotriples-cmd generate_mapping -b baseURI [-o mappingFile] [-rml] fileURL
$ geotriples-cmd generate_mapping -b baseURI [-o RMLmappingFile] [-rp rootpath] [-r rootelement] [-onlyns namespace] [-ns namespaces] [-x XSDfile] fileURL

Transformation into RDF

$ geotriples-cmd dump_rdf [-rml] [-f format] [-b baseURI] [-o rdfoutfile]  -u user -p password -d driver -j jdbcURL inputmappingfile
$ geotriples-cmd dump_rdf [-rml] [-f format] [-b baseURI] [-o rdfoutfile] [-s epsgcode] [-sh fileURL] inputmappingfile
$ geotriples-cmd dump_rdf  -rml [-f format] [-b baseURI] [-o rdfoutfile] [-s epsgcode] inputRMLmappingfile

GeoTriples Architecture

GeoTriples comprises three main components: the mapping generator, R2RML/RML processor and the ontop-spatial OBDA evaluator. The mapping generator takes as input a data source and creates automatically an R2RML or RML mapping that transforms it into an RDF graph. The generated mapping is enriched with subject and predicate-object maps, in order to take into account the specifities of geospatial data and cater for all transformations that are needed to produce an RDF graph that is compliant with the GeoSPARQL vocabulary. To accomplish this task, we extend R2RML mappings to allow the representation of a transformation function over input data. Afterwards, the user may edit the generated R2RML mapping document to comply with her requirements (e.g., use a different vocabulary).


RML Processor

GeoTriples supports the RML mapping language by extending the RML processor to address the spatial information. RML is a mapping language, very similar to R2RML. The main difference is that RML is designed to allow the process of data that do not necessarily rely in tables and thus not having an explicit iteration pattern.

For example, the farms.xml (see below) cannot be iterated in per row fashion, because it has nested elements.

   <Field id="1">
      <Farmer>John Vl</Farmer>
             <gml:posList>0,0 100,0 100,100 0,100 0,0</gml:posList>
   <Field id="2">
      <Farmer>Harper Lee</Farmer>
      <Geometry id=1>
             <gml:posList>100,100 200,100 200,200 100,200 100,100</gml:posList>
   <Field id="3">
      <Farmer>Bruce Pom</Farmer>

R2RML uses the property rr:tableName to define which table from the input file or the relational database it going to be used as the source table for the mappings. RML has the equivalent rml:source to define the source for the mappings. The source can be a JDBC URL for a relational database, a Shapefile, an XML, JSON or CSV file. The iterator property rml:iterator defines the iterating pattern in order to process non-relational structured files. For the above example the iterator should be an XPath query.

An example RML mapping can be the following

    rml:logicalSource [
     rml:source "/fields.xml";
     rml:referenceFormulation ql:XPath;
     rml:iterator "/Farm/Field"];

    rr:subjectMap [
     rr:class ont:Farm;
     rr:class ogc:Feature;
     rr:template "{@id}"];

    rr:predicateObjectMap [
     rr:predicate ont:hasVigor;
     rr:objectMap [
       rml:reference "Vigor"]];

    rr:predicateObjectMap [
     rr:predicate ont:hasFarmer;
     rr:objectMap [
       rml:reference "Farmer"]].

    rr:predicateObjectMap [
     rr:predicate ogc:hasGeometry;
     rr:objectMap [
       rr:template "{Geometry/@id}"]].

    rml:logicalSource [
     rml:source "/fields.xml";
     rml:referenceFormulation ql:XPath;
     rml:iterator "/Farm/Field/Geometry"];

    rr:subjectMap [
     rr:class ont:FieldGeometry;
     rr:class ogc:Geometry
     rr:template "{@id}"];

    rr:predicateObjectMap [
     rr:predicate ogc:dimension;
     rr:objectMap [
       rrx:function rrxf:dimension;
       rrx:argumentMap ([rml:reference "*"]) ];

    rr:predicateObjectMap [
     rr:predicate ogc:asWKT;
     rr:objectMap [
       rrx:function rrxf:asWKT;
       rrx:argumentMap ([rml:reference "*"]) ].

This mapping contains two triples maps: <#Field> and <#FieldGeometry>. Both triples maps uses an XPath iterator, denoted by rml:referenceFormulation, as the base iterator pattern that will be used by the mapping processor module for the generation of the graph. The rml:reference is used instead of rr:column R2RML's property . The value of rml:reference property extends the iterator in order to point at an element.

GeoTriples as Maven Dependency

Developers can use GeoTriples as a dependency project using Apache Maven dependency mechanism. Bellow we illustrate a demo pom.xml file that has GeoTriples as a dependency to the project.

<project xmlns="" xmlns:xsi=""
      <description>test project</description>