
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

DELETE { ?s ?p ?val . }
INSERT { ?s ?p ?typed . }
WHERE {
  VALUES ?p {
    <http://example.org/migrants/work#IDWork>
    <http://example.org/migrants/migration_table#IDMig>
    <http://example.org/migrants/relationship#IDRel>
    <http://example.org/migrants/organisation#IDOrganisation>
    <http://example.org/migrants/personnames#IDPersonname>
    <http://example.org/migrants/religions#IDReligion>
    <http://example.org/migrants/person_profession#IDProfPerson>
    <http://example.org/migrants/location#GeoNamesID>
  }
  ?s ?p ?val .
  FILTER(REGEX(STR(?val), "^\\d+$"))
  BIND(STRDT(STR(?val), xsd:integer) AS ?typed)
}
