%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The RuleML-2009 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(sponsor(contact(Name,Organization),Amount,results(Level,Benefits,DeadlineResults), performative(Action)),sponsor(contact("+","+"),"+",results("-","-","-"), performative("-"))," tweaew"). 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-2009 defined in an external ontology"). interface(topic(Topic),topic("?"),"the responsibility topics/domains of RuleML-2009"). interface(role(Role),role("?"),"the defined roles of the responsibility assignment matrix for RuleML-2009"). interface(assigned(Agent,Topic,Role),assigned("?","?","?"),"the defined responsibility assignment matrix for RuleML-2009"). interface(getContact(Topic,Request,Contact),getContact("+","+","-"),"request personal contact information for a certain Topic and Request regarding RuleML-2009"). interface(open(Phase),open("-"),"returns the currently active RuleML-2009 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-2009"). 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-2009"). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Import meta interpreter axioms for priority computation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% :-eval(add("use_caseRuleML2009/RuleML-2009_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-2009 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]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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(). % sponsor query for publicity chair processMessage(XID,From,Primitive,sponsor(contact(Name,Organization),Amount,results(Level,Benefits,DeadlineResults), performative(Action))):- println(["test"]), !, % look-up responsible agent println(["looking up responsible agent"]), %ruleml2009_GeneralChair assigned(XID, Agent,ruleml2009_Sponsoring,ruleml2009_responsible), println(["sending message to OO jDREW personal agent"]), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", sponsor(contact(Name,Organization),Amount,results(Level,Benefits,DeadlineResults), performative(Action))), println(["recieve message from OO jDREW personal agent"]), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(DeadlineResults,Action,Benefits,Level)), println(["sending message to external agent"]), sendMsg(XID,esb,From, "answer", sponsor(contact(Name,Organization),Amount,results(Level,Benefits,DeadlineResults), performative(Action))). % contact publicity chair processMessage(XID,From,Primitive,contactPublicityChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)):- !, % look-up responsible agent println(["looking up responsible agent"]), assigned(XID, Agent,ruleml2009_Sponsoring,ruleml2009_responsible), % query permission from responsible agent println(["sending message to OO jDREW personal agent"]), sendMsg(XID,esb,Agent, "query", contactPublicityChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), % receive answers multiple times println(["recieve message from OO jDREW personal agent"]), rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), println(["sending message to external agent"]), sendMsg(XID,esb,From, "answer", contactPublicityChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)). % contact general chair processMessage(XID,From,Primitive,contactGeneralChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Symposium,ruleml2009_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", contactGeneralChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), sendMsg(XID,esb,From, "answer", contactGeneralChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)). % contact program chair processMessage(XID,From,Primitive,contactProgramChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Submission,ruleml2009_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", contactProgramChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), sendMsg(XID,esb,From, "answer", contactProgramChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)). % contact panel chair processMessage(XID,From,Primitive,contactPanelChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Panel,ruleml2009_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", contactPanelChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), sendMsg(XID,esb,From, "answer", contactPanelChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)). % view pending panel topics processMessage(XID,From,Primitive,checkPendingPanelTopics(Meeting, Topic)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Panel,ruleml2009_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,ruleml2009_Panel,ruleml2009_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, Day, Month, Year)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Panel,ruleml2009_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", viewPanelTime(Meeting, Time, Day, Month, Year)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Time, Day, Month, Year)), sendMsg(XID,esb,From, "answer", viewPanelTime(Meeting, Time, Day, Month, Year)). %contact Liaison Chair processMessage(XID,From,Primitive,contactLiaisonChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Partners,ruleml2009_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", contactLiaisonChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), sendMsg(XID,esb,From, "answer", contactLiaisonChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)). %organization partners processMessage(XID,From,Primitive,viewOrganizationPartners(Meeting, Partner)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Partners,ruleml2009_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)). %media partners processMessage(XID,From,Primitive,viewSponsors(Meeting, Partner)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Partners,ruleml2009_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)). %sponsors processMessage(XID,From,Primitive,viewSponsors(Meeting, Sponsor, SponsorLevel)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Partners,ruleml2009_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)). %sponsors without sponsoring level processMessage(XID,From,Primitive,viewMediaPartners(Meeting, Sponsor)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Partners,ruleml2009_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", viewMediaPartners(Meeting, Sponsor)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Sponsor)), sendMsg(XID,esb,From, "answer", viewMediaPartners(Meeting, Sponsor)). %contact web chair processMessage(XID,From,Primitive,contactWebChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Website,ruleml2009_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", contactWebChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), sendMsg(XID,esb,From, "answer", contactWebChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)). %contact challenge chair processMessage(XID,From,Primitive,contactChallengeChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)):- !, % look-up responsible agent assigned(XID, Agent,ruleml2009_Challenge,ruleml2009_responsible), % query permission from responsible agent sendMsg(XID,esb,Agent, "query", contactChallengeChair(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), % receive answers multiple times rcvMult(XID,esb,Agent,"answer", substitutions(Meeting, Chair, FirstName, LastName, Title, Email, Telephone)), sendMsg(XID,esb,From, "answer", contactChallengeChair(Meeting, Chair, FirstName, LastName, Title, Email, 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://ruleml.org/RuleML-2009/RuleResponder/RuleML-2009.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:ruleml2009_Organizing_Committee). agent(XID,Agent):- sendMsg(XID,esb,"RuleML-2009","no_further_answers", agent(Member)),fail(). % responsibility domain of RuleML 2009 responsibility(XID,Domain:ruleml2009_Responsibility). % role such as "responsible", "informed", "accountable" etc. role(XID,Role:owl_ObjectProperty). % responsibility assignment matrix % e.g. ruleml2009_GeneralChair ruleml2009_responsible ruleml2009_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 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % request personal contact information from responsible personal agent getContact(XID,Topic,Request,Contact):- % look-up responsible agent assigned(XID,Agent,Topic,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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,ruleml2009_Submission,ruleml2009_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))).