The only difference between bagof/3 and setof/3 is that bagof/3 leaves repeated solutions in the answer. Note that bagof/3 is less expensive than setof/3.
Also note that, if there are no solutions then both bagof/3 and setof/3 fail! If you want a predicate that behaves like setof/3 (or bagof/3) but succeeds with an empty list if there are no solutions then write something like:
all(X,Y,Z):-which will behave in the desired way.setof(X,Y,Z),
!.
all(X,Y,[]). [-5pt]