SPARQL request on qualifiers?

ghz 8months ago ⋅ 118 views

I saw the following SPARQL query successfully requesting Publication date (P577) qualifiers (link) :

SELECT ?title ?item ?date ?place ?placeLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  ?item wdt:P161 wd:Q38111.
  ?item wdt:P1476 ?title.
  # Get qualifiers
  ?item p:P577 ?statement. 
  ?statement ps:P577 ?date. 
  ?statement pq:P291 ?place.
}

I replicated this grammar to request Pronunciation (P443) qualifiers, but the following fails (link) :

SELECT ?id ?idLabel ?audio ?audioLabel ?audioFile ?audioLangLabel ?speakerLabel
WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  ?id wdt:P443 ?audio.
  FILTER(CONTAINS(STR(?audio), "LL-Q117707514")) # occitan whistled -Q117707514
  # ?id wdt:P625 ?coord . # geocoordinates
  OPTIONAL {  
    ?id p:443 ?audioStatement .
    ?audioStatement ps:P443 ?audioFile.
    ?audioStatement pq:P407 ?audioLang.
    ?audioStatement pq:P10894 ?speaker.
    }
}

Any clue ?

Answers

It looks like you're trying to retrieve information about pronunciations with specific qualifiers using SPARQL. Your query seems mostly correct, but there are a couple of things to check:

  1. Ensure that the property ID for Pronunciation (P443) is correct. You've used wdt:P443, which is for direct statements. If you want to retrieve qualifiers, you should use p:P443 instead.

  2. Check if the property IDs for the qualifiers (P407, P10894) are correct.

Here's the corrected query:

SELECT ?id ?idLabel ?audio ?audioLabel ?audioFile ?audioLangLabel ?speakerLabel
WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  ?id wdt:P443 ?audio.
  FILTER(CONTAINS(STR(?audio), "LL-Q117707514")) # occitan whistled -Q117707514
  OPTIONAL {  
    ?id p:P443 ?audioStatement .
    ?audioStatement ps:P443 ?audioFile.
    ?audioStatement pq:P407 ?audioLang.
    ?audioStatement pq:P10894 ?speaker.
  }
}

Make sure to verify the property IDs (P443, P407, P10894) and adjust them accordingly if needed. Additionally, ensure that the value you're filtering for (occitan whistled) matches the actual value in the data. If you're still encountering issues, double-check the structure of the data and the availability of the information you're querying for.