query-0dfcc9ce5cc95ba43adfc132aea7020d
and
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 pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?ship ?shipLabel WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
{
SELECT DISTINCT ?item ?namedafter ?class ?ship ?shipLabel WHERE {
?item wdt:P31 wd:Q559026;
rdfs:label ?itemlabel.
?item wdt:P138 ?namedafter.
MINUS {?ship p:P289 [ pq:P2868 wd:Q2095057].}
?ship wdt:P289 ?item;
rdfs:label ?shiplabel.
FILTER(LANG(?shiplabel) = "en").
FILTER (CONTAINS(?itemlabel, ?shiplabel))
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?item"):::projected
v1("?itemlabel")
v4("?namedafter")
v5("?ship"):::projected
v2("?shiplabel")
a1((" "))
c7(["wd:Q559026"]):::iri
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;"]):::literal
c11(["wd:Q2095057"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
f0[["contains(?itemlabel,?shiplabel)"]]
f0 --> v1
f0 --> v2
f1[["?shiplabel = 'en'"]]
f1 --> v2
v3 --"p:direct/P31"--> c7
v3 --"rdfs:label"--> v1
v3 --"p:direct/P138"--> v4
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
a1 --"p:qualifier/P2868"--> c11
v5 --"p:P289"--> a1
end
v5 --"p:direct/P289"--> v3
v5 --"rdfs:label"--> v2