Skip to content

RDF resources support and autodetection

Timo edited this page Nov 14, 2022 · 7 revisions

Several kinds of RDF resources can be used with the SPARQLing Unicorn QGIS plugin. This page lists how to access different RDF resources.

Importing Resources

Autodetection

The autodetection dialog of the SPARQLing Unicorn QGIS plugin allows the detection of RDF contents in:

  • SPARQL endpoints
  • RDF files
  • RDF files accessible on the internet using a URI

image

To add a new resource, choose the resource type, add a name and its URL or file path, and if necessary, credentials if the file or SPARQL endpoint is behind an HTTP-authenticated server.

Irrespective of the RDF resource, the plugin will attempt an autoconfiguration of the following elements in the knowledge graph:

Detection of geometry vocabularies

The SPARQLing Unicorn QGIS plugin can currently detect the following vocabularies being used in a SPARQL endpoint:

Detection of namespaces

The SPARQLing Unicorn QGIS plugin tries to detect namespaces of the respective knowledge graph using the following three queries:

SELECT DISTINCT ?ns WHERE { ?s ?p ?o . BIND(replace(str(?s), \"(#|/)[^#/]*$\", \"$1\" ) AS ?ns )} LIMIT 10

SELECT DISTINCT ?ns WHERE { ?s ?p ?o . BIND(replace(str(?p), \"(#|/)[^#/]*$\", \"$1\" ) AS ?ns )} LIMIT 10

SELECT DISTINCT ?ns WHERE { ?s ?p ?o . BIND(replace(str(?o), \"(#|/)[^#/]*$\", \"$1\" ) AS ?ns )} LIMIT 10

That is, up to ten distinct namespaces for resources in the subject, predicate, and object position are attempted to be detected. If a prefix is known by prefix.cc, the prefix will be registered in the automatically generated endpoint configuration.

Depending on the implementation of the triple store, the execution of these queries may be resource-intensive. Therefore, their execution is optional.

SPARQL Endpoints

For SPARQL endpoints, in addition to the previously mentioned detection of graph structures, test queries evaluate:

  • GeoSPARQL compatibility of the SPARQL endpoint
  • SPARQL 1.1 compatibility

Local RDF Files

The SPARQLing Unicorn QGIS plugin uses RDFLib to process local RDF files. Hence, the query capabilities of local files mimic those of RDFLib. It is possible to load one RDF file or a list of RDF files, which can be selected from a QGIS file widget. If many RDF files are selected, the combined graph of all RDF files will be accessible in the SPARQL Unicorn QGIS plugin. As for writing these lines, the plugin cannot cache parsed RDF files until a restart of QGIS. The files need to be added again when the plugin is restarted.

RDF resources shared as URIs

The SPARQLing Unicorn QGIS plugin uses RDFLib to process resources shared as URIs. Hence, the query capabilities of local files mimic those of RDFLib.

Solid Pods

Support for Solid pods might be added in the future and depends on the implementation of a link resolver.

Exporting Resources

RDF resources can be exported in any format that is supported by RDFLib, but at least in the following formats: