Towards ethical machines via logic programming