query-b3028b5f5272a6a5762434aa1fbfa02e
?? Find classes where operator is at least Royal Navy, then find the other operators
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 ?vessel_class ?vessel_classLabel ?operator1 ?operator1Label WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "en-gb,en,mul". }
{
SELECT DISTINCT ?item WHERE {
?item p:P289 ?statement0.
?statement0 (ps:P289/(wdt:P279*)) _:anyValueP289.
?item p:P137 ?operator.
?operator (ps:P137/(wdt:P279*)) wd:Q172771.
}
}
OPTIONAL { ?item wdt:P137 ?operator1. }
OPTIONAL { ?item wdt:P289 ?vessel_class. }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v3("?operator")
v4("?operator1"):::projected
v2("?statement0")
v5("?vessel_class"):::projected
a2((" "))
a1((" "))
a3((" "))
c4(["en-gb,en,mul"]):::literal
c2(["bd:serviceParam"]):::iri
c10(["wd:Q172771"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v1 --"p:P289"--> v2
v2 --"p:statement/P289"--> a1
a1 --"p:direct/P279"--> a2
v1 --"p:P137"--> v3
v3 --"p:statement/P137"--> a3
a3 --"p:direct/P279"--> c10
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P137".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P289".-> v5
end