query-0cfc847352296bbe498e86868c33ba02

rq turtle/ttl

Removing double entities/tags from dutch municipalities 08:39, 7 October 2019 (UTC)) talk (Antoni1626Is it possible to make a query that deletes the dutch municipality tag (Q2039348) from entitites that don't have a start (P580) or/and end time date set (P582)? And if yes, how would such a query look? if not, what's the best way to tackle this problem (clicking 2000 times is not really an option)? This is the query for the municipalities with a start date set:

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 ?municipalityLabel ?municipality ?begindatum ?einddatum ?CBS_gemeentecode WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?municipality p:P31 ?statement.
  ?statement ps:P31 wd:Q2039348;
    pq:P580 ?begindatum;
 optional {  ?statement pq:P582 ?einddatum }

 optional { ?municipality wdt:P382 ?CBS_gemeentecode. } 

}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?CBS_gemeentecode"):::projected v3("?begindatum"):::projected v4("?einddatum"):::projected v1("?municipality"):::projected v2("?statement") c2(["bd:serviceParam"]):::iri c7(["wd:Q2039348"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v1 --"p:P31"--> v2 v2 --"p:statement/P31"--> c7 v2 --"p:qualifier/P580"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P582".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P382".-> v5 end