From 59234a836d81a75d196caa0bc0f368f248525194 Mon Sep 17 00:00:00 2001
From: Keane Reynolds <keane.reynolds@gmail.com>
Date: Fri, 18 Jun 2021 14:24:36 +0000
Subject: [PATCH] Uploaded example 40 from the manual

---
 ...titioningLargeSchemaIntoSeparateSchemas.mp | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Example40_ApplicationProcess_partitioningLargeSchemaIntoSeparateSchemas.mp

diff --git a/Example40_ApplicationProcess_partitioningLargeSchemaIntoSeparateSchemas.mp b/Example40_ApplicationProcess_partitioningLargeSchemaIntoSeparateSchemas.mp
new file mode 100644
index 0000000..38c2edc
--- /dev/null
+++ b/Example40_ApplicationProcess_partitioningLargeSchemaIntoSeparateSchemas.mp
@@ -0,0 +1,57 @@
+/* Example40_ApplicationProcess_partitioningLargeSchemaIntoSeparateSchemas.mp
+
+	An applicant submits application and needs to get it approved by
+the bureaucratic chain of two officials. If the first official approves,
+he forwards the application to the second official. Application is
+approved only after it receives both approvals. Each official can
+approve/reject the application or request it reworked and resubmitted.
+Rework and resubmit events may be repeated several times.  Each rejection
+is final and cannot be followed by rework and resubmit events.
+
+*/
+SCHEMA Application_approval_process
+
+ROOT Applicant:
+	prepare_application
+	submit_application
+	(* rework
+	submit_application *)
+	( application_is_approved |
+	application_is_rejected );
+
+ROOT Official_1:
+	(+ receives_application_from_Applicant
+	(approves_and_forwards_to_Official_2 |
+	request_rework |
+	reject ) +)
+BUILD{ ENSURE #reject <= 1;
+
+ENSURE FOREACH $r: reject #$$EVENT AFTER $r == 0; };
+COORDINATE $s: submit_application FROM Applicant,
+$r: receives_application_from_Applicant FROM Official_1
+DO ADD $s PRECEDES $r; OD;
+
+ROOT Official_2:
+	(* receives_application_from_Official_1
+	(approves_and_forwards_to_Applicant |
+	request_rework | reject ) *)
+BUILD{ ENSURE #reject <= 1;	
+ENSURE FOREACH $r: reject #$$EVENT AFTER $r == 0; };
+
+COORDINATE $s: approves_and_forwards_to_Official_2 FROM Official_1,
+$r: receives_application_from_Official_1 FROM
+Official_2
+DO ADD $s PRECEDES $r; OD;
+
+/*--- interactions with Applicant ---------*/
+COORDINATE $r: reject, /* this may come from several actors */
+$rr: application_is_rejected FROM Applicant
+DO ADD $r PRECEDES $rr; OD;
+
+COORDINATE $r: request_rework, /* this may come from several actors */
+$rr: rework FROM Applicant
+DO ADD $r PRECEDES $rr; OD;
+
+COORDINATE $a: approves_and_forwards_to_Applicant FROM Official_2,
+$aa: application_is_approved FROM Applicant
+DO ADD $a PRECEDES $aa; OD;
\ No newline at end of file
-- 
GitLab