matches.mvc 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. include "primitives.alh"
  2. include "modelling.alh"
  3. include "object_operations.alh"
  4. Composite schedule {
  5. {Contains} Failure failure {}
  6. {Contains} Success success {}
  7. {Contains} Query query {
  8. LHS {
  9. Pre_Query/Place {
  10. label = "2"
  11. }
  12. Pre_ReachabilityGraph/Place {
  13. label = "3"
  14. }
  15. constraint = $
  16. Boolean function constraint(host_model : Element, mapping : Element):
  17. Boolean names_match
  18. Boolean tokens_match
  19. names_match = value_eq(read_attribute(host_model, mapping["2"], "name"), read_attribute(host_model, mapping["3"], "name"))
  20. tokens_match = value_eq(read_attribute(host_model, mapping["2"], "tokens"), read_attribute(host_model, mapping["3"], "tokens"))
  21. return bool_and(names_match, tokens_match)!
  22. $
  23. }
  24. }
  25. {Contains} ForAll match {
  26. LHS {
  27. Pre_Query/Place {
  28. label = "2"
  29. }
  30. Pre_ReachabilityGraph/Place pre_3 {
  31. label = "3"
  32. }
  33. Pre_ReachabilityGraph/State pre_4 {
  34. label = "4"
  35. }
  36. Pre_ReachabilityGraph/Contains (pre_4, pre_3) {
  37. label = "5"
  38. }
  39. constraint = $
  40. Boolean function constraint(host_model : Element, mapping : Element):
  41. Boolean names_match
  42. Boolean tokens_match
  43. names_match = value_eq(read_attribute(host_model, mapping["2"], "name"), read_attribute(host_model, mapping["3"], "name"))
  44. tokens_match = value_eq(read_attribute(host_model, mapping["2"], "tokens"), read_attribute(host_model, mapping["3"], "tokens"))
  45. return bool_and(names_match, tokens_match)!
  46. $
  47. }
  48. RHS {
  49. Post_Query/Place {
  50. label = "2"
  51. }
  52. Post_ReachabilityGraph/Place post_3{
  53. label = "3"
  54. }
  55. Post_ReachabilityGraph/State post_4{
  56. label = "4"
  57. value_error = $
  58. Boolean function value (model : Element, name : String, mapping : Element):
  59. return True!
  60. $
  61. }
  62. Post_ReachabilityGraph/Contains (post_4, post_3){
  63. label = "5"
  64. }
  65. }
  66. }
  67. }
  68. Initial (schedule, query) {}
  69. OnSuccess (query, match) {}
  70. OnFailure (query, failure) {}
  71. OnSuccess (match, success) {}
  72. OnFailure (match, failure) {}