query-855a16792b947dc39769c776ff7d808d

rq turtle/ttl

title:Identifiers and count of manuscripts SELECT ?id ?idlabel (COUNT(?item) AS ?count) WITH { SELECT DISTINCT ?item WHERE { ?item wdt:P31/wdt:P279* wd:Q87167. } } AS %subquery WHERE { INCLUDE %subquery . ?id wikibase:propertyType wikibase:ExternalId; wikibase:claim ?p; wikibase:statementProperty ?ps. ?item ?p [ ?ps ?value ] . ?id rdfs:label ?idlabel FILTER (lang(?idlabel) = "en"). } GROUP BY ?id ?idlabel ORDER BY DESC(?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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
#title:Identifiers and count of manuscripts
SELECT ?id ?idlabel (COUNT(?item) AS ?count) WHERE {
   {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P31/wdt:P279* wd:Q87167.
  }
}.
  ?id wikibase:propertyType wikibase:ExternalId; wikibase:claim ?p; wikibase:statementProperty ?ps.
  ?item ?p [ ?ps ?value ] .
  ?id rdfs:label ?idlabel FILTER (lang(?idlabel) = "en").
} GROUP BY ?id ?idlabel
ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?count") v4("?id"):::projected v2("?idlabel"):::projected v3("?item"):::projected v5("?p") v6("?ps") v7("?value") a1((" ")) a2((" ")) c4(["wd:Q87167"]):::iri c6(["wikibase:ExternalId"]):::iri f0[["?idlabel = 'en'"]] f0 --> v2 v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c4 v4 --"wikibase:propertyType"--> c6 v4 --"wikibase:claim"--> v5 v4 --"wikibase:statementProperty"--> v6 a2 -->v6--> v7 v3 -->v5--> a2 v4 --"rdfs:label"--> v2 bind2[/"count(?item)"/] v3 --o bind2 bind2 --as--o v8