An Algorithm for Business Process Compliance