query-0fd3225d62f27375822e52d9ba876fad
Brazillian/Soviet warships with official name by preference
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 p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?label WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "en-gb,en,mul". }
{
SELECT DISTINCT ?item ?label WHERE {
?item p:P31 ?statement0.
?statement0 (ps:P31/(wdt:P279*)) wd:Q3114762.
VALUES ?navies { wd:Q1750688 wd:Q796754}
?item wdt:P137 ?navies.
OPTIONAL {?item wdt:P1448 ?officialname}
OPTIONAL {?item rdfs:label ?en_label . FILTER(LANG(?en_label) = "en")}
BIND(COALESCE (?officialname, ?en_label) AS ?label)
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?en_label")
v2("?item"):::projected
v6("?label"):::projected
v4("?navies")
v5("?officialname")
v3("?statement0")
a1((" "))
c4(["en-gb,en,mul"]):::literal
c2(["bd:serviceParam"]):::iri
c9(["wd:Q3114762"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v2 --"p:P31"--> v3
v3 --"p:statement/P31"--> a1
a1 --"p:direct/P279"--> c9
bind0[/VALUES ?navies/]
bind0-->v4
bind00(["wd:Q1750688"])
bind00 --> bind0
bind01(["wd:Q796754"])
bind01 --> bind0
v2 --"p:direct/P137"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P1448".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."rdfs:label".-> v1
end
bind1[/"?officialname?en_label"/]
v5 --o bind1
v1 --o bind1
bind1 --as--o v6