query-8ec52dd3e363daa755abdbb111796ccc
Reality checkI presume I'm doing something wrong with the SPARQL, but can't see it. I'm looking for normal rank statements that have a 'reason for preferred rank' qualifier. On the face of it, some are being found. But when I check the statement in the WD UI, it's set to preferred rank.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT distinct ?item ?itemLabel ?statement ?property ?propertyLabel ?rank
WHERE
{
?statement pq:P7452 []. # statement has a qualifier "reason for preferred rank"
?statment wikibase:rank wikibase:NormalRank . # statement is of normal rank
?statment wikibase:rank ?rank. # get the rank anyway
?item ?predicate ?statement . # link the statement to an item
?property wikibase:claim ?predicate . # ensure the predicate is p:
} limit 100
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?item"):::projected
v5("?predicate")
v6("?property"):::projected
v3("?rank"):::projected
v1("?statement"):::projected
v2("?statment")
a1((" "))
c3(["wikibase:NormalRank"]):::iri
v1 --"p:qualifier/P7452"--> a1
v2 --"wikibase:rank"--> c3
v2 --"wikibase:rank"--> v3
v4 -->v5--> v1
v6 --"wikibase:claim"--> v5