Techniques for Implementing Contexts in Logic Programming