1:- module(bc_role, [
    2    bc_register_role/3,
    3    bc_unregister_role/1,
    4    bc_role/3
    5]).    6
    7:- use_module(library(debug)).    8:- use_module(library(error)).    9
   10:- dynamic(role/3).
 bc_role(Name, Label, Login) is nondet
Matches/generates all registered roles.
   16bc_role(Name, Label, Login):-
   17    role(Name, Label, Login).
 bc_register_role(+Name, +Label, +Login) is det
Registers a new role. Overwrites existing role.
   23bc_register_role(Name, Label, Login):-
   24    must_be(atom, Name),
   25    must_be(atom, Label),
   26    must_be(boolean, Login),
   27    (   role(Name, _, _)
   28    ->  retractall(role(Name, _, _))
   29    ;   true),
   30    assertz(role(Name, Label, Login)),
   31    debug(bc_role, 'type ~w registered', [Name]).
 bc_unregister_role(+Name) is det
Removes the given role. Does nothing when the role does not exist already.
   38bc_unregister_role(Name):-
   39    must_be(atom, Name),
   40    retractall(role(Name, _, _))