:-use_module(library(tcltk)). :-use_module(library(charsio)). clist(X,D,F):-props(X,[(consequence(_,D):-G)]),tolist([(G)],F),consequenceDecrypter(D,F). tolist([X],[Y|Rest]):-makealist(X,[Y|Rest]). makealist((X,W),[Y|Rest]):-(X,W)=..[A,Y|Rest1] ,tolist(Rest1,Rest) . makealist(X,[X]). consequenceDecrypter([],_). consequenceDecrypter([A|Arest],B):- checkpostcondition([A],B),consequenceDecrypter(Arest,B). checkpostcondition([namic_relation(A,K)],B):- open('u:/testo.txt',append,W),format(W,' namic_relation = ~a',[K]),close(W). checkpostcondition( [namic_object(D,X)|R] ,B):- open('u:/testo.txt',append,W),format(W,' nomerel = namic_object',[X]),close(W),checkprecondition(X,B). checkpostcondition( [namic_agent(D,X)|R] ,B):- open('u:/testo.txt',append,W),format(W,' nomerel = namic_agent',[X]),close(W),checkprecondition(X,B). checkprecondition(X,[X<-G|Rest]):-stringa(G,Y),open('u:/testo.txt',append,W),format(W,' SemRel = ~a',[Y]),close(W),checkprecondition(X,Rest). /* checkprecondition(X,[nodeprop(D,G))|Rest]):-stringa(G,Y),open('u:/testo.txt',append,W),format(W,' SyntRel = ~a',[Y]),close(W),checkprecondition(X,Rest). */ checkprecondition(X,[A|Rest]):-checkprecondition(X,Rest). checkprecondition(X,[]). stringa(X,Y):- format_to_chars("~q",[X],D),%read_from_chars(D1,Y). togliparentesi(D,F,G), name(Y,G). togliparentesi([40|Rest],[40|Rest],[]). togliparentesi([X|Rest],Y,[X|Hrest]):-togliparentesi(Rest,Y,Hrest).