Korolev et al. Smart Space Applications Integration: A Mediation Formalism an...
Verifying Resource Requirements for Ontology-Driven Rule-Based Agents
1. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
Verifying Resource Requirements for
Ontology-Driven Rule-Based Agents
Abdur Rakib, Rokan Uddin Faruqui, and Wendy MacCaull
StFX Centre for Logic and Information
St. Francis Xavier University
Antigonish, NS, Canada
{arkib,mfaruqui,wmaccaul}@stfx.ca
March 6, 2012
1
2. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
Building Decision-Support Through Dynamic Workflow
Systems, Academia and Industry Working Together for Better
Healthcare
2
3. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
O UTLINE
Introduction
Distributed Rule-Based Agents
Ontological Representation of Distributed Agents
Rule-Based systems from OWL 2 RL + SWRL ontologies
Proposed verification framework for Distributed Rule-Based
Systems
Experiments using the Tovrba tool
Conclusion
3
4. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
I NTRODUCTION
The combination of rules and ontologies provides a new
paradigm for design, development, and analysis of
sophisticated distributed rules-based agents
While rule-based computing provides great benefits in
developing many complex software applications, they also
present new challenges to application developers:
how to ensure the correctness of rule-based designs
termination
response time
These problems become even more challenging in the case
of distributed rule-based systems, where several
communicating rule-based agents exchange information
via messages
4
5. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
I NTRODUCTION CONTD ..
We present a framework for verifying systems of
ontology-driven rule-based agents
We consider the distributed problem-solving strategy in
systems of communicating rule-based agents, and ask
how much time (measured as the number of rule firings)
how many message exchanges it takes the system to find a
solution
We use standard model checking techniques to verify
interesting properties of such systems
We show how the Maude LTL model checker can be used
to verify properties including response-time guarantees of
the form:
if the system receives a query, then a response will be
produced within n timesteps.
5
6. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
D ISTRIBUTED R ULE -B ASED A GENTS
Multiple-agents combine their knowledge and
computational resources to solve problems
No single agent can solve the problem on its own
because no single agent has all the information necessary to
solve the problem
to solve problems more effectively, e.g., in less time than a
single agent
By sharing information agents can solve the problem more
effectively
6
7. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
A SIMPLE DISTRIBUTED SYSTEM
Time: how many inference steps does the system need to
perform, in parallel?
Communication: how many messages do the agents need
to exchange?
7
8. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
A SIMPLE DISTRIBUTED SYSTEM CONTD .
Agent 1 KB1 = {A, B} Agent 2 KB2 = {D}
# Step Config 1 Action 1 Config 2 Action 2
0 {A, B} - {D} -
1 {A, B, C} RuleC {D, Ask(2, 1, C)} RuleAsk
2 {A, B, C, Ask(2, 1, C)} Copy {D, Ask(2, 1, C)} Idle
3 {A, B, C, Ask(2, 1, C), RuleTell {D, Ask(2, 1, C)} Idle
T ell(1, 2, C)}
4 {A, B, C, Ask(2, 1, C), Idle {D, Ask(2, 1, C), Copy
T ell(1, 2, C)} T ell(1, 2, C)}
5 {A, B, C, Ask(2, 1, C), Idle {D, Ask(2, 1, C), RuleTrust
T ell(1, 2, C)} T ell(1, 2, C), C}
6 {A, B, C, Ask(2, 1, C), Idle {D, Ask(2, 1, C), RuleE
T ell(1, 2, C)} T ell(1, 2, C), C, E}
Table: The table shows that from the initial configuration agents can
derive E in 6 time steps exchanging two messages
8
9. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
S YSTEMS OF COMMUNICATING RULE - BASED AGENTS
Let the system consists of n agents, A = {1, 2, ..., n}
Each agent has a program, consisting of first order Horn
clause rules, and a working memory, which contains facts
If an agent i has a rule A1 ∧ A2 ∧ . . . ∧ Ak → B1
the facts A1 ∧ A2 ∧ . . . ∧ Ak are in the agent’s working
memory and B1 is not in the agent’s working memory in
state s
the agent can fire the rule which adds B1 to the agent’s
working memory in the successor state s
In addition to firing rules, agents can exchange messages
regarding their facts
9
10. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
D ERIVATION OF A GOAL
The initial configuration of the system contains the
working memory facts
Producing the next configuration by one of the following
operations:
Rule: applies a rule of the form A1 ∧ A2 ∧ . . . ∧ Ak → B1
Communication : agents can exchange messages regarding
their facts using their Ask and Tell
Idle: which leaves its configuration unchanged
The goal formula G is derived if it occurs in the
configuration of one of the agents
A problem is considered to be solved if one of the agents
has derived the goal
10
11. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
M EASURING RESOURCES
We take the time complexity of a derivation to be the total
number of inference steps by the system
Our model of communication complexity is based on the
number of facts exchanged by the agents
The communication complexity of a joint derivation is then
the (total) number of message exchanges in the derivation
11
12. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
S YSTEM PROPERTIES OF INTEREST
Temporal epistemic properties
there is a possibility that eventually Agent i will derive
formula G in nT time steps while exchanging fewer than
nC messages
always Agent i fails to derive formula G in nT time steps
while exchanging fewer than nC messages
always every request of Agent i will be responded to Agent
j in nT time steps
12
13. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
R EPRESENTATON OF D ISTRIBUTED R ULE -B ASED A GENTS
An ontology is an explicit formal specification of a
conceptualization
A model of a domain
introduces vocabulary relevant to the domain
specifies semantics of terms
The Web Ontology Language OWL
W 3C Recommendations
based on Description Logic (SHOIN -OWL 1 and SROIQ
- OWL 2)
13
14. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
T HE S EMANTIC W EB R ULE (SWRL)
Both the description logic based OWL 1 and OWL 2 are
decidable fragments of first order logic
However, the expressive power of OWL 1 is strictly limited
to certain tree structure-like axioms
For instance, a simple rule
hasF ather(?x, ?y) ∧ hasBrother(?y, ?z) → hasU ncle(?x, ?z)
can not be modelled using OWL 1 axioms.
Although OWL 2 can express this uncle rule indirectly,
many rules are still not possible to model using OWL 2
axioms
14
15. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
W HY DO WE NEED BOTH OF THEM ?
DL-Safe rules can remove such restrictions while being
decidable; however, they are restricted to universal
quantification and lack negation in their basic form
A combination of OWL 2 with rules offers a more
expressive formalism for building Semantic Web
applications.
We use SWRL that extends OWL DL by adding new
axioms, namely Horn clause rules.
We combine a set of SWRL rules with the set of OWL 2
axioms and facts to build our ontology.
15
16. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
O NTOLOGICAL R EPRESENTATON OF D ISTRIBUTED R ULE -B ASED A GENTS
⇓
16
17. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
O NTOLOGICAL R EPRESENTATON OF D ISTRIBUTED R ULE -B ASED A GENTS
⇓
Tbox
SubClassOf (Doctor CareGiver )
InverseObjectProperties(isFeeling isFeltBy)
Abox
ClassAssertion(Patient Mary)
ObjectPropertyAssertion(isFeeling Mary MucositisPainTwo)
SWRL
Patient(?p) ∧ isFeeling(?p, ?x ) ∧ Pain(?x ) ∧ hasPainLevel (?x , “2 ”)
→ hasPaintIntensity(?p, MildPainIn)
17
18. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
R ULE -B ASED SYSTEMS FROM OWL 2 RL + SWRL ONTOLOGIES
OWL 2 RL is based on Description Logic Program (DLP),
the set of axioms and facts of an OWL 2 RL ontology can
be translated to Horn clause rules.
We use the DLP framework, a mapping between DL based
ontology and datalog programs, to translate an ontology to
a set of Horn clause rules.
OWL 2 RL, one of the profiles of OWL 2, is suitable for
scalable implementation of rule-base systems
The syntax of OWL 2 RL is asymmetric. These restrictions
facilitate the translation of OWL 2 RL axioms into Horn
clause rules based on the DLP framework.
The translation of SWRL rules is straightforward because
they are already in the Horn clause rule format.
18
19. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
T RANSLATION OF OWL 2 RL AXIOMS INTO H ORN C LAUSE R ULES
OWL 2 Axioms and Facts DL Syntax Horn clause rule
ClassAssertions a:C C(a)
PropertyAssertion a, b : P P (a, b)
SubClassOf C D C(x) → D(x)
EquivalentClasses C≡D C(x) → D(x),D(x) ← C(x)
EquivalentProperties P ≡Q Q(x, y) → P (x, y)
P (x, y) → Q(x, y)
ObjectInverseOf P ≡ Q− P (x, y) → Q(y, x)
Q(y, x) → P (x, y)
TransitiveObjectProperty P+ P P (x, y) ∧ P (y, z) → P (x, z)
SymmetricObjectProperty P ≡ P− P (x, y) → P (y, x)
Object/DataUnionOf C1 C2 D C1 (x) → D(x), C2 (x) → D(x)
Object/DataIntersectionOf C D1 D2 C(x) → D1 (x),C(x) → D2 (x)
Object/DataSomeValuesFrom ∃P.C D P (x, y) ∧ C(y) → D(x)
Object/DataAllValuesFrom C ∀P.D C(x) ∧ P (x, y) → D(y)
Object/DataPropertyDomain ∀P − .C P (y, x) → C(y)
Object/DataPropertyRange ∀P.C P (x, y) → C(y)
19
20. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
B UILDING R ULE -B ASED A GENTS
An agent in the system is either concrete or abstract
Each concrete agent has a program, consisting of
Horn clause rules - derived from OWL 2 RL + SWRL
ontologies,
a working memory -contains facts (ground atomic
formulae) representing the initial state of the system
The behavior of each abstract agent is represented in terms
of a set of LTL formulae
20
21. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
C ONCRETE AGENTS
Reasoning Strategies: to impose restrictions on possible actions
21
22. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
C ONCRETE AGENTS CONTD ..
Rules of a concrete agent follow the following BNF:
Rule ::= ’<’ Priority ’:’ Atoms ’→’ Atom ’>’
Atoms ::= Atom {∧ Atom}∗
Atom ::= standardAtom | commmunicationAtom
standardAtom ::= description’(’i-object ’)’
| individualvaluedProperty’(’i-object ’,’ i-object ’)’
| datavaluedProperty’(’i-object ’,’ d-object ’)’
| sameIndividuals’(’i-object ’,’ i-object ’)’
| differentIndividuals’(’i-object ’,’ i-object ’)’
| dataRange’(’ d-object ’)’
| builtIn’(’ builtinId ’,’ {d-object}∗ ’)’
communicationAtom ::= ’Ask(’ i ’,’ j ’,’ standardAtom ’)’
| ’Tell(’ i ’,’ j ’,’ standardAtom ’)’
Priority ::= N≥0
N≥0 ::= 0 | 1 | 2 | ...
i ::= 1 | 2 | ... | nAg
j ::= 1 | 2 | ... | nAg
builtinID ::= URIreference
i-object ::= i-variable | individualID
d-object ::= d-variable | dataLiteral
i-variable ::= ’I-variable(’URIreference’)’
d-variable ::= ’D-variable(’URIreference’)’
22
23. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
C ONCRETE AGENTS CONTD ..
To allow the implementation of reasoning strategies, each
atom is associated with a time stamp which records the
cycle at which the atom was added to working memory
Rule priorities and fact time stamps can be used to
determine which rule instance(s) are selected from the
conflict set for execution
For example, a rule instance with the highest priority may
be selected, or a rule instance may be selected whose
antecedent atoms are associated with highest time stamp
etc.
The internal configurations of the rules follow the syntax
given below:
n : [ t1 : P1 ] ∧ [ t2 : P2 ] ∧ . . . ∧ [ tn : Pn ] → [ t : P ]
23
24. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
A SK -T ELL C OMMUNICATION
Communication between agents: Ask and T ell
A = {1, 2, . . . , n}, we assume special communication
primitives in the language
Ask(i, j, P ): i asks j whether P is the case is referred to as
an Ask
T ell(i, j, P ): i tells j that P is referred to as a Tell
24
25. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
A SK -T ELL C OMMUNICATION
The position in which formulae Ask and Tell may appear in a
rule depends on which agent’s program the rule belongs to
Agent i may have an Ask or a Tell in the consequent of a
rule, e.g.,
P1 ∧ P2 ∧ . . . ∧ Pn → Ask(i, j, P )
Agent j may have the same expressions in the antecedent
of the rule, e.g.,
Ask(i, j, P ) ∧ P → T ell(j, i, P )
T ell(i, j, P ) → P
25
26. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
A BSTRACT AGENTS
Abstract agents are modelled using LTL formulae
ρ ::= X ≤n ϕ1 | G(ϕ2 → X ≤n ϕ3 )
ϕ1 ::= Bi Ask (i, j , P ) | Bi Tell (i, j , P ) | Bi Ask (j , i, P ) | Bi Tell (j , i, P ) | Bi P
ϕ2 ::= Bi Ask (j , i, P ) | Bi Tell (j , i, P )
ϕ3 ::= Bi Tell (i, j , P ) | Bi Tell (i, k , P ) | Bi Ask (i, j , P ) | Bi Ask (i, k , P )
X ≤n ϕ1 - describe agents which produce a certain message or
input to the system within n time steps
ϕ1 of the form Bi Ask (i, j, P ) or Bi Tell (i, j, P ) - when the beliefs
appear (as an Ask or a Tell ) in the abstract agent i’s working
memory, they are also copied to agent j’s working memory at
the next step.
Bi P - represents a belief involving an atom P (other than
Ask and Tell ) may also appear in the abstract agent i’s working
memory within n time steps
G(ϕ2 → X ≤n ϕ3 ) - describe agents which are always
guaranteed to reply to a request for information within n time
26 steps.
27. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
T HE M AUDE LTL M ODEL C HECKER
We use the Maude model checker - developed at SRI in
Menlo Park California.
The specification language of the Maude LTL Model
checker based on rewriting logic
Maude modules: basic units of specification and
programming
are essentially collections of sorts and a set of operations on
these sorts
Functional modules - contains only equations
System modules - contains both equations and rewriting
rules
27
28. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
S YSTEM ENCODING STRUCTURE IN M AUDE
Functional Modules - agent’s working memory,
knowledge base, configuration (local state) of the agents,
control strategies
The system module - implements global configuration of
the system
28
29. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
F UNCTIONAL MODULE CONTD ..
1 fmod ACM is
2 protecting NAT .
3 protecting BOOL .
4 protecting QID .
5 sorts Constant Atom sAtom cAtom Term Rule Agenda WM .
6 sorts TimeA TimeWM RepT RepTime Config .
7 subsort Atom < WM .
8 subsorts aAtom cAtom < Atom .
9 subsort Rule < Agenda .
10 subsort Qid < Constant .
11 subsort TimeA < TimeWM .
12 subsorts Constant < Term .
13 subsort RepT < RepTime .
14 ops void rule : -> Atom .
15 ops com exec : -> Phase [ctor] .
16 op nil : -> Term[ctor] .
17 op [_ : _] : Nat Atom -> TimeA .
18 op _ _ : WM WM -> WM [comm assoc] .
19 op _ _ : TimeWM TimeWM -> TimeWM [comm assoc] .
20 op _ _ : Agenda Agenda -> Agenda [comm assoc] .
21 op <_ : _->_> : Nat TimeWM TimeA -> Rule .
22 op _ _ : RepTime RepTime -> RepTime [comm assoc] .
23 op Ask : Nat Nat sAtom -> cAtom .
24 op Tell : Nat Nat sAtom -> cAtom .
25 endfm
29
30. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
I MPLEMENTATION OF AGENTS
Each agent (concrete/abstract)
imports the Maude ACM module
contains local configuration - a working memory, an
agenda, time step, message counter
Multi-agent systems (MAS)
are constructed using a system module,
contain global configuration of the system
The inference engine and communication mechanism
are implemented in the MAS system module using Maude
rules
30
31. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
T HE T OVRBA TOOL ARCHITECTURE
Modeling problems using Develop Ontologies
Ontology plus Rules Read/Write/Edit
(OWL 2 RL + SWRL)
OWL 2 RL + SWRL
Pellet ontology reasoner
Ontology plus Rules in
OWL/XML syntax plugged in
Verified design
Translator Encoding generator
Generating Maude encoding The Maude
and
LTL model checker
Plain text syntax rules which allowing property specification
are used in system design to be verified
31
32. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
E XPERIMENTS USING THE T OVRBA TOOL
Pain Ontology - Terminology and Concepts from SNOMED, ICNP,
Cancer Care NS and Local health authority
32
33. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
E XPERIMENTS USING THE T OVRBA TOOL CONTD ..
We model a multi-agent rule-based system using
TOVRBA based on the pain monitoring ontology.
33
34. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
E XPERIMENTS USING THE T OVRBA TOOL CONTD ..
The system consists of one concrete agent and five abstract
agents:
concrete agent - planner (p)
abstract agents - assessor (a), reassessor (r),
sideeffectmanager (s), caregiver (c), and emergency(e).
These abstract agents interact with the concrete agent and
they communicate via message passing.
34
35. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
E XPERIMENTS USING THE T OVRBA TOOL
An example temporal formula for an assessor agent a :
X ≤5 Ba Tell (a, p, isFeeling( Mary, MucositisPainOne))
An example rule for the planner agent p:
< 2 : Patient(?p) ∧ isFeeling(?p, ?x ) ∧ Pain(?x )∧
hasPainLevel (?x , 2 ) → hasPaintIntensity(?p, MildPainIn) >
35
36. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
E XPERIMENTS USING THE T OVRBA TOOL CONTD ..
Following system properties are verified, using the Maude
LTL model checker
1. G( Bp Tell (a, p, isFeeling( Mary, MucositisPainOne))
→ X n Bp hasPaintIntensity( Mary, BackgroundDiscomfortIn) )
whenever agent a tells agent p that Mary is feeling
MucositisPainOne, agent p classifies Mary’s pain intensity
as Background Discomfort within n time steps
2. G( Bp hasCarer ( Mary, John) ∧ Bp hasPainCrisis( Mary)∧
Bp Tell (c, p, hasAcknowledgement( John, Busy))
→ X n Bp Tell (p, e, hasPainCrisis( Mary)) )
whenever a pain crisis occurs with a patient and agent p has
received negative acknowledgment from agent c, agent p contacts
the emergency agent e within n time steps.
36
37. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
E XPERIMENTS USING THE T OVRBA TOOL CONTD ..
For a particular experimental set up, these properties are
verified as true when the value of n is 2 in the first
property, and 3 in the second property
However, when we assign a value to n which is less than 2
in the first property, and less than 3 in the second property,
the properties are verified as false and the model checker
returns counterexamples
37
38. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
C ONCLUSION
We described an automated verification framework for
communicating ontology-driven resource-bounded
rule-based agents
A set of agents specified in terms of facts and Horn clause
rules and automatically produces a Maude specification of
the system which can be efficiently verified
The System is described in terms of concrete and abstract
specifications
The properties that we verify are response-time guarantees
of the form: if the system receives a query, then a response
will be produced within n time steps.
38
40. Introduction Distributed Rule-Based Agents Ontological Representation of Distributed Agents Rule-Based systems from OWL
T HE SCALABILITY PROBLEM IN MAS VERIFICATION
Usually intelligent agents can perform many
non-deterministic actions while moving from one state to
another
A common way to define a global state of a multi-agent
system is using a (parallel) composition of the local states
of all agents in the system
It is assumed that in every (global) state the agents
perform simultaneous actions, where some agents may
perform idle actions
In a multi-agent system composed of n(≥ 1) agents, if
each agent i can perform at most m(≥ 1)
non-deterministic actions, then the system as a whole can
move in mn different ways from a given state at a given
point in time
40