Last active
June 11, 2020 09:57
-
-
Save kenwebb/6ee032b8913680e72191ffea48dca46f to your computer and use it in GitHub Desktop.
Agent Technologies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Thu Jun 11 2020 05:57:26 GMT-0400 (Eastern Daylight Time)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
Xholon | |
------ | |
Title: Agent Technologies | |
Description: | |
Url: http://www.primordion.com/Xholon/gwt/ | |
InternalName: 6ee032b8913680e72191ffea48dca46f | |
Keywords: | |
My Notes | |
-------- | |
June 2, 2020 | |
Agent technologies, including interactions between agents | |
http://127.0.0.1:8080/war/Xholon.html?app=Agent+Technologies&src=lstr&gui=clsc | |
http://127.0.0.1:8080/war/Xholon.html?app=Agent+Technologies&src=lstr&gui=clsc&jslib=nearley/nearley,nearley/fipaAcl | |
See notes in my Island Game folder: | |
- Jan 15 2020 (2 pages) messaging between agents, dialogs, MSC | |
- Feb 7 2020 | |
- Feb 21 2020 (3 pages) | |
- Dec 20 2019 Jen mechanisms, scenarios | |
Some Xholon interaction scenarios: | |
- two co-located Avatars | |
- two Avatars located in different parts of the same simulation | |
- two Avatars connected using webrtc | |
- an Avatar with a simple JavaScript behavior | |
- interacting with a Human directly or through a game PC (player character) | |
- etc. | |
FIPA | |
---- | |
The following table represents the current set of Standard FIPA specifications. | |
Identfr Title | |
------- ----- | |
SC00001 FIPA Abstract Architecture Specification | |
SC00008 FIPA SL Content Language Specification | |
SI00014 FIPA Nomadic Application Support Specification | |
SC00023 FIPA Agent Management Specification | |
SC00026 FIPA Request Interaction Protocol Specification | |
SC00027 FIPA Query Interaction Protocol Specification | |
SC00028 FIPA Request When Interaction Protocol Specification | |
SC00029 FIPA Contract Net Interaction Protocol Specification | |
SC00030 FIPA Iterated Contract Net Interaction Protocol Specification | |
SC00033 FIPA Brokering Interaction Protocol Specification | |
SC00034 FIPA Recruiting Interaction Protocol Specification | |
SC00035 FIPA Subscribe Interaction Protocol Specification | |
SC00036 FIPA Propose Interaction Protocol Specification | |
SC00037 FIPA Communicative Act Library Specification | |
SC00061 FIPA ACL Message Structure Specification | |
SC00067 FIPA Agent Message Transport Service Specification | |
SC00069 FIPA ACL Message Representation in Bit-Efficient Specification | |
SC00070 FIPA ACL Message Representation in String Specification | |
SC00071 FIPA ACL Message Representation in XML Specification | |
SC00075 FIPA Agent Message Transport Protocol for IIOP Specification | |
SC00084 FIPA Agent Message Transport Protocol for HTTP Specification | |
SC00085 FIPA Agent Message Transport Envelope Representation in XML Specification | |
SC00088 FIPA Agent Message Transport Envelope Representation in Bit Efficient Specification | |
SI00091 FIPA Device Ontology Specification | |
SC00094 FIPA Quality of Service Specification | |
SC00097 FIPA Design Process Documentation Template | |
FIPA Communicative Act Library example (FIPA SC00037J, 2002) [refs 6,7,8] | |
-------------------------------------- | |
3.8 Inform | |
Summary: The sender informs the receiver that a given proposition is true. | |
Message Content: A proposition | |
Description: | |
inform indicates that the sending agent: | |
• holds that some proposition is true, | |
• intends that the receiving agent also comes to believe that the proposition is true, and, | |
• does not already believe that the receiver has any knowledge of the truth of the proposition. | |
Example: | |
Agent i informs agent j that (it is true that) it is raining today. | |
(inform | |
:sender (agent-identifier :name i) | |
:receiver (set (agent-identifier :name j)) | |
:content | |
"weather (today, raining)" | |
:language Prolog) | |
TODO | |
---- | |
- DONE do a simple prototype of a FIPA communication act using standard Xholon message passing (see below) | |
- add a single new signal to org.primordion.xholon.base.ISignal.java | |
- to support FIPA ACL | |
- write a JavaScript library to help with FIPA ACL | |
Question | |
-------- | |
- how is a JavaScript Promise like and unlike async messaging using Xholon msg() ? | |
To use the nearley parser | |
------------------------- | |
// Create a Parser object from our grammar. | |
const parser = new nearley.Parser(nearley.Grammar.fromCompiled(grammar)); | |
// Parse something! | |
parser.feed('(inform :sender (agent-identifier :name i) :receiver (set (agent-identifier :name j)) :content "weather (today, raining)" :language Prolog)'); | |
// parser.results is an array of possible parsings. | |
console.log(parser.results); // YES JavaScript Object | |
References | |
---------- | |
(1) http://www.jamesodell.com/index.html | |
(2) http://www.jamesodell.com/publications.html | |
(3) http://www.jamesodell.com/Agent_Technology-An_Overview.pdf | |
"Agent Technology - An Overview," paper/booklet, James Odell, paper, 2011 | |
210 pages | |
ch 5: Agent Communication | |
ch 6: Agent Interaction | |
(4) https://en.wikipedia.org/wiki/Software_agent | |
In computer science, a software agent is a computer program that acts for a user or other program in a relationship of agency | |
(5) conradbock.org/bockonline.html | |
UML, Agent-based modeling | |
agent interaction protocols (AIP) | |
(6) fipa.org | |
(7) http://fipa.org/specifications/index.html | |
(8) http://fipa.org/repository/standardspecs.html | |
FIPA is an IEEE Computer Society standards organization that promotes agent-based technology and the interoperability of its standards with other technologies. | |
the site does not seem to have been updated for 10 years or so | |
I downloaded all specifications as: standardspecs.tar.gz | |
(9) http://fipa.org/resources/livesystems.html | |
list of agent software; out of date | |
(10) http%3A%2F%2Fwww.businessdictionary.com%2Fdefinition%2Fagents-technology.html | |
What is an application agent? | |
A software agent is a persistent, goal-oriented computer program that reacts to its environment and runs without continuous direct supervision to perform some function for an end user or another program. | |
... | |
Among a great many other applications, software agents: Conduct targeted Internet searches. | |
(11) https://www.sce.carleton.ca/netmanage/docs/AgentsOverview/ao.html | |
old, but cited numerous times | |
Software Agents: An Overview, Hyacinth S. Nwana | |
Intelligent Systems Research, Advanced Applications & Technology Department, BT Laboratories, Martlesham Heath, Ipswich, Suffolk, IP5 7RE, U.K. | |
(12) https://scholar.google.ca/scholar?q=agent+technologies+javascript&hl=en&as_sdt=0&as_vis=1&oi=scholart | |
(13) github query: agent javascript | |
(14) https://github.com/samtecspg/articulate | |
(15) http://spg.ai/projects/articulate/ | |
A platform for building conversational interfaces with intelligent agents (chatbots) | |
KSW this is a very complex system | |
(16) https://www.researchgate.net/publication/221155939_An_Agent_Modeling_Language_Implementing_Protocols_through_Capabilities | |
An Agent Modeling Language Implementing Protocols through Capabilities, Nikolaos Spanoudakis and Pavlos Moraitis, 2008 | |
In this paper we present how to use the Agent | |
MOdeling LAnguage (AMOLA) to define agent | |
interaction protocols and how to integrate these in an | |
agent model. | |
(17) https://www.researchgate.net/publication/234779847_Modelling_and_visualizing_agent_conversations | |
uses FIPA protocol | |
(18) https://en.wikipedia.org/wiki/Knowledge_Query_and_Manipulation_Language | |
Knowledge Query and Manipulation Language | |
The Knowledge Query and Manipulation Language, or KQML, is a language and protocol for communication among software agents and knowledge-based systems. | |
The KQML message format and protocol can be used to interact with an intelligent system, either by an application program, or by another intelligent system. | |
KQML's "performatives" are operations that agents perform on each other's knowledge and goal stores. | |
Higher-level interactions such as contract nets and negotiation are built using these. | |
KQML's "communication facilitators" coordinate the interactions of other agents to support knowledge sharing. | |
Experimental prototype systems support concurrent engineering, intelligent design, intelligent planning, and scheduling. | |
KQML is superseded by FIPA-ACL. | |
(19) https://en.wikipedia.org/wiki/Agent_Communications_Language | |
Agent Communications Language | |
Agent Communication Language (ACL), proposed by the Foundation for Intelligent Physical Agents (FIPA), is a proposed standard language for agent communications. | |
Knowledge Query and Manipulation Language (KQML) is another proposed standard. | |
The most popular ACLs are: | |
FIPA-ACL (by the Foundation for Intelligent Physical Agents, a standardization consortium) | |
KQML (Knowledge Query and Manipulation Language) | |
Both rely on speech act theory developed by Searle in the 1960s[3] and enhanced by Winograd and Flores in the 1970s. | |
They define a set of performatives, also called Communicative Acts, and their meaning (e.g. ask-one). | |
The content of the performative is not standardized, but varies from system to system. | |
To make agents understand each other they have to not only speak the same language, but also have a common ontology. | |
An ontology is a part of the agent's knowledge base that describes what kind of things an agent can deal with and how they are related to each other. | |
Examples of frameworks that implement a standard agent communication language (FIPA-ACL) include FIPA-OS and Jade. | |
(20) https://www.csee.umbc.edu/csee/research/kqml/ | |
(21) https://en.wikipedia.org/wiki/Java_Agent_Development_Framework | |
Java Agent Development Framework, or JADE, is a software framework for the development of intelligent agents, implemented in Java. | |
JADE system supports coordination between several agents FIPA and provides a standard implementation of the communication language FIPA-ACL, | |
which facilitates the communication between agents and allows the services detection of the system. JADE was originally developed by Telecom Italia and is distributed as free software. | |
(22) https://jade.tilab.com/ | |
JAVA Agent DEvelopment Framework | |
is an open source platform for peer-to-peer agent based applications | |
latest is 2017 | |
book: Developing Multi-Agent Systems with JADE, 2007 | |
(23) https://jade.tilab.com/wade/doc/WADE-User-Guide.pdf | |
WADE (Workflows and Agents Development framework) is a software platform that facilitates the development of distributed multi agent applications where agent tasks can be defined according to the workflow metaphor. | |
From a different point of view WADE can be seen as an agent oriented Workflow Engine suitable to be used for business process orchestration. | |
This document gives an overview of the WADE platform, presents its architecture and main functionalities, and outlines the conceptual model underlying it. | |
Two major aspects of the platform are described: the execution model based on the workflow metaphor and the configuration and control features designed to hide the complexity of the distribution. | |
WADE is based on JADE, a popular open source agent-oriented middleware and inherits from ita distributed topology with peer-to-peer networking and a software component architecture based on the agent paradigm. | |
(24) https://jade.tilab.com/amuseproject/ | |
AMUSE, Agent-based Multi-User Social Environment | |
AMUSE (Agent-based Multi-User Social Environment) is a software platform that facilitates the development of distributed social applications involving users that cooperate/compete to achieve common or private goals. | |
Within this scope the primary focus of Amuse is on multi player on-line games. | |
It should be noticed that Amuse address aspects related to match organization and coordination as well as time synchronization and direct terminal-to-terminal communication. | |
On the other hand it does not include any support for graphics and GUI development. | |
In the current version only Android-based games are supported. Other technologies will be addressed in future versions. | |
Amuse is based on JADE and its extension WADE and is developed within the same Community. At present there is no dedicated support for Amuse developers. | |
The usual (jade-develop mailing list) should be used to receive support, post comments and suggestions and provide contributions. | |
Current version of AMUSE is AMUSE 1.6 released on 29/04/2016. | |
(25) https://jade.tilab.com/wadeproject/ | |
(26) https://en.wikipedia.org/wiki/Autonomous_agent | |
(27) https://en.wikipedia.org/wiki/Intelligent_agent | |
(28) https://goalapl.atlassian.net/wiki/spaces/GOAL/overview?mode=global | |
GOAL agent programming language | |
Goal is a rule-based programming language for programming cognitive agents that interact with an environment and with each other. | |
(29) https://en.wikipedia.org/wiki/High_Level_Architecture | |
The High Level Architecture (HLA) is a standard for distributed simulation, used when building a simulation for a larger purpose by combining (federating) several simulations. | |
The standard was developed in the 90s under the leadership of the US Department of Defense[2] and was later transitioned to become an open international IEEE standard. | |
It is a recommended standard within NATO through STANAG 4603.[3] Today the HLA is used in a number of domains including defense and security and civilian applications. | |
(30) https://en.wikipedia.org/wiki/Foundation_for_Intelligent_Physical_Agents | |
FIPA | |
(31) https://en.wikipedia.org/wiki/Agent-oriented_programming | |
(32) http://ootips.org/agent-orientation.html | |
Agent Oriented Programming, Source: comp.object, comp.ai, Date: 17-Jul-97 | |
Ian Begg asked: | |
Yesterday I read a document which was discussing a future modeling/simulation system, and it was recommending the use of "Agent" technology. | |
The claim being made was that this represented a level of abstraction above and beyond the current capabilities of Object Oriented Technology. | |
The author then gave an example of what an "Agent" in the sense of modeling was. After reading this example I was confused as to why this technology was beyond what OO is capable of. | |
Mark Baker replied: | |
The biggest difference, IMHO, between "traditional OO" and agents is coupling. | |
"Traditional OO" has focused on defining interfaces (eg. OMG IDL) for objects. | |
Coupling can be kept to a minimum by good design, but ultimately, one object needs to invoke a specific method with specific arguments on the other object, thereby coupling the two in code. | |
The same method invocation does of course has to occur for agents, but with one major difference; there's effectively just one method on each agent, with one argument. | |
All the semantics of the invocation are bundled into that one argument. | |
It's much like human-human communications, where a common language (eg. English) can be used to initiate complex cooperative behaviour. | |
An agent might do the same thing by asking another agent "Tell me your name". | |
The target agent has to parse this using a common knowledge layer to understand that it's being asked to respond with its "name". | |
So for agents, coupling is entirely in the metadata. | |
IMO, agents are much better suited for massively distributed computing than traditional objects, since dynamic discovery and late binding are going to be pervasive. | |
Static, even well defined unambiguous interfaces and contracts just can't cut it unless they provide a mechanism to describe themselves in the knowledge layer. | |
And even then, I'm not sure what value there is to doing this since client agents will already have to handle the case where an agent responds with "Huh?". | |
But I suppose these semantic contracts could be used for trading (ala ANSA/CORBA), so it's probably not entirely a bad idea. | |
Bill House explained: | |
This is why agent communications are usually done via a specialized agent-communication language (ACL). | |
The language defines the domain of discourse and implies the logical semantics of the conversation. | |
Here are some differentiators between agents and objects: | |
* Agents may communicate using an Agent Communication Language, whereas objects communicate via fixed method interfaces. | |
* Agents have the quality of volition. That is, using AI techniques, intelligent agents are able to judge their results, | |
then modify their behavior (and thus their own internal structure) to improve their perceived fitness. | |
* Objects are abstractions of things like invoices or PLCs. | |
Agents are abstractions of intelligent beings -- they are essentially anthropomorphic. | |
Note that this does not mean that agents are intelligent in the human sense, only that they are modeled after an anthropomorphic architecture, with beliefs, desires, etc. | |
(33) https://site.ieee.org/pes-mas/agent-technology/standards-and-interoperability/ | |
) https://site.ieee.org/pes-mas/agent-technology/concepts/ | |
(34) https://www.computer.org/publications/tech-news/computing-now/software-agents-twenty-years-and-counting/software-agents-interviews | |
2013 update on FIPA etc. | |
(35) https://ebiquity.umbc.edu/us/ | |
) https://ebiquity.umbc.edu/blogger/2008/07/06/new-fipaomg-standards-for-agents/ | |
(36) https://www.omg.org/agent/ | |
James Odell is chair, and was also chair of FIPA | |
(37) https://www.omgwiki.org/agent/doku.php | |
2019 | |
(38) https://github.com/search?q=agent+oriented&type=Repositories | |
nothing useful in JavaScript | |
mostly Java including: SARL, jason, | |
(39) book that I have: John I. Saeed, Sematics | |
ch 8: Functions of Language: Speech as Action | |
Speech Act theory, Austin, Searle | |
performatives | |
(40) https://www.sciencedirect.com/science/article/pii/S0164121214000028 | |
Radigost: Interoperable web-based multi-agent platform, 2014 | |
(41) Railsback and Grimm book (2019) | |
see index "interaction" | |
p. 42 ODD Interaction questions | |
p. 173 Interaction chapter | |
(42) https://dl.acm.org/doi/pdf/10.1145/1293731.1293735 | |
Specifying Protocols for Multi-Agent Systems Interaction, STEFAN POSLAD | |
focus on FIPA Agent Communication Language (ACL) | |
(43) https://en.wikipedia.org/wiki/Belief%E2%80%93desire%E2%80%93intention_software_model | |
The belief–desire–intention software model (BDI) is a software model developed for programming intelligent agents. | |
Superficially characterized by the implementation of an agent's beliefs, desires and intentions, it actually uses these concepts to solve a particular problem in agent programming. | |
In essence, it provides a mechanism for separating the activity of selecting a plan (from a plan library or an external planner application) from the execution of currently active plans. | |
Consequently, BDI agents are able to balance the time spent on deliberating about plans (choosing what to do) and executing those plans (doing it). | |
A third activity, creating the plans in the first place (planning), is not within the scope of the model, and is left to the system designer and programmer. | |
(44) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise | |
Using the FIPA ACL | |
------------------ | |
The syntax is based on s-expressions | |
It's defined using EBNF (SC00070I FIPA ACL Message Representation in String) | |
s-expressions | |
------------- | |
(45) https://en.wikipedia.org/wiki/S-expression | |
(46) http://rosettacode.org/wiki/S-Expressions | |
(47) https://github.com/fwg/s-expression | |
EBNF BNF nearley | |
---------------- | |
(48) https://www.npmjs.com/package/nearley | |
(49) https://medium.com/@gajus/parsing-absolutely-anything-in-javascript-using-earley-algorithm-886edcc31e5e | |
(50) https://nearley.js.org/ | |
Getting started | |
nearley consists of two components: a compiler and a parser. | |
The nearley compiler converts grammar definitions from a simple BNF-based syntax to a small JS module. | |
You can then use that module to construct a nearley parser, which parses input strings. | |
(51) https://github.com/kach/nearley | |
]]></Notes> | |
<_-.XholonClass> | |
<PhysicalSystem/> | |
<Sender/> | |
<Receiver/> | |
<NearleyParser> | |
<FipaAclParser/> | |
</NearleyParser> | |
<!-- for testing FIPA protocols --> | |
<FipaProtocolTest/> | |
<FipaAgent> | |
<Initiator/> | |
<Participant/> | |
</FipaAgent> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
<Sender xhType="XhtypePureActiveObject"> | |
<port name="receiver" connector="../Receiver"/> | |
</Sender> | |
<Initiator xhType="XhtypePureActiveObject"> | |
<port name="participant" connector="../Participant"/> | |
</Initiator> | |
</xholonClassDetails> | |
<PhysicalSystem> | |
<Sender/> | |
<Receiver/> | |
<FipaAclParser/> | |
<FipaProtocolTest roleName="FIPA-Request-Protocol"> | |
<Initiator/> | |
<Participant/> | |
</FipaProtocolTest> | |
</PhysicalSystem> | |
<PhysicalSystembehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
$wnd.xh.FIPA_CA_CONFIRM = 101; | |
$wnd.xh.FIPA_CA_INFORM = 102; | |
$wnd.xh.FIPA_CA_NAMES = { | |
101: "confirm", | |
102: "inform" | |
} | |
$wnd.xh.SIGNAL_FIPA_ACL = -13; // see ISignal.java | |
// test fipa.js | |
var fipa = $wnd.xh.fipa; | |
var agree = Object.create(fipa.Agree); | |
agree.init("atsndr", "atrcvr", "this is some at content.", "atfipa-sl", "atirt", "atsome-fipa-protocol"); | |
console.log(agree.asJso()); | |
console.log(agree.asJson()); | |
console.log(agree.asFipaSL()); | |
//# sourceURL=PhysicalSystembehavior.js | |
]]></PhysicalSystembehavior> | |
<Senderbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
me.println(me.name()); | |
}, | |
act: function() { | |
me.receiver.msg($wnd.xh.FIPA_CA_INFORM, "weather (today, raining)", me); | |
} | |
} | |
//# sourceURL=Senderbehavior.js | |
]]></Senderbehavior> | |
<Receiverbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
me.println(me.name()); | |
}, | |
act: function() { | |
// | |
}, | |
processReceivedMessage: function(msg) { | |
//me.println(JSON.stringify($wnd.xh.FIPA_CA_NAMES)); | |
me.println(me.name() + " received " + msg.signal + '=' + $wnd.xh.FIPA_CA_NAMES[msg.signal] + ' "' + msg.data + '" from ' + msg.sender.name()); | |
} | |
} | |
//# sourceURL=Receiverbehavior.js | |
]]></Receiverbehavior> | |
<FipaAclParserbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, state, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
me.println(me.name()); | |
state = 0; | |
}, | |
act: function() { | |
switch (state) { | |
case 0: | |
var str = `(inform | |
:sender (agent-identifier :name i) | |
:receiver (set (agent-identifier :name j)) | |
:content "weather (today, snowing)" | |
:language Prolog)`; | |
this.parse(str); | |
state = 1; | |
break; | |
case 1: | |
var str = `(cfp | |
:sender (agent-identifier :name j) | |
:receiver (set (agent-identifier :name i)) | |
:content "((action (agent-identifier :name i) (sell plum 50)) (any ?x (and (= (price plum) ?x) (< ?x 10))))" | |
:ontology fruit-market | |
:language fipa-sl)`; | |
this.parse(str); | |
state = 2; | |
break; | |
case 2: // Accept Proposal | |
var str = `(accept-proposal | |
:sender (agent-identifier :name i) | |
:receiver (set (agent-identifier :name j)) | |
:in-reply-to bid089 | |
:content | |
"((action (agent-identifier :name j) | |
(stream-content movie1234 19)) | |
(B (agent-identifier :name j) | |
(ready customer78)))" | |
:language fipa-sl)`; | |
this.parse(str); | |
state = 3; | |
break; | |
case 3: // Agree (request + agree) | |
var str = `(request | |
:sender (agent-identifier :name i) | |
:receiver (set (agent-identifier :name j)) | |
:content | |
"((action (agent-identifier :name j) | |
(deliver box017 (loc 12 19))))" | |
:protocol fipa-request | |
:language fipa-sl | |
:reply-with order567)`; | |
this.parse(str); | |
str = `(agree | |
:sender (agent-identifier :name j) | |
:receiver (set (agent-identifier :name i)) | |
:content | |
"((action (agent-identifier :name j) | |
(deliver box017 (loc 12 19))) | |
(priority order567 low))" | |
:in-reply-to order567 | |
:protocol fipa-request | |
:language fipa-sl)`; | |
this.parse(str); | |
state = 4; | |
break; | |
case 4: // Confirm | |
var str = `(confirm | |
:sender (agent-identifier :name i) | |
:receiver (set (agent-identifier :name j)) | |
:content | |
"weather (today, snowing)" | |
:language Prolog)`; | |
this.parse(str); | |
state = 5; | |
break; | |
case 5: // Disconfirm | |
var str = `(disconfirm | |
:sender (agent-identifier :name i) | |
:receiver (set (agent-identifier :name j)) | |
:content | |
"((mammal shark))" | |
:language fipa-sl)`; | |
this.parse(str); | |
state = 6; | |
break; | |
case 6: // Failure | |
var str = `(failure | |
:sender (agent-identifier :name j) | |
:receiver (set (agent-identifier :name i)) | |
:content | |
"((action (agent-identifier :name j) | |
(open \"foo.txt\")) | |
(error-message \"No such file: foo.txt\"))" | |
:language fipa-sl)`; | |
this.parse(str); | |
state = 7; | |
break; | |
case 7: // Inform If | |
var str = `(request | |
:sender (agent-identifier :name i) | |
:receiver (set (agent-identifier :name j)) | |
:content | |
"((action (agent-identifier :name j) | |
(inform-if | |
:sender (agent-identifier :name j) | |
:receiver (set (agent-identifier :name i)) | |
:content | |
\"in( lannion, normandy)\" | |
:language Prolog)))" | |
:language fipa-sl)`; | |
this.parse(str); | |
str = `(inform | |
:sender (agent-identifier :name j) | |
:receiver (set (agent-identifier :name i)) | |
:content | |
"\+ in (lannion, normandy)" | |
:language Prolog)`; | |
this.parse(str); | |
state = 8; | |
break; | |
case 8: | |
var str = ``; | |
this.parse(str); | |
state = 9; | |
break; | |
case 9: | |
var str = ``; | |
this.parse(str); | |
state = 10; | |
break; | |
default: | |
break; | |
} | |
}, | |
parse: function(fipastr) { | |
const parser = new $wnd.nearley.Parser($wnd.nearley.Grammar.fromCompiled($wnd.grammar)); | |
parser.feed(fipastr); | |
$wnd.console.log(parser.results); | |
me.println($wnd.JSON.stringify(parser.results)); | |
//me.println($wnd.JSON.stringify(parser.results,null,2)); | |
} | |
} | |
//# sourceURL=FipaAclParserbehavior.js | |
]]></FipaAclParserbehavior> | |
<Initiatorbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, fipa, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
me.println(me.name()); | |
fipa = $wnd.xh.fipa; | |
}, | |
act: function() { | |
// Initiator sends a request message (a JSO) | |
var request = Object.create(fipa.Request); | |
request.init(me.name(), me.participant.name(), "this is a request.", "fipa-sl"); | |
console.log(request.asJso()); | |
console.log(request.asJson()); | |
console.log(request.asFipaSL()); | |
me.participant.msg($wnd.xh.SIGNAL_FIPA_ACL, request.asJso(), me); | |
}, | |
processReceivedMessage: function(msg) { | |
me.println(me.name() + " received " + msg.signal + ' "' + JSON.stringify(msg.data) + '" from ' + msg.sender.name()); | |
} | |
} | |
//# sourceURL=Initiatorbehavior.js | |
]]></Initiatorbehavior> | |
<Participantbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
me.println(me.name()); | |
}, | |
act: function() { | |
// | |
}, | |
processReceivedMessage: function(msg) { | |
// in this test, msg.data is a JavaScript Object | |
var fipaMsgType = Object.getOwnPropertyNames(msg.data)[0]; | |
me.println(me.name() + " received " + msg.signal + " " + fipaMsgType + ' "' + JSON.stringify(msg.data) + '" from ' + msg.sender.name()); | |
msg.sender.msg($wnd.xh.SIGNAL_FIPA_ACL, "response refuse TODO", me); | |
} | |
} | |
//# sourceURL=Participantbehavior.js | |
]]></Participantbehavior> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg"> | |
<g> | |
<title>Sender</title> | |
<rect id="PhysicalSystem/Sender" fill="#98FB98" height="50" width="50" x="25" y="0"/> | |
<g> | |
<title>Receiver</title> | |
<rect id="PhysicalSystem/Receiver" fill="#6AB06A" height="50" width="10" x="80" y="0"/> | |
</g> | |
</g> | |
</svg> | |
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient> | |
</XholonWorkbook> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment