230 likes | 439 Views
Semantic Agent Programming Language (S-APL): A Middleware Platform for the Semantic Web. Artem Katasonov and Vagan Terziyan University of Jyväskylä, Finland MSW at ICSC, Santa Clara August 4, 2008. Ontological coordination problem.
E N D
Semantic Agent Programming Language (S-APL):A Middleware Platform for the Semantic Web Artem Katasonov and Vagan Terziyan University of Jyväskylä, Finland MSW at ICSC, Santa Clara August 4, 2008
Ontological coordination problem Two robots meet on Mars. If there is a need for cooperation or at least coordination: • Assume both follow FIPA’s Agent Communication Language (ACL): can exchange messages, understand INFORM, REQUEST, REJECT, etc. • Assume both follow Beliefs-Desires-Intentions (BDI) architecture: share meaning of “I intend”, “My goal is”. • Both designed for Mars – hopefully have similar domain ontology concepts: “surface”, “rock” (labels may be different though). • Assume the US robot has a “jet pack” and thus can “fly”, while the EU robot has no idea about possibility of moving in third dimension. • How the US robot can communicate its movement intentions, so that two can coordinate?
Ontologies that need to be shared To have effective coordination, agents have to share: ExtOnt(A) - properties of the external world MentOnt(A) - internal mental properties of the agent BodyOnt(A) - properties of the agent's (physical) body InOnt(A) - properties of the sensory input - properties of the communication input OutOnt(A) - properties of the action output - properties of the communication output Domain ontology E.g. BDI model Available sensors and actuators Sensing vocabulary E.g. FIPA’s ACL Acting vocabulary E.g. FIPA’s ACL So that ”jet pack” and ”fly” would have accessible and interpretable descriptions Are not treated Impossible to standardize, so should enable ontological modelling
UBIWARE project • UBIWARE (2007 - 2010): Smart Semantic Middleware for Ubiquitous Computing. • Work towards the Semantic Web of Things interconnecting Web Services, humans, and physical entities. • Each resource has a proxy (representative) – a software agent: • To adapt between the data formats and protocols. • To enable new interactions (business processes). • Agents are controlled (programmed) in semantic RDF-based language - S-APL. • A Example: industrial maintenance case
Semantic Agent Programming Language (S-APL) • Motivation: Need to be able to ontologically describe not only the domain, but the agents themselves, to enable interaction without pre-programming each agent about all possible capabilities and behaviors of other agents. • Similar to the challenge of semantic description of Web Services, but going beyond usage interfaces. • Our approach: RDF-based (more precisely, Notation 3) agent programming language. • In a nutshell: • Let’s start treating agents’ programs as data. • If it is data, let’s use the semantic data model (advantages are well-known). • Use Notation 3 (extension of RDF by Tim Berners-Lee) to overcome limitations of basic RDF and make code human-readable/writable.
S-APL • It is a hybrid of semantic reasoners like Berners-Lee’s CWM and agent programming languages (APL) like AgentSpeak, AFAPL. • From APLs point of view: S-APL is a language that provides all the features (and more) as normal APLs, while being RDF based and thus providing advantages of semantic data model and reasoning. • From semantic reasoning point of view: S-APL is CWM extended with common APL features such as: • Beliefs-Desires-Intentions (BDI) architecture, i.e. ability to describe goals and commitments - data items presence of which leads to some executable behavior, and • Ability to link to sensors and actuators implemented in a procedural language, namely Java.
Pool of Atomic Behaviours c S-APL Repository S-APL Agent Architecture Behavior Engine Beliefs storage Data Rules RAB RAB RAB RAB Blackboard RAB: Reusable Atomic Behavior
Levels of semantics in S-APL use • The developers of a specific agent can decide how “semantic” they want it to be: • Semantic Reasoning. S-APL rules operating on N3 semantic data. • Semantic Data. RABs (i.e. Java components) operating on N3 semantic data. • Workflow management. RABs operating on Java blackboard objects, with S-APL used only as workflow management tool, specifying what RABs are engaged and when. • Any combination of above.
Examples of S-APL syntax • Unconditional commitment to an action: {sapl:I sapl:do java:ubiware.shared.MessageSenderBehavior} sapl:configuredAs { p:receiver sapl:is :John. p:content sapl:is {:get :temperatureIn :room1}. sapl:Success sapl:add {:John :informs :temperature} } • Rules: { {?room :hasTemperature ?temp} :measuredBy ?sensor. ?temp > 30 } => {...}
Domain- ontology N3 Data-model- ontology S-APL Data-model- ontology N3 Original Data Data Transformation Script Standard RAB Non-semantic data transformation • First, the original data from the resource is transformed into a Notation 3 representation based on the ontology of the data model of the original data (e.g. “table”-“row”-“column” ontology for tables). This transformation is performed by a Reusable Atomic Behavior (RAB). • Second, the data from the data-model-ontology N3 is transformed into the final domain-ontology N3 using S-APL own means, i.e. rules. • Our platform includes a set of standard RABs such as TextTableReader, SQLReader, XMLReader, XMLWriter, etc.
Data Transformation Semantic Reasoning Ontology XHTML generation Example application architecture RAB: TextTableReader SCADA agent Operator agent SCADA events in CSV Rule: Send every new event to the Operator agent RAB: XMLWriter RAB: HTTPResponseSender
S-APL as communication content language • We use S-APL also as inter-agent communication content language: • One agent sends a query as sapl:I sapl:want { {sapl:You sapl:answer {..query..} }} , the other answers with the matching part of its beliefs. • One agent requests another agent to perform an action plan by sending the plan with sapl:I sapl:want { sapl:You sapl:do {..plan..} } • Such interaction is easily programmed with S-APL itself. Our platform includes a set of “standard” S-APL models: Listener, Believer, Informer and Follower.
Data Transformation XHTML generation Example application architecture 2 User agent DB agent RAB: SQLReader List Informer Data access, processing Oracle Event Log Follower Count RAB: XMLWriter Note: data processing is performed by DB agent, but the code for that is sent to it by User agent RAB: HTTPResponseSender
Policies in S-APL (example) :ActionCommitment sapl:is { {sapl:I sapl:do ?behavior} sapl:configuredAs ?parameters }. :Action rdfs:subClassOf :ActionCommitment; sbac:restriction {sapl:I owl:sameAs ?subject. sapl:I owl:sameAs ?object}. :Print rdfs:subClassOf :Action; sbac:restriction {?behavior = :Print. ?parameters sapl:hasMember {p:print sapl:is ?print}}. :Swear rdfs:subClassOf :Print; sbac:restriction {:BadWord sapl:is ?word. sapl:true = "contains(?print,?word)"}. • Then, can specify a policy as e.g. {fg:Employee :Swear fg:Employee} sapl:is sbac:Prohibition • The platform includes the standard S-APL model SBACReasoner that enforces such access control policies. • Example of use: define an ontology of communicative acts and define a policy so that e.g. a ‘Follower’ agent obeys orders of only a certain class of agents.
Conclusions • It is not only that the Semantic Web needs agents as active software components to interconnect heterogeneous Web resources, but also agents need the Semantic Web technologies to enable open flexible coordination among them. • By no means, we do not claim that our work has solved either of these challenges. • We believe, however, that the S-APL language and other our related solutions provide a proper foundation for building middleware platforms for the Semantic Web.
UBIWARE project • Current project of Industrial Ontologies Group (IOG) lead by Vagan Terziyan (Professor in Distributed Systems at MIT department). • IOG now: Vagan + 2 PhDs + 2 PhD students + 1 MSc student + 1 BSc student. • UBIWARE (2007 - 2010): Smart Semantic Middleware for Ubiquitous Computing. Previous project: SmartResource (2004-2007). • Runs in Agora Center. Funded 80% by Tekes (Finnish National Agency for Technology and Innovation) and 20% by a set of companies: • Metso (paper industry), ABB and Fingrid (power networks), Inno-W (software), Nokia (telecommunications). • In SmartResource participated : TeliaSonera (telecommunications) and Tietoenator (software).
S-APL data model G _C1 accordingTo John _C1 _C2 implies _C3 _C2 _C3 Time is Summer Sun is Shining • RDF compliant. Statements are reified and linked to resources of type ContextContainer through hasMember predicate (and inverse memberOf). • Possibility of efficient object-oriented implementation inside the agent’s behavior engine: • HashMap<String, SemanticStatement> and HashMap<String, ContextContainer> • ContextContainer objects hold links to their member SemanticStatements
S-APL: Rules • Conditional commitment: • {:John :loves ?x} => {...} => is the shorthand for sapl:implies. If the left side of => is truth (beliefs are connected with AND), the right side is copied into G. The commitment is removed after that (as fulfilled). Otherwise, it stays in beliefs and checked again and again until becomes true. • Persistent behavior rule (not removed upon execution) • { {...} => {...} } sapl:is sapl:Rule • Conditional action • {...} -> {...}; sapl:else {} -> is the shorthand for sapl:impliesNow. Such a condition will be checked only once and will be removed even if the condition was false. Adding gb:else block defines what should be added to beliefs if the condition was false.
S-APL: Rules (2) • Exclusive condition: • {:John :Loves ?x . sapl:I sapl:doNotBelieve {?x .. ..} } => {...} If the object of sapl:doNotBelieve matches G, the left side of => is false. If there are several sapl:doNotBelieve, they are connected with OR • Commitment with a guard condition: • { {...} => {...} } sapl:is sapl:true ; sapl:existsWhile {...} If the object of sapl:existsWhile is false, its subject is removed – in this case, the commitment is dropped.
S-APL: Action commitments • Unconditional commitment to an action: • {sapl:I sapl:do java:ubiware.shared.MessageSenderBehavior} sapl:configuredAs {p:receiver sapl:is :John . p:content sapl:is “bla bla” . sapl:Success sapl:add {:John :was :notified} } Special statements to add or remove beliefs: the subject can be sapl:Start, sapl:End, sapl:Success, and sapl:Fail. The predicate is either sapl:add or sapl:remove. • Sequential plan: • {sapl:I sapl:do ...} sapl:configuredAs { ... sapl:Success sapl:add {sapl:I sapl:do ...} }
S-APL: Querying constructs {?man :loves ?girl. ?girl :age ?age} sapl:All ?girl. {?person :age ?age. ?age <= 25} sapl:All ?person. {?person :age ?age. {?person :loves ?x} sapl:issapl:Optional} sapl:All ?person. {{:John :loves ?girl} sapl:or {:Bill :loves ?girl}} sapl:All ?girl. {?person :age ?age} sapl:OrderBy ?age. sapl:OrderByDescending, sapl:Limit and sapl:Offset are also available. As in SPARQL
S-APL: statements and containers • After query ?x :accordingTo :Bill, can do: • { ... {?x sapl:is sapl:true} :accordingTo :John } => {...} • ?x sapl:is sapl:true • sapl:I sapl:add ?x • sapl:I sapl:remove ?x (used as pattern for removal) • sapl:I sapl:erase ?x (removed itself) • ?x sapl:hasMember {:room1 :hasTemperature 25} (new member added) • Can get ID of a statement with (then, can do most of above): • { {* :hasTemperature 25} sapl:ID ?x } :accordingTo :Bill • {?x rdf:predicate :hasTemperature} :accordingTo :Bill • {?x sapl:is sapl:true} :accordingTo :Bill • ?c :accordingTo :Bill. ?c sapl:hasMember ?x • Can do query like: { {?x sapl:is sapl:true} :according to :Bill. {?x sapl:is sapl:true} :accordingTo :John } => {...}