sparqlunicorn / sparqlunicornGoesGIS

SPARQLing Unicorn QGIS Plugin (Documentation: https://sparqlunicorn.github.io/sparqlunicornGoesGIS/)
https://plugins.qgis.org/plugins/sparqlunicorn/
GNU General Public License v2.0
27 stars 6 forks source link

Unable to add new Triple store #20

Closed rduivenvoorde closed 3 years ago

rduivenvoorde commented 3 years ago

Hi, First thanks for your plugin! It is supercool to be able to query sparql endpoints and view the results in QGIS!!!

In The Netherlands one of your national 'base'-geo registries has a sparql endpoint. On this page: https://bag.basisregistraties.overheid.nl/

you can link to some example queries, run in : https://www.pdok.nl/sparqlviewer#

You see some example queries in there, for example the first 100 houses (BAG = Base Registration Buildings in NL) build in 1923:

PREFIX bag: <http://bag.basisregistraties.overheid.nl/def/bag#>
SELECT ?x WHERE {
 ?x a bag:Pand.
 ?x bag:oorspronkelijkBouwjaar ?bouwjaar.
 FILTER (?bouwjaar = 1923)
}
LIMIT 100

BUT if I try to use one of that examples, I try to Configure my Own Triple store, but whatever I try (I'm pretty green in this though), after clicking 'Test Connection', or 'Apply', the dialog freezes without being able to use QGIS anymore... See also my comment in https://github.com/sparqlunicorn/sparqlunicornGoesGIS/issues/18#issuecomment-706563181 about using QGIS classes, timeouts etc Any help or documentation in making this examples work would be a nice example of actually USING linked data in a GIS setting... and is worth a blog post on https://qgis.nl I'm happy to give you edit access if you want to write something about QGIS, your plugin and linked data (preferably speaking with our national endpoints :-) ) Thanks again for your work!

situx commented 3 years ago

Thank you for your feedback!

Several aspects play a role here: At first you have encountered an issue that we want to fix in the next version: To use QgsTasks to outsource everything related to network and processing into separate tasks so that they do not interfer with the GUI. (and so that you could also load two or more layers at once) QGIS freezing or crashing in your case is likely an issue of the plugin trying to connect to the triple store but not being able to make the connection. In the master branch we have already implemented most of the work, but there are still some bugs left to solve, mainly labels currently do not load with QgsTasks which they do in the non-tasked version.

Secondly, yes we should provide a better documentation, in fact it is a TODO since several months. Maybe I should start documenting a bit today, at least the configuration files.

As for your specific usecase, I tried it just now and I can load Bunkers and your sample query. See here

I prepared a configuration file which includes sample queries and a configuration for your triplestores for the plugin here: https://gist.github.com/situx/152f9dad87059c6bd1ae9e29198756e9 To use it go to your QGIS Plugins directory (C:/Users/USERNAME/AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins/sparqlunicorn/ on Windows) and replace the triplestoreconf_personal.json file with the version I uploaded. I added some documentation about the contents of the configuration file to the README of this repository.

As for the blogpost we are always happy to spread the word and also to find more developers as this is currently the project of two people, with previous experience in Python, but with no prior experience in programming for QGIS. So we would be happy to contribute something to the blogpost. If you think it is useful we can also add your triple stores to the official list of triple store addresses delivered with the plugin. Then after the next release it should work without prior configuration like e.g. Wikidata.

rduivenvoorde commented 3 years ago

Thanks for making the example work I think a picture works better then 100 words, misusing your work here ;-)

bunkersInNl

situx commented 3 years ago

Another but serverside approach for you to expose geospatial data from SPARQL endpoints in QGIS is to expose featurecollections as wfs or ogc api features using a semantics aware wfs service. https://github.com/i3mainz/semanticwfs This service allows to define featurecollections from SPARQL resultsets so that a SPARQL endpoint may actually be accessible using geospatial webservices. Test instance here: https://www.i3mainz.de/projekte/bkg/semanticwfs/collections?f=html

situx commented 3 years ago

Next release will feature work towards automatic configuration detection of triple stores. In particular, triple stores using the GeoSPARQL ontology should work with the autoconfiguration setting "out of the box". Other triple stores which do not conform to this vocabulary might need further manual configurations

situx commented 3 years ago

Version 0.12 allows you to add your own triple stores using automated configuration if it contains the GeoSPARQL vocabulary. Configuration should be much simpler now.