PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX schema: <https://schema.org/>
PREFIX wgs84: <http://www.w3.org/2003/01/geo/wgs84_pos#>

DELETE { ?s <http://example.org/migrants/location#latitude> ?v . }
INSERT { ?s wgs84:lat ?v . }
WHERE  { ?s <http://example.org/migrants/location#latitude> ?v . }
;
DELETE { ?s <http://example.org/migrants/location#longitude> ?v . }
INSERT { ?s wgs84:long ?v . }
WHERE  { ?s <http://example.org/migrants/location#longitude> ?v . }
;
DELETE { ?s <http://example.org/migrants/location#wikipedia> ?v . }
INSERT { ?s schema:sameAs ?v . }
WHERE  {
  ?s <http://example.org/migrants/location#wikipedia> ?v .
  FILTER(isIRI(?v))
}
;
DELETE { ?s <http://example.org/migrants/location#wikidata> ?q . }
INSERT { ?s owl:sameAs ?wd . }
WHERE {
  ?s <http://example.org/migrants/location#wikidata> ?q .
  BIND(IRI(CONCAT("http://www.wikidata.org/entity/", STR(?q))) AS ?wd)
}
