query-5efe5b87dd126c03dd23b7b4726f43c5

rq turtle/ttl

TODO

Use at

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 pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?type ?typeLabel
WHERE
{
  ?item p:P31 ?instance_of_statement .
  ?instance_of_statement a wikibase:BestRank .
  ?instance_of_statement ps:P31 ?type .
  ?type wdt:P279 + wd:Q1266830 . # ?type is subclass of Pokémon type
  ?instance_of_statement pq:P518 wd:Q25931668 . # Have second type qualifier
  FILTER NOT EXISTS {
    VALUES ?allowed_P518_qualifier_value { wd:Q25931659 wd:Q25931668 }
    ?item p:P31 ?other_instance_of_statement .
    ?other_instance_of_statement a wikibase:BestRank .
    ?other_instance_of_statement ps:P31 ?type2 .
    ?type2 wdt:P279 + wd:Q1266830 . # ?type2 is subclass of Pokémon type
    ?other_instance_of_statement pq:P518 wd:Q25931659 . # The other type have first type qualifier
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?allowed_P518_qualifier_value") v5("?instance_of_statement") v2("?item"):::projected v3("?other_instance_of_statement") v6("?type"):::projected v4("?type2") c6(["wd:Q1266830"]):::iri c9(["wd:Q25931668"]):::iri c3(["wikibase:BestRank"]):::iri c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal c8(["wd:Q25931659"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] bind0[/VALUES ?allowed_P518_qualifier_value/] bind0-->e0v1 bind00(["wd:Q25931659"]) bind00 --> bind0 bind01(["wd:Q25931668"]) bind01 --> bind0 e0v2 --"p:P31"--> e0v3 e0v3 --"a"--> e0c3 e0v3 --"p:statement/P31"--> e0v4 e0v4 --"p:direct/P279"--> e0c6 e0v3 --"p:qualifier/P518"--> e0c8 e0v1("?allowed_P518_qualifier_value") e0v2("?item"):::projected e0v3("?other_instance_of_statement"):::projected e0v4("?type2"):::projected e0c6(["wd:Q1266830"]):::iri e0c3(["wikibase:BestRank"]):::iri e0c8(["wd:Q25931659"]):::iri end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> v3 f0 --> c2 f0 --> c3 f0 --> c4 f0 --> v4 f0 --> c5 f0 --> c6 f0 --> c7 f0 --> c8 bind1[/VALUES ?allowed_P518_qualifier_value/] bind1-->v1 bind10(["wd:Q25931659"]) bind10 --> bind1 bind11(["wd:Q25931668"]) bind11 --> bind1 v2 --"p:P31"--> v3 v3 --"a"--> c3 v3 --"p:statement/P31"--> v4 v4 --"p:direct/P279"--> c6 v3 --"p:qualifier/P518"--> c8 v2 --"p:P31"--> v5 v5 --"a"--> c3 v5 --"p:statement/P31"--> v6 v6 --"p:direct/P279"--> c6 v5 --"p:qualifier/P518"--> c9 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end