query-91f1fcb72b254c03350adcd9acf28936
items with most MusicBrainz IDs SELECT ?item ?itemLabel ?itemDescription ?propertyLabel ?count ?hasSingleValueConstraint WITH { SELECT ?item ?property (COUNT(?musicBrainzIdStatement) AS ?count) WHERE { ?property a wikibase:Property; wdt:P2378 wd:Q14005; wikibase:claim ?p. ?item ?p ?musicBrainzIdStatement. } GROUP BY ?item ?property ORDER BY DESC(?count) LIMIT 100 } AS %results WHERE { INCLUDE %results. BIND(EXISTS { ?property wdt:P2302 wd:Q19474404. } AS ?hasSingleValueConstraint) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY DESC(?count)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# items with most MusicBrainz IDs
SELECT ?item ?itemLabel ?itemDescription ?propertyLabel ?count ?hasSingleValueConstraint WHERE {
{
SELECT ?item ?property (COUNT(?musicBrainzIdStatement) AS ?count) WHERE {
?property a wikibase:Property;
wdt:P2378 wd:Q14005;
wikibase:claim ?p.
?item ?p ?musicBrainzIdStatement.
}
GROUP BY ?item ?property
ORDER BY DESC(?count)
LIMIT 100
}
BIND(EXISTS { ?property wdt:P2302 wd:Q19474404. } AS ?hasSingleValueConstraint)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?count"):::projected
v6("?hasSingleValueConstraint"):::projected
v4("?item"):::projected
v5("?musicBrainzIdStatement")
v3("?p")
v2("?property")
c4(["wd:Q14005"]):::iri
c7(["bd:serviceParam"]):::iri
c2(["wikibase:Property"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"a"--> c2
v2 --"wdt:P2378"--> c4
v2 --"wikibase:claim"--> v3
v4 -->v3--> v5
bind1[/"count(?musicBrainzIdStatement)"/]
v5 --o bind1
bind1 --as--o v6
v2 --"wdt:P2302"--> null
bind2[/" "/]
subgraph bind2e0["Exists Clause"]
e0v1 --"wdt:P2302"--> e0c2
e0v1("?property"):::projected
e0c2(["wd:Q19474404"]):::iri
end
bind2--EXISTS--> bind2e0
v2 --o bind2
null --o bind2
null --o bind2
bind2 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end