query-e2084105a018ba86f06cc8d7e363bd99

rq turtle/ttl

Invalid P143 values with reference count

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?P143valueItem ?P143valueItemLabel (COUNT(?statement) AS ?cnt_statements) (COUNT(DISTINCT ?item) AS ?cnt_items) (IRI(CONCAT('https://query.wikidata.org/#SELECT%2a%7B%3Fitem%3Fprop%5Bprov%3AwasDerivedFrom%2Fpr%3AP143%20wd%3A', STRAFTER(STR(?P143valueItem), "entity/"), '%5D%7D')) AS ?query_items) WHERE {
   {
  SELECT DISTINCT ?P143valueItem ?P143valueItemLabel WHERE {
     {
  SELECT DISTINCT ?P143valueItem WHERE { [] pr:P143 ?P143valueItem }
}.
    MINUS { ?P143valueItem wdt:P31/wdt:P279* wd:Q14827288 }
    MINUS { ?P143valueItem wdt:P31/wdt:P279* wd:Q63144794 }
#   FILTER(?P143valueItem NOT IN (wd:Q28054658, wd:Q24731821, wd:Q19960422, wd:Q48552277)) . MINUS { ?P143valueItem wdt:P31/wdt:P279* wd:Q4167836 } MINUS { ?P143valueItem wdt:P31/wdt:P279* wd:Q13406463 } # some internal Wikimedia stuff
#   VALUES ?class { wd:Q386724 wd:Q11028 } ?P143valueItem wdt:P31?/wdt:P279* ?class . # valid P248 values
    SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
  }
}.
  ?statement prov:wasDerivedFrom/pr:P143 ?P143valueItem .
  ?item ?any ?statement .
} GROUP BY ?P143valueItem ?P143valueItemLabel ORDER BY DESC(?cnt_statements)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?P143valueItem"):::projected v5("?any") v6("?cnt_items") v6("?cnt_statements") v4("?item"):::projected v7("?query_items") v3("?statement"):::projected a1((" ")) a2((" ")) a3((" ")) a4((" ")) c7(["bd:serviceParam"]):::iri c5(["wd:Q63144794"]):::iri c4(["wd:Q14827288"]):::iri c9(["en"]):::literal a1 --"pr:P143"--> v2 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c4 end subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> a3 a3 --"wdt:P279"--> c5 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end v3 --"prov:wasDerivedFrom"--> a4 a4 --"pr:P143"--> v2 v4 -->v5--> v3 bind4[/"count(?statement)"/] v3 --o bind4 bind4 --as--o v6 bind5[/"count(?item)"/] v4 --o bind5 bind5 --as--o v6 bind6[/"concat('https://query.wikidata.org/#SELECT%2a%7B%3Fitem%3Fprop%5Bprov%3AwasDerivedFrom%2Fpr%3AP143%20wd%3A',substring-after(str(?P143valueItem),'entity/'),'%5D%7D')"/] v2 --o bind6 bind6 --as--o v7