%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The RuleML-2008 Organizational Agent %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Import external ContractLog libraries for % mathematical, lists and date / time computations % and access to external data sources, e.g. % Semantic Web ontologies, iCal Calendars etc. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% :-eval(consult('ContractLog/math.prova')). :-eval(consult('ContractLog/datetime.prova')). :-eval(consult('ContractLog/list.prova')). :-eval(consult('ContractLog/update.prova')). :-eval(consult('ContractLog/utils.prova')). :-eval(consult('ContractLog/calendar.prova')). % calendar API :-eval(consult('ContractLog/owl.prova')). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Performative vocabulary of organizational agent % More complex vocabularies (e.g. FIPA ACL) might be defined as Semantic Web ontologies %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% performative(request):-performative(query). performative(query). performative(XID,Performative):- performative(Performative). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Public interface definitions of the organizational agent % Might be also defined externally, e.g. using RDF % Format: interface(Signature, ModeDeclaration, Description) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% interface(performative(Performative),performative("?"),"vocabulary of performatives of the agent"). interface(interface(Signature, ModeDeclaration, Description),interface("?","?","?"),"the public interfaces of the agent"). interface(submit(Requester, Type, Result),submit("+","+","-"),"submital rules"). interface(agent(Agent),agent("?"),"the agents of RuleML-2008 defined in an external ontology"). interface(topic(Topic),topic("?"),"the responsibility topics/domains of RuleML-2008"). interface(role(Role),role("?"),"the defined roles of the responsibility assignment matrix for RuleML-2008"). interface(assigned(Agent,Topic,Role),assigned("?","?","?"),"the defined responsibility assignment matrix for RuleML-2008"). interface(getContact(Topic,Request,Contact),getContact("+","+","-"),"request personal contact information for a certain Topic and Request regarding RuleML-2008"). interface(open(Phase),open("-"),"returns the currently active RuleML-2008 phases"). interface(dates(Phase,Start,End),dates("+","-","-"),"returns the start and end date of a phase"). interface(permit(ContactAuthor,submit(ContactAuthor,Submission)),permit("?",submit("?","?")), "permission to submit to RuleML-2008"). interface(submitted(Submission),submitted("?"),"request submitted submissions"). interface(obliged(Reviewer,submit(Reviewer,Review)),obliged("?",submit("?","?")), "review obligations for reviewer"). interface(forbid(Reviewer,review(submission(Authors,Abstract,Paper),Review)),forbid("?",review(submission("?","?","?"),"?")), "forbid reviewer to review his own submissions"). interface(accepted(Submission),accepted("?"),"accepted submissions"). interface(fee(Phase,Fee),fee("?","?"),"registration fee"). interface(computeFee(Participant,Fee),computeFee("?","?"),"compute registration fee for participant"). interface(oblige(Participant,pay(Fee)),oblige("?",pay("?")),"obligation for registered participants to pay fee"). interface(permit(Participant,attend),permit("?","-"),"permission to attend the conference"). interface(permit(Participant,register(Participant)),permit("?",register("?")), "permission to register to RuleML-2008"). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Import meta interpreter axioms for priority computation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% :-eval(add("use_caseRuleML-2008/RuleML-2008_Organization/meta_rules/priority_computation.prova")). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Main rule for this use case: % % "Single point of entry" % % An external person/agent requests information from the % RuleML-2008 organization. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% rcvMsg(XID,esb, From, Performative, [X|Args]) :- understandPerformative(XID, From, Performative, [X|Args]), processMessage(XID, From, Performative, [X|Args]). rcvMsg(XID,esb, From, Performative, [X|Args]) :- understandPerformative(XID, From, Performative, [X|Args]), rcvMsg(XID,esb,Agent,no_further_answers, Payload), sendMsg(XID,esb,From,no_further_answers,[X|Args]). % sendMsg(XID,esb,From,end_of_transmission,[X|Args]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % rules for processing the message %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % try to understand the performative of the message understandPerformative(XID, From, "answer", PayLoad) :- !, fail(). understandPerformative(XID, From, "end_of_transmission", PayLoad) :- !, fail(). understandPerformative(XID, From, "no_further_answers", PayLoad) :- !, fail(). understandPerformative(XID, From, Performative, PayLoad) :- performative(Performative). understandPerformative(XID, From, Performative, PayLoad) :- not(performative(Performative)), sendMsg(XID,esb,From,"answer", notUnderstood("performative",Performative)), sendMsg(XID,esb,From,"no_further_answers", PayLoad), fail(). % process the message % sponsor query for publicity chair processMessage(XID,From,Primitive,sponsor(contact(Name,Organization),Amount,results(Level,Benefits,DeadlineResults), performative(Action))):- !, % look-up responsible agent assigned(XID, Agent,ruleml2008_Sponsoring,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", sponsor(contact(Name,Organization),Amount,results(Level,Benefits,DeadlineResults), performative(Action))), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(DeadlineResults,Action,Benefits,Level)), sendMsg(XID,esb,From, "answer", sponsor(contact(Name,Organization),Amount,results(Level,Benefits,DeadlineResults), performative(Action))). % view pending panel topics processMessage(XID,From,Primitive,checkPendingPanelTopics(Meeting, Topic)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2008_Panel,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", checkPendingPanelTopics(Meeting, Topic)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Topic)), sendMsg(XID,esb,From, "answer", checkPendingPanelTopics(Meeting, Topic)). % view pending panel participants processMessage(XID,From,Primitive,checkPendingPanelParticipants(Meeting, Participant, Organization)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2008_Panel,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", checkPendingPanelParticipants(Meeting, Participant, Organization)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Participant, Organization)), sendMsg(XID,esb,From, "answer", checkPendingPanelParticipants(Meeting, Participant, Organization)). % view panel time processMessage(XID,From,Primitive,viewPanelTime(Meeting, Time, Year, Month, Day)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2008_Panel,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", viewPanelTime(Meeting, Time, Year, Month, Day)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Time, Year, Month, Day)), sendMsg(XID,esb,From, "answer", viewPanelTime(Meeting, Time, Year, Month, Day)). %View organization partners processMessage(XID,From,Primitive,viewOrganizationPartners(Meeting, Partner)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2008_Partners,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", viewOrganizationPartners(Meeting, Partner)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Partner)), sendMsg(XID,esb,From, "answer", viewOrganizationPartners(Meeting, Partner)). %View sponsors processMessage(XID,From,Primitive,viewSponsors(Meeting, Partner)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2008_Partners,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", viewSponsors(Meeting, Partner)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Partner)), sendMsg(XID,esb,From, "answer", viewSponsors(Meeting, Partner)). %View sponsors with regards to sponsoring level processMessage(XID,From,Primitive,viewSponsors(Meeting, Sponsor, SponsorLevel)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2008_Partners,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", viewSponsors(Meeting, Sponsor, SponsorLevel)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Sponsor, SponsorLevel)), sendMsg(XID,esb,From, "answer", viewSponsors(Meeting, Sponsor, SponsorLevel)). %View sponsors without regards to sponsoring level processMessage(XID,From,Primitive,viewMeidaPartners(Meeting, Sponsor)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2008_Partners,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", viewMeidaPartners(Meeting, Sponsor)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Sponsor)), sendMsg(XID,esb,From, "answer", viewMeidaPartners(Meeting, Sponsor)). % General Contact Rule for all agents %processMessage(XID,From,Primitive,getContact(Topic,Request,Contact)):- % !, % look-up responsible agent % assigned(XID,Agent,Topic,ruleml2008_responsible), % query permission from responsible agent % sendMsg(XID,esb,Agent, "query", person(Email,Title, Name, Chair, Telephone)), % receive answers multiple times % rcvMult(XID,esb,Agent,"answer", substitutions(Email,Title, Name, Chair, Telephone)), % sendMsg(XID,esb,From, "answer", person(Email,Title, Name, Chair, Telephone)). % General Contact Rule for all agents processMessage(XID,From,Primitive,getContact(Topic,Request,Contact)):- !, % look-up responsible agent assigned(XID,Agent,Topic,ruleml2008_responsible), findAgent(XID,From,Agent). findAgent(XID,From,Agent) :- % query permission from responsible agent sendMsg(XID,esb,Agent, "query", person(Email,Title, Name, Chair, Telephone)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Email,Title, Name, Chair, Telephone)), sendMsg(XID,esb,From, "answer", person(Email,Title, Name, Chair, Telephone)). % look-up interface processMessage(XID,From,Primitive,[X|Args]):- not(interface([X|Args],ModeDeclarations,Description)), sendMsg(XID,esb,From,"answer", noPublicInterface(interface([X|Args]))), sendMsg(XID,esb,From,"no_further_answers", [X|Args]), fail(). processMessage(XID,From,Primitive,[Function|Arguments]):- interface([Function|Arguments],ModeDeclarations,Description), %TODO: write rule which checks signature and mode declarations (dynamic testing) derive([Function,XID|Arguments]), sendMsg(XID,esb,From, "answer", [Function|Arguments]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Import Responsibility Assignment Matrix from ontology and define % the query functions of the organizational agent on top %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % import external ontology of responsibility assignment matrix %import("http://ibis.in.tum.de/projects/paw/ruleml-2008/RuleML-2008.owl"). import("http://www.ruleml.org/RuleML-2008/RuleResponder/RuleML-2008.owl"). % use external OWL Lite reasoner for a list of available reasoners % see the OWL2PROVA API reasoner("owl"). % member of the organizing committee agent(XID,Agent:ruleml2008_Organizing_Committee). agent(XID,Agent):- sendMsg(XID,esb,"RuleML-2008","no_further_answers", agent(Member)),fail(). % responsibility domain of RuleML 2008 responsibility(XID,Domain:ruleml2008_Responsibility). % role such as "responsible", "informed", "accountable" etc. role(XID,Role:owl_ObjectProperty). % responsibility assignment matrix % e.g. ruleml2008_GeneralChair ruleml2008_responsible ruleml2008_Symposium assigned(XID,Agent,Responsibility,Role):- import(URL), reasoner(Reasoner), rdf(URL,Reasoner,Agent,Role,Responsibility). interface(XID,Signature,Modes,Description):- interface(Signature,Modes,Description). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Requests to personal agents % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % General Contact Rule for all agents %getContact(XID,Topic,Request,Contact):- % look-up responsible agent %assigned(XID,Agent,Topic,ruleml2008_responsible), %TODO: Implement the escalation procedure here % query personal contact information from agent %sendMsg(XID,esb,Agent, "query", person(Name,Role1, Title, EMail, Telephone)), % receive answers multiple times %rcvMult(XID,esb,Agent, "answer", Contact). % request open phases open(XID,Phase):- % look-up responsible agent for Submissions assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", open(Phase)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", open(Phase)). % request open phases dates(XID,Phase,Start,End):- % look-up responsible agent for Submissions assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", dates(Phase,Start,End)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", dates(Phase,Start,End)). % permission to submit permit(XID,ContactAuthor,submit(ContactAuthor,Submission)):- % look-up responsible agent assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", permit(ContactAuthor,submit(ContactAuthor,Submission))), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", permit(ContactAuthor,submit(ContactAuthor,Submission))). % request submission from the responsible personal agent for "Submissions" submitted(XID,Submission):- % look-up responsible agent assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", submitted(Submission)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", submitted(Submission)). obliged(XID,Reviewer,submit(Reviewer,Review)):- % look-up responsible agent assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", obliged(Reviewer,submit(Reviewer,Review))), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", obliged(Reviewer,submit(Reviewer,Review))). forbid(XID,Reviewer,review(submission(Authors,Abstract,Paper),Review)):- % look-up responsible agent assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", forbid(Reviewer,review(submission(Authors,Abstract,Paper),Review))), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", forbid(Reviewer,review(submission(Authors,Abstract,Paper),Review))). accepted(XID,Submission):- % look-up responsible agent assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", accepted(Submission)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", accepted(Submission)). fee(XID,Phase,Fee):- % look-up responsible agent assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", fee(Phase,Fee)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", fee(Phase,Fee)). computeFee(XID,Participant,Fee):- % look-up responsible agent assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", computeFee(Participant,Fee)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", computeFee(Participant,Fee)). oblige(XID,Participant,pay(Fee)):- % look-up responsible agent assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", oblige(Participant,pay(Fee))), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", oblige(Participant,pay(Fee))). permit(XID,Participant,attend):- % look-up responsible agent assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", permit(Participant,attend)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", permit(Participant,attend)). permit(XID,Participant,register(Participant)):- % look-up responsible agent assigned(XID,Agent,ruleml2008_Submission,ruleml2008_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", permit(Participant,register(Participant))), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", permit(Participant,register(Participant))).