query-c31a7b7f19b811e213fbfd600f4f06d9
TODO
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 schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (SAMPLE(?p19label) AS ?birthplace) (GROUP_CONCAT(?p106label;SEPARATOR=', ') AS ?occupations) (?fame AS ?wikipedialinks) WHERE {
{
SELECT ?item (COUNT(?wikipedialink) AS ?fame) {
?item wdt:P31 wd:Q5 .
?item wdt:P27 wd:Q228 . # wd:Q30 for USA
?wikipedialink schema:isPartOf [ wikibase:wikiGroup "wikipedia" ]; schema:about ?item .
}
GROUP BY ?item
HAVING (?fame>5) # ?fame>50 for USA
} ?item wdt:P106 ?p106 . ?p106 rdfs:label ?p106label . FILTER(LANG(?p106label)='en')
?item wdt:P19 ?p19 . ?p19 rdfs:label ?p19label . FILTER(LANG(?p19label)='en')
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel ?fame
ORDER BY DESC(?wikipedialinks) ?itemLabel
LIMIT 100 # 1000 for USA
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?birthplace")
v8("?fame"):::projected
v6("?item"):::projected
v2("?itemLabel"):::projected
v11("?occupations")
v8("?p106")
v4("?p106label"):::projected
v9("?p19")
v3("?p19label"):::projected
v7("?wikipedialink")
v12("?wikipedialinks")
a1((" "))
c15(["bd:serviceParam"]):::iri
c6(["wd:Q228"]):::iri
c4(["wd:Q5"]):::iri
c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c8(["wikipedia"]):::literal
f0[["?p19label = 'en'"]]
f0 --> v3
f1[["?p106label = 'en'"]]
f1 --> v4
f2[["?fame > '5^^xsd:integer'"]]
f2 --> v8
v6 --"wdt:P31"--> c4
v6 --"wdt:P27"--> c6
a1 --"wikibase:wikiGroup"--> c8
v7 --"schema:isPartOf"--> a1
v7 --"schema:about"--> v6
bind4[/"count(?wikipedialink)"/]
v7 --o bind4
bind4 --as--o v8
v6 --"wdt:P106"--> v8
v8 --"rdfs:label"--> v4
v6 --"wdt:P19"--> v9
v9 --"rdfs:label"--> v3
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c15 --"wikibase:language"--> c17
end
bind7[/"sample(?p19label)"/]
v3 --o bind7
bind7 --as--o v10
bind8[/"?p106label"/]
v4 --o bind8
bind8 --as--o v11
bind9[/"?fame"/]
v8 --o bind9
bind9 --as--o v12