query-01beafa6d860a41dce68584b19bf5dd4
Все детективы-персонажи
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 distinct ?item ?label ?desc ?samplework ?workLabel ?authorLabel ?_image WHERE {
?item wdt:P31/wdt:P279* wd:Q15632617.
?item wdt:P106/wdt:P279* wd:Q842782 .
OPTIONAL {?item schema:description ?desc FILTER( LANG( ?desc ) = 'ru' ) .}
OPTIONAL {
SELECT ?item (count(*) as ?ct) (SAMPLE(?work) as ?samplework)
WHERE { OPTIONAL { ?item wdt:P1441 ?work .}
}
GROUP BY ?item
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru","en" .
?item rdfs:label ?label .
?samplework rdfs:label ?workLabel.
?author rdfs:label ?authorLabel.
}
OPTIONAL { ?item wdt:P18 ?_image .}
OPTIONAL { ?item wdt:P170 ?author .}
# sampling by image timeout:
# OPTIONAL {
# SELECT ?item (count(*) as ?ct) (SAMPLE(?image) as ?_image)
# WHERE { OPTIONAL { ?item wdt:P18 ?image .}
# }
# GROUP BY ?item
# }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?_image"):::projected
v8("?author")
v9("?authorLabel"):::projected
v4("?ct")
v1("?desc"):::projected
v2("?item"):::projected
v6("?label"):::projected
v5("?samplework"):::projected
v3("?work")
v7("?workLabel"):::projected
a1((" "))
a2((" "))
c1(["ru"]):::literal
c12(["en"]):::literal
c6(["wd:Q842782"]):::iri
c10(["bd:serviceParam"]):::iri
c4(["wd:Q15632617"]):::iri
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c4
v2 --"wdt:P106"--> a2
a2 --"wdt:P279"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."schema:description".-> v1
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P1441".-> v3
end
bind2[/"count(*)"/]
bind2 --as--o v4
bind3[/"sample(?work)"/]
v3 --o bind3
bind3 --as--o v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c1
c10 --"wikibase:language"--> c12
v2 --"rdfs:label"--> v6
v5 --"rdfs:label"--> v7
v8 --"rdfs:label"--> v9
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P18".-> v10
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P170".-> v8
end