PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

DELETE {
  ?s <http://example.org/migrants/migration_table#reason2> ?val .
}
INSERT {
  ?s <http://example.org/migrants/migration_table#reason2> ?obj .
  ?obj a <http://example.org/migrants/MigrationReason> .
  ?obj rdfs:label ?label .
}
WHERE {
  ?s <http://example.org/migrants/migration_table#reason2> ?val .
  BIND(IRI(CONCAT("http://example.org/migrants/MigrationReason-", ENCODE_FOR_URI(REPLACE(?val, " ", "")))) AS ?obj)
  BIND(STRLANG(STR(?val), "en") AS ?label)
}
