query-eb39991f84b79fa995f4669fe7011b96

rq turtle/ttl

Fortifications that are not part of a larger fortification (not working)

Use at

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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-gb,en,mul". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P31/wdt:P279* wd:Q57821.
      ?item wdt:P17 wd:Q145.
      MINUS {
        ?item p:P361 ?partof.
        ?partof ps:P361/wdt:P31/wdt:P279* wd:Q57821.
        MINUS {
          ?partof wdt:P31 wd:Q1516079.
        }
      }
      MINUS {
        ?item wdt:P31 wd:Q1516079.
      }
      ?item rdfs:label ?name. 
      FILTER (lang(?name) = "en")
      FILTER(CONTAINS(?name, "Brougham")).
    }
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v1("?name") v3("?partof") a1((" ")) a2((" ")) a3((" ")) c4(["en-gb,en,mul"]):::literal c2(["bd:serviceParam"]):::iri c9(["wd:Q57821"]):::iri c11(["wd:Q145"]):::iri c14(["wd:Q1516079"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end f0[["contains(?name,'Brougham')"]] f0 --> v1 f1[["?name = 'en'"]] f1 --> v1 v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c9 v2 --"p:direct/P17"--> c11 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v2 --"p:P361"--> v3 v3 --"p:statement/P361"--> a2 a2 --"p:direct/P31"--> a3 a3 --"p:direct/P279"--> c9 subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v3 --"p:direct/P31"--> c14 end end subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v2 --"p:direct/P31"--> c14 end v2 --"rdfs:label"--> v1