query-18f4eab2e9a55108073b81e9091fff2c
The better one is this: 15:01, 27 June 2019 (UTC)) talk (Doc Taxonand how can I include valueLabel into the query? in the WHERE clause. Including value labels (and sorting), you probably end up with something like: FILTER(!ISBLANK(?value)) statements. They are represented by so-called "blank nodes" in the graph, and each "unknown value" statement has its own individual blank node. "t173520623" and similar strings are just automatically created internal identifiers without further meaning. You can exclude "blank nodes" with Help unknown value Strings such as "t173520623" in the query results instead of items do indeed represent
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?value ?valueLabel ?cnt WHERE {
{
SELECT ?value (COUNT(?statement) AS ?cnt) WHERE {
?statement ps:P27 ?value .
} GROUP BY ?value
}.
FILTER(!ISBLANK(?value)) .
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} ORDER BY DESC(?cnt)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?cnt"):::projected
v3("?statement")
v2("?value"):::projected
c3(["bd:serviceParam"]):::iri
c5(["en"]):::literal
f0[["not isBlank(?value)"]]
f0 --> v2
v3 --"ps:P27"--> v2
bind2[/"count(?statement)"/]
v3 --o bind2
bind2 --as--o v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end