query-5e74273e545044b329bb701b10b3f494
SELECT ?item1 ?item1Label ?item1TypeLabel ?item2 ?item2Label ?item2TypeLabel SELECT DISTINCT ?follow ?followLabel ?followTypeLabel ?precede ?precedeLabel ?precedeTypeLabel WHERE { ?follow wdt:P155 ?precede ; wdt:P31 ?followType . ?precede wdt:P31 ?precedeType . FILTER NOT EXISTS { ?follow wdt:P31 ?precedeType } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } LIMIT 100
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#SELECT ?item1 ?item1Label ?item1TypeLabel ?item2 ?item2Label ?item2TypeLabel
SELECT DISTINCT ?follow ?followLabel ?followTypeLabel ?precede ?precedeLabel ?precedeTypeLabel
WHERE {
?follow wdt:P155 ?precede ;
wdt:P31 ?followType .
?precede wdt:P31 ?precedeType .
FILTER NOT EXISTS {
?follow wdt:P31 ?precedeType
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 100
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?follow"):::projected
v4("?followType")
v3("?precede"):::projected
v2("?precedeType")
c4(["bd:serviceParam"]):::iri
c6(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0v2
e0v1("?follow"):::projected
e0v2("?precedeType"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> v2
v1 --"wdt:P31"--> v2
v1 --"wdt:P155"--> v3
v1 --"wdt:P31"--> v4
v3 --"wdt:P31"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end