Optimistic concurrency control for prolog databases