Title: Semantic Agent Programming Language (S-APL): A Middleware Platform for the Semantic Web
1Semantic 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
2Ontological coordination problem
- Two robots meet on Mars. If there is a need for
cooperation or at least coordination - Assume both follow FIPAs 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?
3Ontologies 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. FIPAs ACL
- Acting vocabulary
- E.g. FIPAs ACL
So that jet pack and fly would have
accessible and interpretable descriptions
Are not treated
Impossible to standardize, so should enable
ontological modelling
4UBIWARE 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.
Example industrial maintenance case
5Semantic 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
- Lets start treating agents programs as data.
- If it is data, lets 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.
6S-APL
- It is a hybrid of semantic reasoners like
Berners-Lees 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.
7S-APL Agent Architecture
Behavior Engine
Beliefs storage
Data
Rules
RAB
RAB
RAB
RAB
Blackboard
RAB Reusable Atomic Behavior
8Levels 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.
9Examples of S-APL syntax
- Unconditional commitment to an action
- saplI sapldo javaubiware.shared.MessageSenderB
ehavior - saplconfiguredAs
- preceiver saplis John.
- pcontent saplis get temperatureIn
room1. - saplSuccess sapladd John informs
temperature -
- Rules
- ?room hasTemperature ?temp measuredBy
?sensor. - ?temp gt 30
- gt ...
10Non-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.
11Example 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
12S-APL as communication content language
- We use S-APL also as inter-agent communication
content language - One agent sends a query as
- saplI saplwant saplYou saplanswer
..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 - saplI saplwant saplYou sapldo ..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.
13Example application architecture 2
Note data processing is performed by DB agent,
but the code for that is sent to it by User agent
14Policies in S-APL (example)
- ActionCommitment saplis
- saplI sapldo ?behavior saplconfiguredAs
?parameters - .
- Action rdfssubClassOf ActionCommitment
- sbacrestriction saplI owlsameAs ?subject.
saplI owlsameAs ?object. - Print rdfssubClassOf Action
- sbacrestriction ?behavior Print.
- ?parameters saplhasMember pprint
saplis ?print. - Swear rdfssubClassOf Print
- sbacrestriction BadWord saplis ?word.
sapltrue "contains(?print,?word)". - Then, can specify a policy as e.g.
- fgEmployee Swear fgEmployee saplis
sbacProhibition - 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.
15Conclusions
- 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.
16Backup slides
17UBIWARE 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).
18S-APL data model
- 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 agents behavior
engine - HashMapltString, SemanticStatementgt and
HashMapltString, ContextContainergt - ContextContainer objects hold links to their
member SemanticStatements
19S-APL Rules
- Conditional commitment
- John loves ?x gt ...
- gt is the shorthand for saplimplies. If the left
side of gt 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) - ... gt ... saplis saplRule
- Conditional action
- ... -gt ... saplelse
- -gt is the shorthand for saplimpliesNow. Such a
condition will be checked only once and will be
removed even if the condition was false. Adding
gbelse block defines what should be added to
beliefs if the condition was false.
20S-APL Rules (2)
- Exclusive condition
- John Loves ?x .
- saplI sapldoNotBelieve ?x .. ..
- gt ...
- If the object of sapldoNotBelieve matches G, the
left side of gt is false. If there are several
sapldoNotBelieve, they are connected with OR - Commitment with a guard condition
- ... gt ... saplis sapltrue
- saplexistsWhile ...
- If the object of saplexistsWhile is false, its
subject is removed in this case, the commitment
is dropped.
21S-APL Action commitments
- Unconditional commitment to an action
- saplI sapldo javaubiware.shared.MessageSe
nderBehavior - saplconfiguredAs
- preceiver saplis John .
- pcontent saplis bla bla .
- saplSuccess sapladd John was
notified -
- Special statements to add or remove beliefs the
subject can be saplStart, saplEnd,
saplSuccess, and saplFail. The predicate is
either sapladd or saplremove. - Sequential plan
- saplI sapldo ... saplconfiguredAs
- ... saplSuccess sapladd saplI sapldo
...
22S-APL Querying constructs
- ?man loves ?girl. ?girl age ?age saplAll
?girl. - ?person age ?age. ?age lt 25 saplAll
?person. - ?person age ?age. ?person loves ?x saplis
saplOptional saplAll ?person. - John loves ?girl saplor Bill loves
?girl saplAll ?girl. - ?person age ?age saplOrderBy ?age.
- saplOrderByDescending, saplLimit and
saplOffset are also available. As in SPARQL
23S-APL statements and containers
- After query ?x accordingTo Bill, can do
- ... ?x saplis sapltrue accordingTo John
gt ... - ?x saplis sapltrue
- saplI sapladd ?x
- saplI saplremove ?x (used as pattern for
removal) - saplI saplerase ?x (removed itself)
- ?x saplhasMember room1 hasTemperature 25
(new member added) - Can get ID of a statement with (then, can do most
of above) - hasTemperature 25 saplID ?x
accordingTo Bill - ?x rdfpredicate hasTemperature accordingTo
Bill - ?x saplis sapltrue accordingTo Bill
- ?c accordingTo Bill. ?c saplhasMember ?x
- Can do query like ?x saplis sapltrue
according to Bill. ?x saplis sapltrue
accordingTo John gt ...