query-411400764699594f32df736644867f2e

rq turtle/ttl

Propertiesinstance of (P31)subclass of (P279)language of work or name (P407)collection (P195)end time (P582)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?q ?qLabel (GROUP_CONCAT(DISTINCT ?collectionLabel; separator="; ") AS ?where) ?enwp (GROUP_CONCAT(DISTINCT ?langLabel; separator=", ") AS ?languages) ?linkcount
WHERE { {SELECT ?q (COUNT(?sitelink) AS ?linkcount) WHERE {  ?q (wdt:P31/wdt:P279*) wd:Q87167. ?sitelink schema:about ?q }
   GROUP BY ?q  }
?q p:P195 ?s. ?s ps:P195 ?collection . MINUS {?s pq:P582 []}.
      MINUS {?s ps:P195 wd:Q1322278 }
OPTIONAL{ ?q wdt:P407 ?lang }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
    ?q rdfs:label ?qLabel. ?collection rdfs:label ?collectionLabel . ?lang rdfs:label ?langLabel
  }
 OPTIONAL{?enwp schema:about ?q ; schema:isPartOf <https://en.wikipedia.org/> }
 # other props: inventory number; part of ; full work (P953); Commons cat; described at (P973)
}
GROUP BY ?q ?qLabel ?enwp ?linkcount
ORDER BY DESC(?linkcount)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?collection") v8("?collectionLabel"):::projected v10("?enwp"):::projected v6("?lang") v9("?langLabel"):::projected v12("?languages") v4("?linkcount"):::projected v2("?q"):::projected v7("?qLabel"):::projected v4("?s") v3("?sitelink") v11("?where") a2((" ")) a1((" ")) c8(["wd:Q1322278"]):::iri c16([https://en.wikipedia.org/]):::iri c3(["wd:Q87167"]):::iri c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v3 --"schema:about"--> v2 bind1[/"count(?sitelink)"/] v3 --o bind1 bind1 --as--o v4 v2 --"p:P195"--> v4 v4 --"p:statement/P195"--> v5 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v4 --"p:qualifier/P582"--> a2 end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v4 --"p:statement/P195"--> c8 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P407".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 v2 --"rdfs:label"--> v7 v5 --"rdfs:label"--> v8 v6 --"rdfs:label"--> v9 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v10 -."schema:about".-> v2 v10 --"schema:isPartOf"--> c16 end bind6[/"?collectionLabel"/] v8 --o bind6 bind6 --as--o v11 bind7[/"?langLabel"/] v9 --o bind7 bind7 --as--o v12