Optimizing Large-Scale Semi-Na¨ıve Datalog Evaluation in