query-9f754d0ec41e84317f021fb16bc9c0eb
Unique value constraint report for P1931: report by value SELECT ?value (SAMPLE(?valueLabel) AS ?valueLabel) (SAMPLE(?ct) AS ?ct) (GROUP_CONCAT(DISTINCT(strafter(str(?item), "/entity/"));separator=", ") as ?items) (GROUP_CONCAT(DISTINCT(?itemLabel);separator=", ") as ?itemLabels) { { SELECT ?value (COUNT(DISTINCT ?item) as ?ct) { ?item wdt:P1931 ?value } GROUP BY ?value HAVING (?ct>1) ORDER BY DESC(?ct) LIMIT 500 }
?item wdt:P1931 ?value
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en" . ?item rdfs:label ?itemLabel . ?value rdfs:label ?valueLabel } } GROUP BY ?value ORDER BY DESC(?ct)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Unique value constraint report for P1931: report by value
SELECT
?value (SAMPLE(?valueLabel) AS ?valueLabel) (SAMPLE(?ct) AS ?ct)
(GROUP_CONCAT(DISTINCT(strafter(str(?item), "/entity/"));separator=", ") as ?items)
(GROUP_CONCAT(DISTINCT(?itemLabel);separator=", ") as ?itemLabels) {
{ SELECT ?value (COUNT(DISTINCT ?item) as ?ct) { ?item wdt:P1931 ?value }
GROUP BY ?value HAVING (?ct>1) ORDER BY DESC(?ct) LIMIT 500 }
?item wdt:P1931 ?value
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en,en" .
?item rdfs:label ?itemLabel .
?value rdfs:label ?valueLabel
}
}
GROUP BY ?value
ORDER BY DESC(?ct)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?ct"):::projected
v2("?item"):::projected
v4("?itemLabel"):::projected
v7("?itemLabels")
v6("?items")
v3("?value"):::projected
v6("?valueLabel"):::projected
c4(["bd:serviceParam"]):::iri
c6(["en,en"]):::literal
f0[["?ct > '1^^xsd:integer'"]]
f0 --> v6
v2 --"wdt:P1931"--> v3
bind2[/"count(?item)"/]
v2 --o bind2
bind2 --as--o v6
v2 --"wdt:P1931"--> v3
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
v2 --"rdfs:label"--> v4
v3 --"rdfs:label"--> v6
end
bind7[/"sample(?valueLabel)"/]
v6 --o bind7
bind7 --as--o v6
bind8[/"sample(?ct)"/]
v6 --o bind8
bind8 --as--o v6
bind9[/"substring-after(str(?item),'/entity/')"/]
v2 --o bind9
bind9 --as--o v6
bind10[/"?itemLabel"/]
v4 --o bind10
bind10 --as--o v7