Non-determinism and weak constraints in Datalog