Get started

Your first spatial query in two minutes

You need Docker, or Rust if you prefer to build from source. Nothing else: TripleTrail is one program with its web interface built in.

1

Start the server

This runs TripleTrail on your machine and keeps its data in a Docker volume. Then open http://localhost:7878 in your browser.

Without Docker: install Rust and run cargo install --locked --path crates/tripletrail-server in a copy of the source.

terminalshell
docker run -p 7878:7878 -v tripletrail-data:/data \
  ghcr.io/matdata-eu/tripletrail
2

Add some data

Save these three stations as stations.ttl and send them to the server. In the web interface you can also drop the file on the upload page.

stations.ttlTurtle
@prefix ex:   <http://example.org/> .
@prefix geo:  <http://www.opengis.net/ont/geosparql#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

ex:brussels a ex:Station ; rdfs:label "Brussels Central" ;
  geo:hasGeometry [ geo:asWKT "POINT(4.3571 50.8456)"^^geo:wktLiteral ] .
ex:leuven a ex:Station ; rdfs:label "Leuven" ;
  geo:hasGeometry [ geo:asWKT "POINT(4.7158 50.8813)"^^geo:wktLiteral ] .
ex:antwerp a ex:Station ; rdfs:label "Antwerp Central" ;
  geo:hasGeometry [ geo:asWKT "POINT(4.4211 51.2172)"^^geo:wktLiteral ] .
curl http://localhost:7878/ds/data -H 'Content-Type: text/turtle' --data-binary @stations.ttl
3

Ask where things are

Open Query in the web interface and run this. Switch to the map view to see the stations, or open Map to browse everything in the dataset.

  • Every SPARQL client works: Python, R, Java, curl
  • QGIS can read the same data through OGC API Features at /ds/ogc
QuerySPARQL
PREFIX geo:  <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX uom:  <http://www.opengis.net/def/uom/OGC/1.0/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?name ?km WHERE {
  ?station rdfs:label ?name ;
           geo:hasGeometry/geo:asWKT ?wkt .
  BIND(geof:distance(?wkt,
       "POINT(4.3571 50.8456)"^^geo:wktLiteral,
       uom:metre) / 1000 AS ?km)
  FILTER(?km < 50)
} ORDER BY ?km