query-935421161e59414e7bf5c1afb3d8e2bf

rq turtle/ttl

title: Durchschnittliche Zahl an Quellenangabe (URL bzw. Item) bei Objekten in Kunstmuseen SELECT ?collection ?collectionLabel (AVG(?numberOfReferences) AS ?revAverage) WITH { #named Subquery via https://renenyffenegger.ch/notes/development/Data/open/Wikidata/index nach https://w.wiki/5pWb SELECT ?obj $collection WHERE { ?obj wdt:P276 $collection . ?collection wdt:P31 wd:Q207694; wdt:P17 wd:Q183 . } } AS %objects

WHERE { SELECT ?collection ?collectionLabel ?obj (COUNT(?refnode) AS ?numberOfReferences) WHERE { include %objects ?obj ?x ?statement. ?statement prov:wasDerivedFrom ?refnode. ?refnode (pr:P248| pr:P854) ?ref. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?collection ?collectionLabel ?obj } GROUP BY ?collection ?collectionLabel ORDER BY DESC(?revAverage)

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#>
#title: Durchschnittliche Zahl an Quellenangabe (URL bzw. Item) bei Objekten in Kunstmuseen
SELECT ?collection ?collectionLabel (AVG(?numberOfReferences) AS ?revAverage)

WHERE {
  SELECT ?collection ?collectionLabel ?obj (COUNT(?refnode) AS ?numberOfReferences)
  WHERE {
     {
  #named Subquery via https://renenyffenegger.ch/notes/development/Data/open/Wikidata/index nach https://w.wiki/5pWb
  SELECT ?obj $collection WHERE {
    ?obj wdt:P276 $collection .
    ?collection wdt:P31 wd:Q207694;
                wdt:P17 wd:Q183 .
  }
}    ?obj ?x ?statement.
    ?statement prov:wasDerivedFrom ?refnode.
    ?refnode (pr:P248| pr:P854) ?ref.
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  }
  GROUP BY ?collection ?collectionLabel ?obj
}
GROUP BY ?collection ?collectionLabel
ORDER BY DESC(?revAverage)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?collection"):::projected v8("?numberOfReferences"):::projected v2("?obj") v7("?ref") v6("?refnode") v9("?revAverage") v5("?statement") v4("?x") c3(["wd:Q207694"]):::iri c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal c5(["wd:Q183"]):::iri v2 --"wdt:P276"--> v3 v3 --"wdt:P31"--> c3 v3 --"wdt:P17"--> c5 v2 -->v4--> v5 v5 --"prov:wasDerivedFrom"--> v6 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v6 --"pr:P854"--> v7 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v6 --"pr:P248"--> v7 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind1[/"count(?refnode)"/] v6 --o bind1 bind1 --as--o v8 bind3[/"average(?numberOfReferences)"/] v8 --o bind3 bind3 --as--o v9