Loglinear models for first-order probabilistic reasoning