query-8127f95297ea7d855dc9abba6c467a57

rq turtle/ttl

USA boxHello, what's wrong with this query ? I wanted to list things that are located inside continental USA {with their coordinates} AND (not having any P17 = lack of data) OR (having P17 =/= USA = wrong data somehow) Thanks for help !

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#>
#defaultView:Map
SELECT ?item ?itemLabel ?coords WITH {   SELECT *   WHERE {
    VALUES ?country { wd:Q30 } # change your country here, check that the bounding box only covers its mainland
    ?country p:P1332 [ a wikibase:BestRank; psv:P1332 [ wikibase:geoLatitude ?nmp_lat ] ].
    ?country p:P1333 [ a wikibase:BestRank; psv:P1333 [ wikibase:geoLatitude ?smp_lat ] ].
    ?country p:P1334 [ a wikibase:BestRank; psv:P1334 [ wikibase:geoLongitude ?emp_long ] ].
    ?country p:P1335 [ a wikibase:BestRank; psv:P1335 [ wikibase:geoLongitude ?wmp_long ] ].
  } } AS %a  WITH {   SELECT distinct ?item ?coords
  WHERE { 
    INCLUDE %a 
    ?item wdt:Q30 ?country;
      wdt:P31/wdt:P279* wd:Q811979#architectural thing
            ;wdt:P625 ?coords;#its coordinates
      p:P625 [ a wikibase:BestRank; psv:P625 ?coord_vn ] .
    ?coord_vn wikibase:geoLatitude ?lat. hint:Prior hint:rangeSafe true.
    ?coord_vn wikibase:geoLongitude ?long. hint:Prior hint:rangeSafe true.
    FILTER(?lat >  ?nmp_lat||  ?lat < ?smp_lat || ?long > ?emp_long ||wdt:P3999) ?dispar. }#on ne veut pas les disparus
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .} }

Query found at