Graph-algorithm inferences over local groundings of first-order logic programs