Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Programming the Interaction Space Effectively with ReSpecTX

192 Aufrufe

Veröffentlicht am

Talk delivered at the 11th International Symposium on Intelligent Distributed Computing in
Belgrade, Serbia, 12/10/2017.

Abstract: The lack of a suitable toolchain for programming the inter- action space with coordination languages hinders their adoption in the industry, and limits their application as core calculus, proof-of-concept frameworks, or rapid prototyping / simulation environments. In this paper we present the ReSpecTX language and toolchain as a first step toward closing the gap, by equipping a core coordination language (ReSpecT) with tools and features commonly found in mainstream programming languages, improving likelihood of adoption in real-world scenarios.

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

Programming the Interaction Space Effectively with ReSpecTX

  1. 1. Programming the Interaction Space Effectively with ReSpecTX Giovanni Ciatto Stefano Mariani† Andrea Omicini stefano.mariani@unimore.it† , {andrea.omicini, giovanni.ciatto}@unibo.it Department of Science and Methods of Engineering, Universit`a di Modena e Reggio Emilia † Department of Computer Science and Engineering, Universit`a di Bologna School of Electrical Engineering Belgrade, October 12th 2017 Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 1 / 30
  2. 2. Outline 1 Premises 2 Background 3 ReSpecTX: eXtended ReSpecT Modularity, Composability Toolchain 4 Conclusion & Ongoing Work Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 2 / 30
  3. 3. Premises Outline 1 Premises 2 Background 3 ReSpecTX: eXtended ReSpecT Modularity, Composability Toolchain 4 Conclusion & Ongoing Work Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 3 / 30
  4. 4. Premises Context Both industry and academia developing methods to govern the interaction space [Wegner, 1997] communication protocols in industry MQTT vs. CoAP → IoT landscape FIPA1 protocols → multi-agent systems (MAS) REST vs. SOAP → micro-services coordination models and languages in academia [Omicini and Viroli, 2011] control driven → Reo [Arbab, 2004] data driven → Linda [Gelernter, 1985] hybrid → ReSpecT [Omicini, 2007] 1 http://www.fipa.org/ Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 4 / 30
  5. 5. Premises Motivation Coordination languages mostly are core calculus proof-of-concept frameworks domain-specific languages for rapid prototyping / simulation ⇒ no toolchain, basically no Integrated Development Environment (IDE) no debugging no static-checking no code-completion Agent-oriented Programming (AOP) frameworks, instead, are more mature Jade has many administration, monitoring, and debugging tools [Bellifemine et al., 2007] Jason has an IDE and a monitoring / debugging tool [Bordini et al., 2007] Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 5 / 30
  6. 6. Premises Goal Close the gap between maturity of AOP languages and coordination frameworks Focus on supporting development process We present the ReSpecTX language and toolchain ReSpecTX builds upon ReSpecT [Omicini, 2007] + modularity + Eclipse IDE plugin static-checking auto-completion code generation + imperative-style syntactic sugar Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 6 / 30
  7. 7. Background Outline 1 Premises 2 Background 3 ReSpecTX: eXtended ReSpecT Modularity, Composability Toolchain 4 Conclusion Ongoing Work Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 7 / 30
  8. 8. Background The TuCSoN Coordination Infrastructure TuCSoN [Omicini and Zambonelli, 1999] is a model and infrastructure providing coordination as a service [Viroli and Omicini, 2006] to a MAS in the spirit of the archetypal Linda model Tuples are stored in tuple centres [Omicini and Denti, 2001] ⇒ tuple spaces enhanced with a program specifying how the tuple space must react to coordination-related events Tuple centres’ programs are expressed in the ReSpecT language [Omicini, 2007] TuCSoN is fully integrated with Jade and Jason [Mariani and Omicini, 2016] TuCSoN comes equipped with a few tools for monitoring, debugging, manual testing, and inspection of the interaction space Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 8 / 30
  9. 9. Background The ReSpecT Coordination Language I ReSpecT [Omicini, 2007] is a Prolog-based language for programming tuple centres A ReSpecT program is a set of specification tuples (or, reactions) first-order logic tuples of the form reaction( E , G , R ) E = triggering event = coordination primitive G = (set of) guard predicate(s) = conditions on tuple centre state or triggering event R = reaction body = Prolog computations + ReSpecT primitives Each reaction is executed sequentially one at a time, no overlapping atomically either succeed or fail as a whole transactionally a failed reaction causes no effects at all (rollback) Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 9 / 30
  10. 10. Background The ReSpecT Coordination Language II Example: infinite tuples r e a c t i o n ( in ( i n f (T) ) , invocation , ( no ( i n f (T) ) , out ( i n f (T) ) ) ) . in(inf(T)) = triggering event invocation = guard (true before the operation is served) ( no(inf(T)), out(inf(T)) ) = reaction body Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 10 / 30
  11. 11. ReSpecTX: eXtended ReSpecT Outline 1 Premises 2 Background 3 ReSpecTX: eXtended ReSpecT Modularity, Composability Toolchain 4 Conclusion Ongoing Work Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 11 / 30
  12. 12. ReSpecTX: eXtended ReSpecT Highlights modularity ReSpecTX programs can be split in modules imported in a root specification file ⇒ code reuse ⇒ code libraries toolchain Eclipse IDE plugin syntax highlighting static error checking code auto-completion code generation (plain ReSpecT is the “bytecode”) syntax ReSpecTX adds convenient syntactic sugar to ReSpecT special guard predicates testing presence/absence of tuples without side effects imperative style syntax Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 12 / 30
  13. 13. ReSpecTX: eXtended ReSpecT Modularity, Composability Outline 1 Premises 2 Background 3 ReSpecTX: eXtended ReSpecT Modularity, Composability Toolchain 4 Conclusion Ongoing Work Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 13 / 30
  14. 14. ReSpecTX: eXtended ReSpecT Modularity, Composability Modularity ⇒ Re-usability, and Composability A module definition contains an arbitrary number of: include QualifiedName , which imports reactions defined in the referenced module Prolog facts and rules ReSpecTX reactions A specification does the same, but is also translated by the ReSpecTX compiler in a plain ReSpecT program (directly executable by TuCSoN) Reactions can be decorated with a @ ReactionName tag ⇒ referenceable by meta-coordination primitives (primitives with a ReSpecTX specification tuple as argument) Tagged reactions can be further decorated with keyword virtual ⇒ inactive until the meta-coordination primitive activates them Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 14 / 30
  15. 15. ReSpecTX: eXtended ReSpecT Modularity, Composability Example: Scheduling Periodic Activities I The module outputs the A tuple once every P milliseconds ⇒ the activity represented by a reaction with out(A) as triggering event gets executed periodically the module can be imported and reused at will tagged, virtual reaction exploited Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 15 / 30
  16. 16. ReSpecTX: eXtended ReSpecT Modularity, Composability Example: Scheduling Periodic Activities II 1 module rsp . timing . P e r i o d i c { 2 r e a c t i o n out s t a r t P (P, A) : completion { 3 c u r r e n t t i m e (Now) 4 out context (P, 0 , Now, A) , 5 out t i c k (A) 6 } 7 r e a c t i o n out t i c k ( A c t i v i t y ) : endo , ? context (P, , , A) { 8 c u r r e n t t i m e (Now) , 9 NextTick i s Now + P, 10 o u t s @ n e x t t i c k ( NextTick , A) 11 } 12 @ n e x t t i c k (T, A) 13 v i r t u a l r e a c t i o n time (T) : ?? context ( , Tick , , A) , ?? t i c k (A) { 14 NextTick i s Tick + 1 , 15 c u r r e n t t i m e (Now) , 16 out context (P, NextTick , Now, A) , 17 out A, 18 out t i c k (A) 19 } 20 } Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 16 / 30
  17. 17. ReSpecTX: eXtended ReSpecT Modularity, Composability Example: Change Tuple Centre Nature I The module forces the tuple centre to behave like a set, instead of a multi-set, for tuples matching the set(Tuple) template set(Tuple) tuples are stored as set(Tuple, M) where M is their multiplicity Whenever a tuple set(Tuple) is emitted (consumed) the corresponding M is automatically increased (decreased) Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 17 / 30
  18. 18. ReSpecTX: eXtended ReSpecT Modularity, Composability Example: Change Tuple Centre Nature II 1 module rsp . lang . SetBehaviour { 2 put one ( Tuple ) :− 3 i f nop s e t ( Tuple , ) then out s e t ( Tuple , 1) 4 e l s e i f inp s e t ( Tuple , M) then ( 5 NextM i s M + 1 , 6 out s e t ( Tuple , NextM) , 7 i f (NextM 1) then inp s e t ( Tuple ) 8 ) e l s e f a i l . 9 r e a c t i o n out s e t ( Tuple ) : completion , exo { put one ( Tuple ) } 10 remove one ( Tuple ) :− 11 i f inp s e t ( Tuple , M) then ( 12 i f (M 0) then ( 13 NextM i s M − 1 , 14 out s e t ( Tuple , NextM) , 15 i n a l l s e t ( Tuple ) r e t u r n s , 16 i f (NextM 0) then out s e t ( Tuple ) 17 ) 18 ) . 19 r e a c t i o n inp s e t ( Tuple ) : completion , exo { remove one ( Tuple ) } 20 } Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 18 / 30
  19. 19. ReSpecTX: eXtended ReSpecT Modularity, Composability Example: Do Both :) I The module implements the “decay” mechanism often found in nature-inspired coordination models [Omicini and Viroli, 2011] by reusing and composing the previous modules startP(P, decay(TT)) tuple triggers periodic emission tuple decay(TT) then, reaction @decay starts triggering in loop, creating the decay effect Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 19 / 30
  20. 20. ReSpecTX: eXtended ReSpecT Modularity, Composability Example: Do Both :) II 1 module rsp . lang . Decay { 2 i n c l u d e rsp . lang . Concentration 3 i n c l u d e rsp . timing . P e r i o d i c 4 5 decay one ( Something ) :− 6 i f ( Something = s e t ( Tuple ) ) then ( 7 remove one ( Tuple ) 8 ) e l s e ( 9 inp Something 10 ) . 11 @decay 12 r e a c t i o n out decay ( Something ) { 13 inp decay ( Something ) , 14 decay one ( Something ) 15 } 16 17 % Remember that s t a r t P (P, decay (TT) ) t u p l e 18 % t r i g g e r s p e r i o d i c e m i s s i o n of decay (TT) 19 } Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 20 / 30
  21. 21. ReSpecTX: eXtended ReSpecT Modularity, Composability Example: Do Both :) III ReSpecTX standard librarya provides other modules to build increasingly complex coordination patterns, such as gossiping in a mobile network, stigmergic coordination, and others [Fernandez-Marquez et al., 2012] a http://bitbucket.org/gciatto/respectx-standard-library Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 21 / 30
  22. 22. ReSpecTX: eXtended ReSpecT Toolchain Outline 1 Premises 2 Background 3 ReSpecTX: eXtended ReSpecT Modularity, Composability Toolchain 4 Conclusion Ongoing Work Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 22 / 30
  23. 23. ReSpecTX: eXtended ReSpecT Toolchain Toolchain: Static-checking, Code Completion, Code Generation I Eclipse IDE plugin2 implemented in the Xtext framework3 (as ReSpecTX itself) Handy features common in mainstream programming languages syntax coloring code completion automatic generation of ReSpecT code static-checking Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 23 / 30
  24. 24. ReSpecTX: eXtended ReSpecT Toolchain Toolchain: Static-checking, Code Completion, Code Generation II The static checker detects duplicate reactions in a module (recursively), i.e. reactions having same E and G inconsistent temporal constraints bad-written URLs or TCP port numbers (i.e. reserved ones); singleton variables, that is, variables appearing only once in a reaction contradictory ReSpecT guards invocation, completion endo, exo intra, inter success, failure from agent, from tc to agent, to agent ?X, !Y if X = Y, ground(X) before(T1), after(T2) if T1 = T2 2 Already publicly available as open source code at http://bitbucket.org/gciatto/respectx 3 http://eclipse.org/Xtext/ Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 24 / 30
  25. 25. Conclusion Ongoing Work Outline 1 Premises 2 Background 3 ReSpecTX: eXtended ReSpecT Modularity, Composability Toolchain 4 Conclusion Ongoing Work Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 25 / 30
  26. 26. Conclusion Ongoing Work Conclusion Ongoing Work ReSpecTX is a first step in closing the gap between coordination languages and mainstream programming languages modularity static error checking automatic code generation Next steps to further improve ReSpecTX maturity include development of a rich standard library of ready-to-use composable coordination mechanisms distribution of ReSpecTX as ready-to-install Eclipse IDE plugin improve static checker Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 26 / 30
  27. 27. Outline 1 Premises 2 Background 3 ReSpecTX: eXtended ReSpecT Modularity, Composability Toolchain 4 Conclusion Ongoing Work Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 27 / 30
  28. 28. References References I Arbab, F. (2004). Reo: A channel-based coordination model for component composition. Bellifemine, F. L., Caire, G., and Greenwood, D. (2007). Developing Multi-Agent Systems with JADE. Wiley. Bordini, R. H., H¨ubner, J. F., and Wooldridge, M. J. (2007). Programming Multi-Agent Systems in AgentSpeak using Jason. John Wiley Sons, Ltd. Fernandez-Marquez, J., Marzo Serugendo, G., Montagna, S., Viroli, M., and Arcos, J. (2012). Description and composition of bio-inspired design patterns: a complete overview. Gelernter, D. (1985). Generative communication in Linda. Mariani, S. and Omicini, A. (2016). Multi-paradigm coordination for MAS: Integrating heterogeneous coordination approaches in MAS technologies. CEUR Workshop Proceedings, 1664:91–99. Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 28 / 30
  29. 29. References References II Omicini, A. (2007). Formal ReSpecT in the AA perspective. Omicini, A. and Denti, E. (2001). From tuple spaces to tuple centres. Omicini, A. and Viroli, M. (2011). Coordination models and languages: From parallel computing to self-organisation. Omicini, A. and Zambonelli, F. (1999). Coordination for Internet application development. Viroli, M. and Omicini, A. (2006). Coordination as a service. Fundamenta Informaticae, 73(4):507–534. Special Issue: Best papers of FOCLASA 2002. Wegner, P. (1997). Why interaction is more powerful than algorithms. Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 29 / 30
  30. 30. Programming the Interaction Space Effectively with ReSpecTX Giovanni Ciatto Stefano Mariani† Andrea Omicini stefano.mariani@unimore.it† , {andrea.omicini, giovanni.ciatto}@unibo.it Department of Science and Methods of Engineering, Universit`a di Modena e Reggio Emilia † Department of Computer Science and Engineering, Universit`a di Bologna School of Electrical Engineering Belgrade, October 12th 2017 Mariani et. al. (DISMI, DISI) ReSpecTX Belgrade, 12/10/2017 30 / 30

×