# When a membership has tm:secondaryOrganisation but no org:organization,
# promote the secondary to primary.
# Affects 256 memberships.

PREFIX tm:  <https://daniel.degu.cl/ontologies/theatre-migrants/>
PREFIX org: <http://www.w3.org/ns/org#>

DELETE {
  ?s tm:secondaryOrganisation ?secondary .
}
INSERT {
  ?s org:organization ?secondary .
}
WHERE {
  ?s a org:Membership .
  ?s tm:secondaryOrganisation ?secondary .
  FILTER NOT EXISTS { ?s org:organization ?primary }
}
