oid(rule1)::r1(X):-q(X).
oid(rule2)::r2(X):-q(X).

q(1).
q(2).
q(3).

:-solve(r1(X)).

p1(X):-partial(r1(X),rule1). % scoped with label "rule1"
:-solve(p1(X)).


p2(X):-partial(r1(X),rule2). % fails since scope is "rule2"
:-solve(p2(X)).

p3(Y):-label(r1(X),Y). % get rule label
:-solve(p3(X)).

p4(Y):-label(r2(X),Y). % get rule label
:-solve(p4(X)).

p5(Y):-module(r1(X),Y). % get module label
:-solve(p5(X)).

p6(Y):-module(r2(X),Y). % get module label
:-solve(p6(X)).