query-ac578aa24c8edb26fdda6ee64242824a
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?P8269 ?P5871 ?P4574 WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
{
SELECT DISTINCT ?item (SAMPLE(?P8269_) as ?P8269) (SAMPLE(?P5871_) as ?P5871) (SAMPLE(?P4574_) as ?P4574) WHERE {
?item wdt:P27 wd:Q20.
{?item p:P8269/ps:P8269 ?P8269_ .}
UNION
{?item wdt:P5871 ?P5871_ .}
OPTIONAL {?item wdt:P4574 ?P4574_ .}
} group by ?item
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?P4574"):::projected
v4("?P4574_")
v6("?P5871"):::projected
v3("?P5871_")
v5("?P8269"):::projected
v2("?P8269_")
v1("?item"):::projected
a1((" "))
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;"]):::literal
c6(["wd:Q20"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v1 --"p:direct/P27"--> c6
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"p:direct/P5871"--> v3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"p:P8269"--> a1
a1 --"p:statement/P8269"--> v2
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P4574".-> v4
end
bind3[/"sample(?P8269_)"/]
v2 --o bind3
bind3 --as--o v5
bind4[/"sample(?P5871_)"/]
v3 --o bind4
bind4 --as--o v6
bind5[/"sample(?P4574_)"/]
v4 --o bind5
bind5 --as--o v7