Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No results on working query #48

Open
guyg6802 opened this issue Jan 23, 2025 · 1 comment
Open

No results on working query #48

guyg6802 opened this issue Jan 23, 2025 · 1 comment

Comments

@guyg6802
Copy link

guyg6802 commented Jan 23, 2025

Hi Thanks for this great Plugin
I used the folowing query that work on wikibase

PREFIX wd: <https://timna-database.wikibase.cloud/entity/>
PREFIX wdt: <https://timna-database.wikibase.cloud/prop/direct/>
PREFIX p: <https://timna-database.wikibase.cloud/prop/>
PREFIX ps: <https://timna-database.wikibase.cloud/prop/statement/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?entity ?entityLabel ?coordinate (GROUP_CONCAT(DISTINCT ?periodLabel; separator=", ") AS ?periodLabels) (GROUP_CONCAT(DISTINCT ?categoryLabel; separator=", ") AS ?categories) ?longitude ?latitude
WHERE {
  ?entity wdt:P28 ?coordinate .
  
  ?entity p:P94 ?smeltingStatement .
  ?smeltingStatement ps:P94 wd:Q89 .

  ?entity p:P94 ?statement .
  ?statement ps:P94 ?category .
  ?category rdfs:label ?categoryLabel .
  FILTER (lang(?categoryLabel) = "en")

  ?entity rdfs:label ?entityLabel .
  FILTER (lang(?entityLabel) = "en")

  OPTIONAL { ?entity wdt:P26 ?longitude . }
  OPTIONAL { ?entity wdt:P27 ?latitude . }

  OPTIONAL {
    ?entity wdt:P93 ?period .
    ?period rdfs:label ?periodLabel .
    FILTER (lang(?periodLabel) = "en")
  }
}
GROUP BY ?entity ?entityLabel ?coordinate ?longitude ?latitude
LIMIT 300

using the endpoint https://timna-database.wikibase.cloud/query/sparql

it works on query services you can check here
but returns no results on QGIS

@situx
Copy link
Collaborator

situx commented Feb 3, 2025

I debugged this today, and the issue I experienced is related to the one described on StackOverflow:
https://stackoverflow.com/questions/78011761/python-sparqlwrapper-specifying-uris-doesnt-work

The plugin uses the library SPARQLWrapper to send queries to triple stores.
While this works for Wikidata and FactGrid (both Wikibase instances as well), the issue encountered for Wikibase Cloud instances seems to be that:

  • Queries without encoded URIs in <> and queries without the usage of prefixes return correct results
  • Queries with any of the two mentioned constructs simply return an empty result

The fact that this happens - so far - only on Wikibase Cloud instances leads me to believe that it could be a configuration issue in Wikibase Cloud.

Contrary to the description on StackOverflow, any combination of POST + Returnformat or GET+Returnformat does not seem to work for Wikibase.cloud instances.
Hence, no results can be queried in the plugin as of now.

I am also able to reproduce the error with the sample python code provided in the Wikibase.Cloud instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants