query-3ca4959da38aa4779d30b92d7898634f

rq turtle/ttl

checks for a P8687-statement for the numeric id in the current year

skips usernames with end date, missing or unknown numeric ids, deprecated rank

SELECT ?item ?username ?id WHERE { VALUES ?goodRanks { wikibase:NormalRank wikibase:PreferredRank } ?item p:P2002 ?st. ?st pq:P6552 ?id. MINUS { ?st0 pq:P6552 ?id; pq:P585 ?d. [] p:P8687 ?st0. FILTER(?d > "2023-31-12"^^xsd:dateTime) } ?st wikibase:rank ?goodRanks . ?st ps:P2002 ?username. MINUS { ?st pq:P582 [] } FILTER(!(wikibase:isSomeValue(?id))) } LIMIT 100

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
# checks for a P8687-statement for the numeric id in the current year
# skips usernames with end date, missing or unknown numeric ids, deprecated rank
SELECT ?item ?username ?id
WHERE
{
  VALUES ?goodRanks { wikibase:NormalRank wikibase:PreferredRank }
  ?item p:P2002 ?st.
  ?st pq:P6552 ?id.
  MINUS {
    ?st0 pq:P6552 ?id; pq:P585 ?d. [] p:P8687 ?st0.
    FILTER(?d > "2023-31-12"^^xsd:dat)
  }
  ?st wikibase:rank ?goodRanks .
  ?st ps:P2002 ?username.
  MINUS { ?st pq:P582 [] }
  FILTER(!(wikibase:isSomeValue(?id)))
}
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?d") v2("?goodRanks") v1("?id"):::projected v3("?item"):::projected v4("?st") v6("?st0") v7("?username"):::projected a1((" ")) a2((" ")) f0[["not http://wikiba.se/ontology#isSomeValue(?id)"]] f0 --> v1 bind1[/VALUES ?goodRanks/] bind1-->v2 bind10(["wikibase:NormalRank"]) bind10 --> bind1 bind11(["wikibase:PreferredRank"]) bind11 --> bind1 v3 --"p:P2002"--> v4 v4 --"p:qualifier/P6552"--> v1 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; f3[["?d > s2023-31-12^^<http://www.w3.org/2001/XMLSchema#dat>'"]] f3 --> v5 v6 --"p:qualifier/P6552"--> v1 v6 --"p:qualifier/P585"--> v5 a1 --"p:P8687"--> v6 end v4 --"wikibase:rank"--> v2 v4 --"p:statement/P2002"--> v7 subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v4 --"p:qualifier/P582"--> a2 end