QGISSPARQL - Triple2Layer

A QGIS plugin to import Linked Data into geographic layers.

Overview

Repository: https://github.com/LambdaGeo/qgisparql-triple2layer/

Creators: Sérgio Souza Costa and Nerval Junior

This plugin aims to import data from a connected database and convert it into a geographic data layer in the QGIS geographic information system (GIS).


Python QGIS VS 2022 Windows Linux

How to Use

💡 The screenshots for this documentation were taken in QGIS 3.26.3 running on Windows. Depending on your setup, the screens you encounter might look a bit different. However, all the same buttons will still be available, and the instructions will work on any operating system. You will need QGIS 3.4 or later to use this plugin.

⚠️ Before starting, the Triple2Layer plugin must be installed on your computer.

Interface and Access

To use Triple2Layer, open QGIS and navigate to the Vector menu. You will be able to access the plugins of DBCells in the QGISPARQL cell.

Figure 1: Tool menu showing the Triple2Layer access.

The initial interface (Figure 2) is divided into two main parts: information about the loaded file/endpoint and a table for attribute mapping.

Figure 2: Initial interface of the Triple2Layer plugin.

Importing Data

Step 1: Defining the Layer Name

Enter the name for the new geographic layer (e.g., "ACRE").

Step 2: Defining the Source (Linked Data)

The plugin supports two sources:

  • Triple Store Endpoints (Virtuoso, Apache Jena Fuseki)
  • Data.world Datasets

Data must include a geometric attribute, typically using the geo:asWKT predicate. Example:

@prefix cells: <https://purl.org/linked-data/dbcells#> .
@prefix geo:   <http://www.opengis.net/ont/geosparql#> .

<https://purl.org/dbcells/epsg4326#R0_0830Cx-34_7917Cy-6_9714>
    a cells:Cell ;
    geo:asWKT "Polygon ((-34.833 -6.929, ...))" .

Step 3: SPARQL Query

Load a .sparql file to filter the triples you need. For example:

SELECT ?cell ?resolution ?wkt
WHERE {
  ?cell geo:asWKT ?wkt .
  ?cell dbc:resolution ?resolution .
  ?cell sdmx-dimension:refArea "AC" .
}

Step 4: Attribute Mapping

Define which SPARQL variables correspond to:

  • Geometry — WKT format supported
  • Identifier — Primary key
  • Attributes — String, Int, or Double

Step 5: Execution

Click “Import”. Once the process finishes, the layer will appear in your QGIS workspace. You can open the attribute table (F6) to verify the imported data.