query-6aa2f0e05049ff78aa7ed66d8cd1f307

rq turtle/ttl

Open museums in historic county of Kent

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?organisation ?organisationLabel  ?county ?countyLabel WHERE {
   ?organisation wdt:P31/wdt:P279* wd:Q33506.
   ?organisation wdt:P17 wd:Q145 .
   OPTIONAL {?organisation wdt:P7959 ?county1. }
   OPTIONAL {?organisation wdt:P131/wdt:P7959 ?county2. }
   BIND(COALESCE(?county1,?county2) as ?county)
   FILTER(?county IN (wd:Q67479626))
   MINUS {
   ?organisation p:P576 ?statement_2.
   ?statement_2 psv:P576 ?statementValue_2.
   ?statementValue_2 wikibase:timeValue ?P576_2.
   }
   MINUS {
   ?organisation p:P3999 ?statement_3.
   ?statement_3 psv:P3999 ?statementValue_3.
   ?statementValue_3 wikibase:timeValue ?P3999_2.
   } 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-gb,en,mul". } 
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?P3999_2") v7("?P576_2") v5("?county"):::projected v3("?county1") v4("?county2") v2("?organisation"):::projected v6("?statementValue_2") v9("?statementValue_3") v5("?statement_2") v8("?statement_3") a1((" ")) a2((" ")) c17(["en-gb,en,mul"]):::literal c4(["wd:Q33506"]):::iri c15(["bd:serviceParam"]):::iri c6(["wd:Q145"]):::iri f0[["?county = 'wd:Q67479626'"]] f0 --> v5 v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c4 v2 --"p:direct/P17"--> c6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P7959".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P131".-> a2 a2 --"p:direct/P7959"--> v4 end bind1[/"?county1?county2"/] v3 --o bind1 v4 --o bind1 bind1 --as--o v5 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v2 --"p:P576"--> v5 v5 --"p:statement/value/P576"--> v6 v6 --"wikibase:timeValue"--> v7 end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v2 --"p:P3999"--> v8 v8 --"p:statement/value/P3999"--> v9 v9 --"wikibase:timeValue"--> v10 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c15 --"wikibase:language"--> c17 end