• 沒有找到結果。

Anomaly detection with the algorithms in above two subsections

Chapter 4 Anomaly Detection in a TS Workflow

4.2 Incremental anomaly detection

4.2.3 Anomaly detection with the algorithms in above two subsections

Consider the edit activities in a well-formed workflow editing environment, there are at least 5 types of editing activities, besides moving the cursor,

1. Add/delete a flow structure of AND/XOR/LOOP,

2. Transfer a flow structure intro another structure, for example, transfer an AND structure into an XOR structure,

3. Add/delete a branch

4. Modify the content of an activity process, and

5. Move one process (a simple activity process or a process which can be decomposed into a workflow diagram) from one location to another.

An incremental analysis is done right after each edit activity. To simplify the analysis work, we can redefine these works type by type as follows:

1. As type one, “add” can be treated as adding an empty structure of AND/XOR/LOOP, but “delete” can be treated as deleting a workflow structure directly, i.e., deleting a process which can be decomposed into a workflow of one of AND/XOR/LOOP structure.

2. A transfer can be done 1) between AND and XOR, 2) between LOOP and XOR.

3. An activity process can be deemed as containing a sequence of activities, where each artifact is given one of the following actions: Define, Reference, Kill

4. When completing a move activity, it can be treated as 2 steps: a) delete a process at one location and b) add this process into another location., and inserting/deleting a branch.

Because a process of some structure can be treated as a complex process to be decomposed recursively, types 1 and 4 and merged together. Inserting/Deleting a branch can be treated as the activities: a sequence of process insertions/deletions and

then handling an empty branch. Therefore, an incremental analysis can be done right after

1. Adding/Deleting a complicated process, 2. Adding/Deleting an empty branch,

3. Adding/Deleting an simple activity process, and

4. Transferring an AND/LOOP to an XOR Structure and vice versa.

In our model, each TS workflow being edited can be transformed into a CTS workflow used for analysis. In the thesis, we are studying the anomaly analysis after each of the following activities on a CTS workflow to simply the analysis work further:

1. Adding an empty AND/XOR/activity process, 2. Deleting an activity AND/XOR/activity process, 3. Modifying the activity(ies) in an activity process and

4. Inserting/Deleting an empty branch without changing the structure.

Before the discussion of calculations with above algorithms, during incremental analysis, each node in a CTW workflow is defined to be associated with the information described in Section 4.2.1 to maintain the information to reduce the computation. In other word, each node contains level, working duration, EAI, process type, ImmeSucap, ImmePreap and AOSetp.

For case 1, there is no analysis only, because no activity change occurs. After an edit for a simple process at case 2 and 3, Algorithms 4.2 and 4.3 can be applied to find the immediate previous/next activities for the artifact whose activities are inserted, deleted or modified (after being deleted and then inserted). Therefore, the operation anomalies for the artifact can be detected/corrected. For case 4, i.e., after an

insertion/deletion of a branch occurs, Algorithm 4.4 is applied to find all the artifacts which have an activity before the branch. An empty branch added/deleted in a AND structure do not affect the information and thus anomalies. Thus, there is no analysis.

However, for the insertion/deletion of an empty branch in an XOR structure, it is introduced/deleted a valid path which contains this branch. An anomaly detection can be done for each artifact which has an immediate predecessor of the split node of this branch. The corresponding computation are described in Algorithms 4.8 and 4.9, by applying Algorithms 4.2, 4.3, 4.4, and 4.7.

Algorithm 4.7 detects anomalies between two set of processes. Algorithm 4.7 accepts (a, Pre, Suc), where a is an artifact, and for each process p in Pre, each process q in Suc, there exist a path from p to q. Finally Algorithm 4.7 output anomalies.

Algorithm 4.7 ComputeAnomaliesPreSuc

Input: an artifact a, a set of processes Pre, a set of processes Suc.

Output: anomalies between Pre and Suc.

target processes can be compared, and output no anomalies. Lines 3-8 is a switch structure, we make pair (x, y), where x Pre, y Suc at line 3. Algorithm 4.7 detects anomalies according to cases(lines 4-8). For case 1 at line 4, a has Def in x, if a has Def/Kill in y, Useless Definition anomaly occurs. For case 2 at line 6, a has Kill in x, if a has Kill in y, Null Kill occurs; if a has Use in y, Undefined Usage occurs.

Here we do not discuss the case, a has Use in x, because it do not generate artifact anomalies when Use is executed before Def/Kill is executed.

Algorithm 4.8 computes the anomalies when inserting a blank branch into a XOR/AND block. Algorithm 4.8 accepts (w, a, p, p’), where w is a workflow, a is an artifact, p/ p’ is a split process/joint process of a control block which will be inserted a blank branch.

Algorithm 4.8 ComputeBranchInsertionAnomalies Input: a TS workflow w, split node p, joint node p’

Output: anomalies Begin

01. NonEmptyArtifact = Algorithm4.4(w, p, p’);

02. If p is an XOR split process{

03. For each artifact a in NonEmptyArtifact {

04. ImmeSucap = Algoirthm 4.2(w, a, p, p’) ImmeSucap;

10. Inserting empty branch into the block between p and p’;

End

In Algorithm 4.8, line 1 computes the set of artifacts which have no blank branch between p and p’. After inserting a blank branch, these artifact might generate new

anomalies, these artifacts are putted into NonEmptyArtifact(line 1) by output of Algorithm 4.4. Only XOR structure should be analyzed because XOR structure might select blank branch in run time. Thus, we only analyze XOR structure at line 2. Line 3 analyzes all artifacts in NonEmptyArtifact. Line 4 updates ImmeSucap. Line 5 updates ImmePreap. Finally, lines 6-7 compute the artifact anomalies. Line 6 computes the artifact anomalies between ImmePreap and ImmeSucap. Line 7 computes the artifact anomalies between ImmePreapand ImmeSucap. After Algorithm 4.8 completes analysis, line 10 inserting a blank branch into the block between p and p’.

As in Figure 4.3, there exists a path from P1 to end process, it might cause Useless Definition after inserting a blank branch to the block between as2 and aj2.

Figure 4.3 The TS workflow in Figure 4.1 is inserted a blank branch between as2 and aj2

Algorithm 4.9 computes the anomalies when deleting a blank branch from a XOR/AND block. Algorithm 4.9 accepts (w, a, p, p’), where w is a workflow, a is an artifact, p/ p’ is a split process/joint process of a control block which will be removed a blank branch.

Algorithm 4.9 ComputeBranchDeletionAnomalies Input: a TS workflow w, split node p, joint node p’

Output: anomalies Begin

01. EmptyArtifact = {a | a is an artifact in w} \ Algorithm4.4(w, p, p’);

02. If p is an XOR split process{

03. Deleting empty branch from the block between p and p’;

04. For each artifact a in EmptyArtifact { between p and p’. After removing a blank branch, these artifact might generate new anomalies, these artifacts are putted into EmptyArtifact(line 1) by output of Algorithm 4.4. Only XOR structure should be analyzed because XOR structure might select blank branch in run time. Thus, we only analyze XOR structure at line 2. Line 3 removes a blank branch from the block between p and p’. Line 4 analyzes all artifacts in EmptyArtifact. At line 5, if the block has no blank branch for artifac a after

For instance, the TS workflow in Figure 4.1 is deleted a operation at P3 as shown in Figure 4.4. In Figure 4.4, it might cause Useless Definition because there exists a path from P1 to end process.

Figure 4.4 The TS workflow in Figure 4.1 deletes a operation at P3

相關文件