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

error 500 on a working query #46

Open idshklein opened 1 month ago

idshklein commented 1 month ago

Hi, thanks for this groundbreaking plugin. I try to run this query :

SELECT ?item ?label ?date ?geo WHERE {
  SERVICE wikibase:box {
    ?item wdt:P625 ?geo.
    bd:serviceParam wikibase:cornerWest "Point(34.2654333839 29.5013261988)"^^geo:wktLiteral;
      wikibase:cornerEast "Point(35.8363969256 33.2774264593)"^^geo:wktLiteral.
  }
  ?item wdt:P585 ?date.
  FILTER(((YEAR(?date)) = 2023 ) && ((MONTH(?date)) = 10 ))
  ?item rdfs:label ?label.
  FILTER((LANG(?label)) = "en")
}

on a wikidata sparql endpoint. In wikidata query service, it is valid and working link however, in the plugin, I get error 500. i cant understand why, your help will be a appreciated.

situx commented 1 month ago

Hello @idshklein thank you for your bug report. The plugin adds namespaces in the form of prefixes to SPARQL queries automatically in the background for user convenience. For Wikidata, your query becomes:

PREFIX geo: <http://www.opengis.net/geosparql#>
PREFIX wd: <http://www.wikidata.org/entity/> 
PREFIX wds: <http://www.wikidata.org/entity/statement/> 
PREFIX wdv: <http://www.wikidata.org/value/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/> 
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/> 
PREFIX pq: <http://www.wikidata.org/prop/qualifier/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX bd: <http://www.bigdata.com/rdf#> 
PREFIX wdref: <http://www.wikidata.org/reference/> 
PREFIX psv: <http://www.wikidata.org/prop/statement/value/> 
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/> 
PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
PREFIX pqn: <http://www.wikidata.org/prop/qualifier/value-normalized/> 
PREFIX pr: <http://www.wikidata.org/prop/reference/> 
PREFIX prv: <http://www.wikidata.org/prop/reference/value/> 
PREFIX prn: <http://www.wikidata.org/prop/reference/value-normalized/> 
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX wdata: <http://www.wikidata.org/wiki/Special:EntityData/> 
PREFIX schema: <http://schema.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX bds: <http://www.bigdata.com/rdf/search#> 
PREFIX gas: <http://www.bigdata.com/rdf/gas#>
PREFIX hint: <http://www.bigdata.com/queryHints#> 
SELECT ?item ?label ?date ?geo WHERE {
  SERVICE wikibase:box {
    ?item wdt:P625 ?geo.
    bd:serviceParam wikibase:cornerWest "Point(34.2654333839 29.5013261988)"^^geo:wktLiteral;
                    wikibase:cornerEast "Point(35.8363969256 33.2774264593)"^^geo:wktLiteral.
  }
  ?item wdt:P585 ?date.
  FILTER(((YEAR(?date)) = 2023 ) && ((MONTH(?date)) = 10 ))
  ?item rdfs:label ?label.
  FILTER((LANG(?label)) = "en")
}

Interestingly, when I execute this query in the Wikidata query editor I get a null pointer exception. I do not yet understand why, but I will further investigate.

situx commented 1 month ago

It would seem the error is caused by PREFIX geo: http://www.opengis.net/geosparql#

I see nothing wrong here, maybe a bug in Wikibase? https://phabricator.wikimedia.org/T376761 All I can do is rename geo: to geosparql: for instance so that the error does not occur anymore and we could report this to Wikibase?

situx commented 1 month ago

Apparently, I made a mistake when specifying namespaces in the plugin configuration and the default configuration is now corrected for the next release https://github.com/sparqlunicorn/sparqlunicornGoesGIS/commit/89e04f43755a57c7304a5479a6cf901b0dab622b