-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
daliirc modifications #41
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ | |
set_prolog_flag(discontiguous_warnings,off), | ||
open(FI,read,Stream,[]), read(Stream,Me), close(Stream), | ||
Me \= end_of_file, | ||
agent(File, AgentName, Ontolog, Lang, Fil, Lib, UP, DO, Specialization) = Me, | ||
agent(File, AgentName, Ontolog, Lang, Fil, Lib, UP, DO, Specialization,AgentType) = Me, | ||
open('server.txt',read,Stream2,[]),read(Stream2,T),close(Stream2), | ||
if(UP=no, true, assert(user_profile_location(UP))), | ||
if(DO=no,true,assert(dali_onto_location(DO))), | ||
|
@@ -104,8 +104,12 @@ | |
|
||
delete_agent_files(File), | ||
token(File), | ||
start1(File, AgentName, Lib, Fil). | ||
|
||
start1(File, AgentName, Lib, Fil,AgentType). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idem |
||
replace_substring(String, To_Replace, Replace_With, Result) :- | ||
( append([Front, To_Replace, Back], String) | ||
-> append([Front, Replace_With, Back], Result) | ||
; Result = String | ||
). | ||
load_ontology_file(Ontolog,Agent):- | ||
open(Ontolog,read,Stream,[]), | ||
read(Stream,PrefixesC), | ||
|
@@ -119,7 +123,7 @@ | |
|
||
filtra_fil(FI):-arg(1,FI,File),token_fil(File),retractall(parentesi(_)),togli_var_fil(File). | ||
|
||
start1(Fe,AgentName,Libr,Fil):- | ||
start1(Fe,AgentName,Libr,Fil,AgentType):- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idem |
||
set_prolog_flag(discontiguous_warnings,off), | ||
if(Libr=no,true,libreria(Fe,Libr,Fil)), | ||
|
||
|
@@ -165,9 +169,13 @@ | |
ass_internal_repeat, | ||
|
||
ass_stringhe_mul(FilePlv), | ||
|
||
open(FilePlv, append, Stream), | ||
atom_concat(' ?-',AgentType,E1), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idem |
||
atom_concat(E1,'.',E2), | ||
write(Stream, E2), | ||
close(Stream), | ||
compile(FilePlv), | ||
|
||
apri_learn(FileTxt), | ||
start_learn, | ||
manage_export_past, | ||
|
@@ -227,7 +235,6 @@ | |
repeat, | ||
member(M,L), | ||
spezza(M), | ||
|
||
M==U,!,retractall(rule_base(_)), if(clause(mul(_),_),ass_mul_first,true). | ||
|
||
examine_mul:-if(clause(mul(_),_),examine1_mul,true). | ||
|
@@ -539,7 +546,7 @@ | |
|
||
name(F,Lista),append(Lista1,[101],Lista), | ||
append(Lista1,[102],Lista3),name(Plf,Lista3), | ||
|
||
see(Plf), | ||
repeat, | ||
read(T), | ||
|
@@ -656,7 +663,7 @@ | |
|
||
|
||
|
||
aprifile_en(F):-see(F), | ||
aprifile_en(F):-see(F), | ||
repeat, | ||
read(T), | ||
assert(clause_man(T)), | ||
|
@@ -693,7 +700,7 @@ | |
%print('RECEIVED: '),print(message(Ind,Ag,IndM,AgM,Language,Ontology,Con)),nl, | ||
if(clause(receive(Con),_),chiama_con(AgM,IndM,Language,Ontology,Con),not_receivable_meta(AgM,IndM,Language,Ontology,Con)). | ||
|
||
chiama_con(AgM,IndM,Language,Ontology,Con):-if(receive(Con),true,not_receivable_message(AgM,IndM,Language,Ontology,Con)). | ||
chiama_con(AgM,IndM,Language,Ontology,Con):-write(Con),if(receive(Con),true,not_receivable_message(AgM,IndM,Language,Ontology,Con)). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a che serve questa write? |
||
|
||
%%EDITONTO asserisci_ontologia/2 | ||
send_message(E,AgM):-clause(ext_agent(AgM,IndM,Ontology,_),_), | ||
|
@@ -953,7 +960,7 @@ | |
fai(X,T,Ag):-functor(X,F,_),if(F=message,em_mess0(X,T,Ag),choose_action(X)),if(F\=message,(ver_az_int(X,T,Ag),!),true). | ||
|
||
choose_action(X):-functor(X,F,_),if(member(F,[drop_past,look_up_past,add_past,set_past,callasp]), | ||
take_past_actions(F,X),(print(make(X)),nl)),save_on_log_file(make(X)). | ||
take_past_actions(F,X),(print(make(X)),nl)). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perché hai tolto il log? |
||
|
||
take_past_actions(F,X):-write('Sono in Take_past_actions'),arg(1,X,E),caso0_past(F,E,X). | ||
caso0_past(F,X,Y):-if(F=drop_past,drop_evento(X),caso1_past(F,X,Y)). | ||
|
@@ -994,9 +1001,8 @@ | |
%% Azione di invio del messaggio | ||
emetti_ms(To,M,S,IndS,IndTo):-clause(own_language(Lang),_), | ||
invia_terms_ontology(O), | ||
out(message(IndTo,To,IndS,S,Lang,O,M)), | ||
out(message(IndTo,To,IndS,S,Lang,O,M)). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. qui cosa è diverso? |
||
%print(send_message_to(To,M,Lang,O)),nl, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perché togliere anche qui il log? |
||
save_on_log_file(send_message(M)). | ||
|
||
invia_terms_ontology(O):- | ||
clause(agent(Agent),_), | ||
|
@@ -1579,7 +1585,7 @@ | |
%APRE IL FILE PLV ED ASSERISCE LE REGOLE PER GLI EVENTI SINGOLI DEGLI EVENTI ESTERNI MULTIPLI | ||
%% e' chiamato dalla "take_meta_var" contenuta in "togli_var.pl" | ||
%% Il file PLV non è vuoto. Contiene cioè che è scritto nel file PL. | ||
aprifile_head_mul(F):-see(F), | ||
aprifile_head_mul(F):- see(F), | ||
repeat, | ||
read(T),expand_term(T,Te), | ||
if(T=end_of_file,true, | ||
|
@@ -1685,7 +1691,7 @@ | |
|
||
|
||
|
||
apri_learn(F):-see(F), | ||
apri_learn(F):-see(F), | ||
repeat, | ||
read(T),expand_term(T,Te), | ||
if(T=end_of_file,true, | ||
|
@@ -1706,7 +1712,7 @@ | |
format(Stream,"'~p'.",[T]),nl(Stream), | ||
close(Stream),leggi_l(Ag). | ||
|
||
leggi_l(Ag):-clause(agent(A),_),see('prova1%13%.txt'), | ||
leggi_l(Ag):-clause(agent(A),_),see('prova1%13%.txt'), | ||
read(T),send_msg_learn(T,A,Ag), | ||
seen, if(file_exists('prova1%13%.txt'),delete_file('prova1%13%.txt'),true). | ||
|
||
|
@@ -1992,7 +1998,7 @@ | |
|
||
|
||
save_on_log_file(P):-clause(agent(N),_), | ||
name('log/log_',L0),name(N,L1),name('.txt',L2), | ||
name('Examples/advanced/log/log_',L0),name(N,L1),name('.txt',L2), | ||
append(L0,L1,L01),append(L01,L2,L02),name(Q,L02), | ||
open(Q,append,Stream,[]), | ||
write(Stream,P),nl(Stream), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,7 +184,7 @@ | |
|
||
|
||
examine_all1(Me):-if(member(Me,['(',')']), conta_parentesi(Me),true), | ||
if(tempo(Me), scrittura(Me), % controlla se � stato inserito il deltat, se si scrivo nel file pl e asserisco time_add | ||
if(tempo(Me), scrittura(Me), % controlla se � stato inserito il deltat, se si scrivo nel file pl e asserisco time_add | ||
(if(variabile(Me),examine_variable(Me), | ||
if(label(Me),examine_label(Me),write_NovarNolabel(Me))) | ||
|
||
|
@@ -198,17 +198,17 @@ | |
isa_variable(El):-El>64,El<91. | ||
isa_variable(El):-El=95. | ||
|
||
%Verifica se � stato inserito il delta Temporale dall'agente | ||
%Verifica se � stato inserito il delta Temporale dall'agente | ||
|
||
tempo(Me):- name(Me,L), nth0(0,L,El,L1), El==116, numbertime(L1). %controlla che il primo carattere � una t | ||
numbertime(L1):- nth0(0,L1,El,L_rest),check_number(El), scorri(L_rest). %controlla se il primo elemento della lista � un numero e scorre la lista | ||
tempo(Me):- name(Me,L), nth0(0,L,El,L1), El==116, numbertime(L1). %controlla che il primo carattere � una t | ||
numbertime(L1):- nth0(0,L1,El,L_rest),check_number(El), scorri(L_rest). %controlla se il primo elemento della lista � un numero e scorre la lista | ||
check_number(El):- El>47, El<58. %range in ASCII per i numeri da 0 a 9 | ||
scorri(L_rest):-if(L_rest=[],true, scorri_list(L_rest)). %controlla che tutti gli elementi della lista sono numeri | ||
scorri_list(L_rest):- nth0(0,L_rest,X,L2), check_number(X),scorri(L2). | ||
scrittura(Me):- name(Me,L),nth0(0,L,R,L3), append([100,101,108,116,97,116,40],L3,L1), %scrittura sul file pl del deltat inserito dall'agente | ||
append(L1,[41],L2), clause(buffer(Parsed),_), retractall(buffer(_)), | ||
append(Parsed,L2,Parola),assert(buffer(Parola)), | ||
clause(deltaT(X),true),retractall(deltaT(X)),assert(deltaT(1)). %asserisco deltat a 1 in modo tale da sapere che � stato inserito | ||
clause(deltaT(X),true),retractall(deltaT(X)),assert(deltaT(1)). %asserisco deltat a 1 in modo tale da sapere che � stato inserito | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. non capisco qui dove sono le differenze |
||
|
||
|
||
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rompe la compatibilità con la versione esempi basic, non posso accettare un path hard-coded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anche qui che succede se uno studente decide di far girare la versione basic? In quel caso i types non sono utilizzati