Improving the Efficiency of Gibbs Sampling for Probabilistic Logical Models by Means of Program Specialization