query-e672bb0ca707f20742f6edf04eb03f13
Propertiesinstance of (P31)subclass of (P279)operator (P137)vessel class (P289)named after (P138)pennant number (P879)
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 ?wd ?wdLabel ?instanceLabel ?pennant ?vcLabel ?namedLabel WHERE {
# super carrier
?wd wdt:P31/wdt:P279* wd:Q1186981 .
# aircraft carrier
#?wd wdt:P31/wdt:P279* wd:Q17205 .
# ship
#?wd wdt:P31 wd:Q11446 .
# United States Navy
?wd wdt:P137 wd:Q11220 .
?wd wdt:P31 ?instance .
# pennant number
OPTIONAL { ?wd p:P879 ?pennantNode . ?pennantNode ps:P879 ?pennant . }
# vessel class
#OPTIONAL { ?wd wdt:P289 ?vc . }
FILTER NOT EXISTS { ?wd wdt:P289 ?vc . }
# named after
OPTIONAL { ?wd wdt:P138 ?named . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de" . }
}
ORDER BY ASC(?value)
LIMIT 100
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?instance")
v7("?named")
v6("?pennant"):::projected
v5("?pennantNode")
v1("?value")
v3("?vc")
v2("?wd"):::projected
a1((" "))
c13(["en,de"]):::literal
c6(["wd:Q11220"]):::iri
c11(["bd:serviceParam"]):::iri
c4(["wd:Q1186981"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:direct/P289"--> e0v2
e0v2("?vc"):::projected
e0v1("?wd"):::projected
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> v3
v2 --"p:direct/P289"--> v3
v2 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c4
v2 --"p:direct/P137"--> c6
v2 --"p:direct/P31"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:P879".-> v5
v5 --"p:statement/P879"--> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P138".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end