Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e6a049c94b
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (28 sloc) 0.769 kb
:- use_module(bio(dbmeta)).
write_extensional_preds(Schema):-
dbmeta:datapred_spec(Schema,Spec),
writespec(Spec),
fail.
writespec(Spec-Desc):-
!,
writespec1(Spec),
format('% ~n'),
format('% ~w~n',Desc),
writespec2(Spec).
writespec(Spec):-
!,
writespec1(Spec),
writespec2(Spec).
writespec1(Spec):-
Spec=..[P|Args],
maplist(arg2spec,Args,Args2),
maplist(atom_concat('?'),Args2,Args3),
concat_atom(Args3,',',ArgSpec),
format('%% ~w(~w) is nondet~n',[P,ArgSpec]).
writespec2(Spec):-
functor(Spec,P,A),
format(':- extensional(~w/~w).~n~n',[P,A]).
arg2spec(A1,A2):-
A1=..[_,A2|_],
!.
arg2spec(A,A).
Jump to Line
Something went wrong with that request. Please try again.