Rewriting rule methods in logic databases