query-dd4d65aed6a4ce45fc6696ccfb6b4d6d

rq turtle/ttl

CensusSelect municipalities in NJ that do not have a population statement with point in time 1 April 2010. This is useful to find entries that don't have properly cited 2010 census data.

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?id ?idLabel WHERE {
  ?id (wdt:P31/(wdt:P279*)) wd:Q54115138;
    #wdt:P131 wd:Q497928.
  MINUS {
    SELECT ?id WHERE {
      ?id (wdt:P31/(wdt:P279*)) wd:Q54115138;
        p:P1082 ?popStatement;
        #wdt:P131 wd:Q497928.
      OPTIONAL {
        ?popStatement pq:P585 ?time;
          pq:P459 ?det.
      }
      FILTER(?time = "2010-04-01"^^xsd:dat)
      FILTER(NOT EXISTS { ?id wdt:P576 ?eol. })
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
    ORDER BY DESC (?population)
  }
  FILTER(NOT EXISTS { ?id wdt:P576 ?eol. })
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?id ?idLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?det") v2("?eol") v1("?id"):::projected v5("?popStatement") v3("?population") v4("?time") a1((" ")) a2((" ")) c4(["wd:Q54115138"]):::iri c10(["bd:serviceParam"]):::iri c12(["en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:direct/P576"--> e0v2 e0v2("?eol"):::projected e0v1("?id"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> v2 v1 --"p:direct/P576"--> v2 v1 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c4 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; f2[["not "]] subgraph f2e1["Exists Clause"] e1v1 --"p:direct/P576"--> e1v2 e1v2("?eol"):::projected e1v1("?id"):::projected end f2--EXISTS--> f2e1 f2 --> v1 f2 --> c1 f2 --> v2 v1 --"p:direct/P576"--> v2 f3[["?time = s2010-04-01^^<http://www.w3.org/2001/XMLSchema#dat>'"]] f3 --> v4 v1 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> c4 v1 --"p:P1082"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P585".-> v4 v5 --"p:qualifier/P459"--> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end