% ------------------------------------------------------------------------------------------------------
% Database Integration Demonstration
% 
% 
% ------------------------------------------------------------------------------------------------------

% include basic predicates
:-eval(consult('ContractLog/math.prova')).
:-eval(consult('ContractLog/list.prova')).
:-eval(consult('ContractLog/list_math.prova')).
:-eval(consult('ContractLog/datetime.prova')).
:-eval(consult('ContractLog/timeinterval.prova')).
:-eval(consult('ContractLog/basic_eca.prova')).
:-eval(consult('ContractLog/ec.prova')).
:-eval(consult('examples/function_tests/ec_db/db.prova')).
:-eval(consult("ContractLog/utils.prova")).


% ------------------------------------------------------------------------ 
% Integrate Database

location(database,"rbsla","jdbc:mysql://localhost/rbsla","root","").
table("testdata").
timelimit(datetime(2006,1,1,13,22,0)).

% ------------------------------------------------------------------------ 
%
% Some EC rules for a webserver

initiates(serverGoesDown, serverIsDown, T).
terminates(serverAwakes, serverIsDown, T).


:- solve(happens(X,T)).

setNewTimeLimit():-
	println(["set new time limit"]),
	set_timelimit(datetime(2006,1,1,0,0,0)).
	
:- solve(setNewTimeLimit()).
:- solve(happens(X,T)).