the problem is how to obtain the list of all annotations of a predicate.
currently, we can write
X = p[a,b];
...
p[H|T] = X;
L = [H|T];
to get the annotations of X in L.
besides to verbose, it only works if X has at least one annotation. it X's annotations are empty, the unification will fail. A solution is to use a rule like
get_annots(X[], []).
get_annots(X[H|T], [H|T]).
and the program is
X = p[a,b];
...
?get_annots(X,L);
Another proposal:
X = p[a,b];
...
p@L = X;
where @ pre-fix the annotations (this symbol already means annotations in plans)
for compatibility reasons, p[....] and p@[....] should both work.
Maybe it doesn't worst to change the syntax for some rare use (and that some rules -- or a new internal action -- can solve).
another option to obtain the annotations of a literal is the operator =..
X = p[a,b];
...
X =.. [_,_,L];
...