QGISSPARQL

A QGIS plugin for bidirectional integration between Linked Data (RDF/SPARQL) and GIS.

Overview

Repository: https://github.com/LambdaGeo/qgissparql

Creators: Sérgio Souza Costa, Nerval de Jesus Santos Junior, Felipe Martins Sousa, José Magno Pinheiro Alves, and Denilson da Silva Bezerra

QGISSPARQL is a QGIS plugin that enables bidirectional integration between Linked Data (RDF/SPARQL) and Geographic Information Systems (GIS). It unifies the former Triple2Layer and Layer2Triple plugins into a single package with one dock interface:

  • 🔽 Triple → Layer (Import): query a SPARQL endpoint (Virtuoso, Apache Jena Fuseki) or a data.world dataset and load the results directly as a QGIS vector layer.
  • 🔼 Layer → Triple (Export): convert a vector layer (point, line, or polygon) into RDF triples, serialized as Turtle (.ttl), following GeoSPARQL/Data Cube vocabularies.

JOSS QGIS Python Windows | Linux

Features

🔽 Triple → Layer (Import)

  • Query any SPARQL 1.1 endpoint, with integration for data.world datasets.
  • Background execution (non-blocking tasks).
  • Automatic geometry detection from WKT.
  • Dynamic attribute mapping.

🔼 Layer → Triple (Export)

  • Convert vector layers (point, line, polygon) to RDF, with Turtle serialization.
  • URI generation strategies (UUID or attribute-based).
  • Mapping of attributes to RDF vocabularies (GeoSPARQL, SKOS, Data Cube).
  • Searchable, autocompleting URI selection.

🧠 Shared Interface

  • Unified dock with Import / Export tabs.
  • Vocabulary loading (GeoSPARQL, DataCube, SKOS, FOAF).
  • Persistent configuration, including data.world API tokens.

Interface

Triple → Layer (Import): query a SPARQL endpoint and load results as a QGIS layer.
Layer → Triple (Export): map layer attributes to RDF and export to .ttl.

Installation

⚠️ Requires QGIS 3.4 or later.

1. Install the plugin

git clone https://github.com/LambdaGeo/qgissparql

Copy the folder to your QGIS plugins directory:

  • Linux: ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/
  • Windows: %APPDATA%\QGIS\QGIS3\profiles\default\python\plugins\

Restart QGIS and enable it via Plugins → Manage and Install Plugins.

2. Install Python dependencies

# Linux
pip install pandas setuptools --break-system-packages
pip install datadotworld SPARQLWrapper rdflib --break-system-packages

# Windows (OSGeo4W Shell)
pip install pandas setuptools datadotworld SPARQLWrapper rdflib

How to Use

Both directions are reached from Vector → QGISSPARQL → Open Dock.

Import (Triple → Layer):

  1. Select the source type (SPARQL endpoint or data.world).
  2. Write or load a SPARQL query.
  3. Define the geometry column (WKT).
  4. Execute the import — the layer appears in your QGIS workspace.

Export (Layer → Triple):

  1. Select a vector layer and load a vocabulary (e.g. GeoSPARQL).
  2. Map each attribute to a constant, a layer attribute, or a vocabulary concept.
  3. Configure the Base URL, Prefix, and RDF Type.
  4. Export to .ttl.

Part of the DisSModel Ecosystem

QGISSPARQL is one of the companion tools in LambdaGeo’s broader research trajectory toward reproducible, interoperable spatial modeling — alongside DisSModel and TerraHS.