query-b92dc862bb33c5e558dbadc3385d5131

rq turtle/ttl

subject type constraint tripping up on the wrong items. Looking at the sparql query, it only uses the current statements: (P382)CBS municipality code for (Q21503250)subject type constraint currently trips up village and former municipality in North Holland, the Netherlands: (Q817840)Bennebroek

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?instance ?instanceLabel
WHERE
{
    {
        SELECT DISTINCT ?item ?instance {
            ?item wdt:P382 [] .
            MINUS {
                VALUES ?classes { wd:Q2039348 wd:Q3648563 } .
                ?item wdt:P31/wdt:P279* ?classes .
            } .
            OPTIONAL {
                ?item wdt:P31 ?instance .
            } .
        } LIMIT 100
    } .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?classes") v3("?instance"):::projected v1("?item"):::projected a1((" ")) a2((" ")) c5(["bd:serviceParam"]):::iri c7(["en"]):::literal v1 --"wdt:P382"--> a1 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; bind1[/VALUES ?classes/] bind1-->v2 bind10(["wd:Q2039348"]) bind10 --> bind1 bind11(["wd:Q3648563"]) bind11 --> bind1 v1 --"wdt:P31"--> a2 a2 --"wdt:P279"--> v2 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end