Framework for Gibbs sampling of probabilistic models