Coarse-to-Fine Inference and Learning for First-Order Probabilistic Models