:- dynamic request/2, doctor/1, medical/1, consent/0.
:-compile('C:/GorgiasB/gorgias-src-0.6d/lib/gorgias.pl').
:-compile('C:/GorgiasB/gorgias-src-0.6d/ext/lpwnf.pl').
rule(r1(Agent, Data), deny(Agent, Data), []):-request(Agent, Data).
rule(r2(Agent, Data), allow_partial_access(Agent, Data), []):-request(Agent, Data), doctor(Agent), medical(Data).
rule(r3(Agent, Data), allow_full_access(Agent, Data), []):-medical(Data), request(Agent, Data), doctor(Agent).
rule(p1(Agent, Data), prefer(r2(Agent, Data), r1(Agent, Data)), []).
rule(p2(Agent, Data), prefer(r1(Agent, Data), r3(Agent, Data)), []).
rule(p3(Agent, Data), prefer(r3(Agent, Data), r1(Agent, Data)), []):-consent.
rule(c1(Agent, Data), prefer(p3(Agent, Data), p2(Agent, Data)), []).
complement(deny(Agent, Data), allow_partial_access(Agent, Data)).
complement(allow_partial_access(Agent, Data), deny(Agent, Data)).
complement(deny(Agent, Data), allow_full_access(Agent, Data)).
complement(allow_full_access(Agent, Data), deny(Agent, Data)).
complement(allow_partial_access(Agent, Data), allow_full_access(Agent, Data)).
complement(allow_full_access(Agent, Data), allow_partial_access(Agent, Data)).