“…This is done until the last triple in RepSpec is reached (else branch of if statement in step 4), then the procedure unfoldNode is called (step 6) to continue the unfolding on the child node in the STP tree. Finally, unfoldRep adds to the STP (steps 7-12) the constraints corresponding to the semantic assumptions of the construct: -the repetitions must be included in a time procedure classConsistency(T : CKB) (1) initialize S to an empty STP (2) unfoldNode(root(T), S) (3) S' := FloydWarshall(S) (4) return S' procedure unfoldNode(X : STPNode, S : STP) (1) add to S the placeholder class C X (2) forall C A | C A is not a repeated class in X do (3) add to S the class C A od (4) forall C R | C R is a repeated class in X do (5) let RepSpec = (R 1 , …, R n ) be the repetition specification of class C R (6) C sub := unfoldRep(X, C R , RepSpec) (7) add to S the constraints that C sub ⊆ C X od (8) for each monadic constraint in X do (9) add the constraint to the corresponding classes in S (10)for each binary constraint in X do (11) add the constraint to the corresponding classes in S return C X procedure unfoldRep(X : STPNode, S : STP, C : Class, RepSpec = < R 1 , R 2 ,…, R n >) (1) add to S the placeholder class C 1 (2) let R 1 = <nRep 1 , IT 1 , constrs 1 > (3) for r := 1 to nRep 1 do (4) if R 1 is not the last one in RepSpec then (5) C sub,r := unfoldRep(X, C, (R 2 , …, R n )) else (6) C sub,r := unfoldNode(child(C, X)) od (7) add to S the constraint that duration of C 1 is IT 1 (8) add to S the constraints that C sub,i ⊆ C 1 , i = 1, …, nRep 1 (9) add to S the constraints that C sub,i+1 is after C sub,i , i = 1, …, nRep 1 -1 (10)add to S the possible constraint fromStart in constrs 1 in R 1 between C 1 and C sub,1 (11)add to S the possible constraint toEnd in constrs 1 in R 1 between C sub,nRep1 and C 1 (12)add to S the constraints inBetween and inBetweenAll in constrs 1 in R 1 between C sub,i and C sub,i+1 , i = 1, …, nRep 1 -1 return C 1 -each repetition must be included in the I-Time (step 8); -the repetitions must not overlap (step 9); -the repetitions must follow the possible pattern in repConstraints (steps 10-12). It is possible to test the consistency of the resulting STP S (step 3 of procedure classConsistency) by propagating the constraints using the Floyd-Warshall's all-pairs shortest path algorithm.…”