正在加载图片...
第2期 蒋艳荣,等:一种基于知识树和约束的柔性活动动态细化方法 .163. 中A为活动集,TC为时序约束集。算法首先检查时 序约束tc涉及的活动是否存在于活动集A中,如果 if op;is NotLimit (a,b) 不存在,则返回alse.时序约束规则te可以分解出 if there is no path from a to b or from b to a 由时序约束组成的操作集R即at,然后对其中每个约 mark the error place; 束进行检查,对不满足约束的情况进行出错报告,并 return false; 返回false. 算法2 TemporalCons() //end of the deal for each op; activity set A,activity temporal constraints TC. //end if 输出retumn true if valid,false if not valid //end of the deal of each tc; { return true; for each temporal constraint tc,in TC 4 实现及实例分析 decompose tc;into Lpart and Rpart; if activities referred by Lpart are all in set A 为了验证所提方法的有效性,我们在一台高性 for each op;in Rpart 能PC机上实现以上算法.开发的硬件环境:Intel if op;is "Previous(a,b)" E5200CPU,2GDDR,250GHD,开发平台:JDK1.7 if there is no path from a to b +MyEclipse2014,工作流引擎采用Activiti5.18.0,数 mark the error place; 据库采用MySQL5.1.37。采用Hibernate实现领域 return false; 知识树的知识查询与管理。 下面我们以图1所示的知识树为例,来验证本 文所提方法的有效性和正确性。某软件开发过程的 ifop:is“ImtPrevious(a,b)”{ 主流程如图3所示,其中的“需求分析”和“测试”为 if there is not any edge (a,b)then 未定义的柔性活动,用Activiti的call activity类型的 mark the error place; 活动来表示。当工作流执行到活动“项目人员确 return false; 定”时,由于后续的柔性活动“需求分析”未定义,因 此柔性活动细化算法FlexActRefining()被激活。该 算法首先在领域知识树中进行查找,通过对活动目 if op;is AndSyn (a,b)" 标的匹配,找到对应的知识点“需求分析”,获取其3 if there exists a common predecessor A. 个满足泛化关系的子知识点,即“面向对象需求分 and successor A.for a and b then 析”、“结构化需求分析”和“模块化需求分析”,并生 if satisfy Previous(A.,a)and 成一个OR结构。根据上下文及约束条件,“面向对 Previous(A,,b)and Previous(a,A.) 象需求分析”分支被选择执行。因此,其对应的流 and Previous(b,A.)and there exist no 程模板被实例化后通过Activiti工作流引擎部署到 path from a to b or b to a then 其流程定义数据表和部署表中,并开始执行该流程。 return true; 当工作流执行完之后,返回主流程执行剩下的活动。 } 项目人 员确定 分村 设 return false; 图3软件开发过程的主流程 ifop,is“0rSym(a,b)”{ Fig.3 Main flowchart of a software development process if there exists a common predecessor A. 同样的,在工作流执行到“编码”活动时,算法 and successor A for a and b then FlexActRefining()被激活以细化后续的柔性活动 if satisfy either (Previous(A.,a)and “测试”。查询知识树可得知,其存在对应的流程测 Previous(a,A.))or (Previous(A.,b) 试模板,并根据“测试”活动的3个满足包含关系的 and Previous(b,A.))and a and b 子知识“单元测试”、“综合测试”和“系统测试”,细 can not run at the same time then 化生成流程模板中的“各类型测试”活动。依据其 return true; 约束关系,采用顺序结构生成其时序关系,得到子流 程:“单元测试”→“综合测试”→“系统测试”,并部 署到工作流引擎进行执行。整个过程可以用图4表 return false;中 A 为活动集,TC 为时序约束集。 算法首先检查时 序约束 tc 涉及的活动是否存在于活动集 A 中,如果 不存在,则返回 false. 时序约束规则 tc 可以分解出 由时序约束组成的操作集 Rpart,然后对其中每个约 束进行检查,对不满足约束的情况进行出错报告,并 返回 false. 算法 2 TemporalCons( ) 输入 activity set A, activity temporal constraints TC. 输出 return true if valid, false if not valid { for each temporal constraint tci in TC { decompose tci into Lpart and Rpart; if activities referred by Lpart are all in set A{ for each opi in Rpart{ if opi is “Previous(a, b)”{ if there is no path from a to b{ mark the error place; return false; } } if opi is “ImtPrevious (a, b)”{ if there is not any edge 〈a, b〉 then{ mark the error place; return false; } } if opi is “AndSyn (a, b)”{ if there exists a common predecessor As and successor Ae for a and b then{ if satisfy Previous(As, a) and Previous(As, b) and Previous(a, Ae) and Previous(b, Ae) and there exist no path from a to b or b to a then{ return true; } } return false; } if opi is “OrSyn (a, b)”{ if there exists a common predecessor As and successor Ae for a and b then{ if satisfy either (Previous(As, a) and Previous(a, Ae)) or (Previous(As, b) and Previous(b, Ae)) and a and b can not run at the same time then{ return true; } } return false; } if opi is NotLimit (a, b){ if there is no path from a to b or from b to a{ mark the error place; return false; } } / / end of the deal for each opi } / / end if } / / end of the deal of each tci return true; 4 实现及实例分析 为了验证所提方法的有效性,我们在一台高性 能 PC 机上实现以上算法. 开发的硬件环境: Intel E5200 CPU, 2G DDR, 250G HD,开发平台:JDK1.7 +MyEclipse2014, 工作流引擎采用 Activiti 5.18.0,数 据库采用 MySQL 5.1.37。 采用 Hibernate 实现领域 知识树的知识查询与管理。 下面我们以图 1 所示的知识树为例,来验证本 文所提方法的有效性和正确性。 某软件开发过程的 主流程如图 3 所示,其中的“需求分析”和“测试”为 未定义的柔性活动,用 Activiti 的 call activity 类型的 活动来表示。 当工作流执行到活动“项目人员确 定”时,由于后续的柔性活动“需求分析”未定义,因 此柔性活动细化算法 FlexActRefining( )被激活。 该 算法首先在领域知识树中进行查找,通过对活动目 标的匹配,找到对应的知识点“需求分析”,获取其 3 个满足泛化关系的子知识点,即“面向对象需求分 析”、“结构化需求分析”和“模块化需求分析”,并生 成一个 OR 结构。 根据上下文及约束条件,“面向对 象需求分析” 分支被选择执行。 因此,其对应的流 程模板被实例化后通过 Activiti 工作流引擎部署到 其流程定义数据表和部署表中,并开始执行该流程。 当工作流执行完之后,返回主流程执行剩下的活动。 图 3 软件开发过程的主流程 Fig.3 Main flowchart of a software development process 同样的,在工作流执行到“编码” 活动时,算法 FlexActRefining( ) 被激活以细化后续的柔性活动 “测试”。 查询知识树可得知,其存在对应的流程测 试模板,并根据“测试”活动的 3 个满足包含关系的 子知识“单元测试”、“综合测试”和“系统测试”,细 化生成流程模板中的“各类型测试” 活动。 依据其 约束关系,采用顺序结构生成其时序关系,得到子流 程: “单元测试”➝“综合测试”➝“系统测试”,并部 署到工作流引擎进行执行。 整个过程可以用图 4 表 第 2 期 蒋艳荣,等:一种基于知识树和约束的柔性活动动态细化方法 ·163·
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有