query-c911e1c5e16d3ce9cd5f87b3ebe4c8df
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX prov: <http://www.w3.org/ns/prov#>
SELECT ?item ?en_label (SAMPLE(?img) AS ?image) (COUNT(DISTINCT ?label) AS ?labels) (COUNT(DISTINCT ?st) AS ?statements) (COUNT(DISTINCT ?sourced) AS ?with_ref)
(COUNT(DISTINCT ?P1343) AS ?source_described) (COUNT(DISTINCT ?P973) AS ?url_described)
{
?item wdt:P31/wdt:P279* wd:Q14952 .
OPTIONAL { ?item wdt:P18 ?img } .
OPTIONAL { ?item rdfs:label ?en_label FILTER( LANG( ?en_label ) = 'en' ) } .
?item rdfs:label ?label;
?p ?st .
?st wikibase:rank [] .
OPTIONAL {
?st prov:wasDerivedFrom [] .
BIND( ?st AS ?sourced ) .
} .
OPTIONAL {
?st ps:P1343 [] .
BIND( ?st AS ?P1343 ) .
} .
OPTIONAL {
?st ps:P973 [] .
BIND( ?st AS ?P973 ) .
} .
} GROUP BY ?item ?en_label
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?P1343"):::projected
v9("?P973"):::projected
v1("?en_label"):::projected
v10("?image")
v3("?img"):::projected
v2("?item"):::projected
v4("?label"):::projected
v11("?labels")
v5("?p")
v14("?source_described")
v7("?sourced"):::projected
v6("?st"):::projected
v12("?statements")
v15("?url_described")
v13("?with_ref")
a2((" "))
a3((" "))
a4((" "))
a5((" "))
a1((" "))
c4(["wd:Q14952"]):::iri
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P18".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."rdfs:label".-> v1
end
v2 --"rdfs:label"--> v4
v2 -->v5--> v6
v6 --"wikibase:rank"--> a2
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v6 -."prov:wasDerivedFrom".-> a3
bind0[/"?st"/]
v6 --o bind0
bind0 --as--o v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v6 -."ps:P1343".-> a4
bind1[/"?st"/]
v6 --o bind1
bind1 --as--o v8
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v6 -."ps:P973".-> a5
bind2[/"?st"/]
v6 --o bind2
bind2 --as--o v9
end
bind9[/"sample(?img)"/]
v3 --o bind9
bind9 --as--o v10
bind10[/"count(?label)"/]
v4 --o bind10
bind10 --as--o v11
bind11[/"count(?st)"/]
v6 --o bind11
bind11 --as--o v12
bind12[/"count(?sourced)"/]
v7 --o bind12
bind12 --as--o v13
bind13[/"count(?P1343)"/]
v8 --o bind13
bind13 --as--o v14
bind14[/"count(?P973)"/]
v9 --o bind14
bind14 --as--o v15