~~SLIDESHOW~~ ~~ODT~~ ====== Visual Business Rules and Process Modeling ====== Krzysztof Kluza , Grzegorz J. Nalepa \\ \\ \\ ===== Outline ===== * Intro * Basics * UML * MOF * OCL * Challenges * Rules in UML * URML * PRR * BPMN & BR * HeKatE * ARD & XTT rep * metamodel * future work ===== Introduction ===== * abstract level of design * visual modeling -> this is not obvious! see [[wp>Literate_programming]] * programming paradigms -> different design paradigms * knowledge vs. software engineering * declarative vs. procedural, etc. ===== UML Trajectory ===== * ++History of UML (1995-2009) | [[http://en.wikipedia.org/wiki/File:OO-historie.jpg | Graph of OO methods and notations history]]++ * **UML predecessors**: [[wp>Object-modeling technique|OMT]] (by Rumbaugh), [[wp>Booch_method|Booch Diagrams]] (by Booch), [[wp>Object-oriented_software_engineering|OOSE]] (by Jacobson) ^ Example of Booch class diagram ^ Example of OMT object diagram ^ | {{:student:msc2009_umlrep:explicite:boochclass.gif|}} | {{:student:msc2009_umlrep:explicite:omt_object_diagram.png?x400|}} | ===== Unified Modeling Language (UML) Today ===== * general-purpose modeling language in the field of software engineering, * 13 types of diagrams, * includes a set of graphical notation techniques to create abstract models of specific systems. {{ :student:msc2009_umlrep:explicite:750px-uml_diagram.svg.png }} ===== The Meta-Object Facility (MOF) ===== * model - representation of something, constructed and used for a particular purpose, * the meaning of the model is related to the situation and context wherein the model is used, * metamodel - a model that represents a modeling language, * MOF * an OMG standard for model-driven engineering, * designed as a four-layered architecture, * UML & OCL are defined in MOF. ===== MOF Layers ===== ^ Layers ^ Content ^ Example ^ | {{http://student.agh.edu.pl/~kkluza/xmi/m3.png?90x|M3}} | metamodeling lang specification | Meta-Object Facility (MOF) | | {{http://student.agh.edu.pl/~kkluza/xmi/m2.png?180x|M2}} | model of metalanguage (language specification) | SQL, UML, XML specifications | | {{http://student.agh.edu.pl/~kkluza/xmi/m1.png?270x|M1}} | metadata, syntax & semantic desc | db schema, class model, DTD (def of XML document) | | {{http://student.agh.edu.pl/~kkluza/xmi/m0.png?350x|M0}} | data | data in DB, objects (instances), XML documents | ===== The Object Constraint Language (OCL) ===== * language * declarative language for describing rules that apply to UML models, * a constraint language (OCL 1.4) * + general object query language (OCL 2.0) * part of OMG UML standard (may be used with any MOF), * makes a Meta-Object Facility model more precise, * example:\\ //The academic grade of a persons supervisor must be greater than the academic grade of the supervised person.// context Person inv: self.supervisor.grade.value > self.grade.value ===== Selected challenges ===== * UML/MOF -> lang + metalang level. universal :?: * if MOF is a universal metalang, what about EBNF * suitability for process modeling * suitability for knowledge modeling with rules ===== Grammars vs MOF ===== * approaches in publications: * grammar visualization (mapping) * metamodel optimalization (semi-automatic) * after auto generation * before auto generation * ++ more: look for our research in wiki | https://ai.ia.agh.edu.pl/wiki/student:msc2009_umlrep:ebnf_mof ++ ===== Grammar2MOF example===== \\ program: (vardefinition | assignment)* vardefinition: type IDENT !SEMICOLON type: (INT | FLOAT) assignment: IDENT !BECOMES expression !SEMICOLON expression: (IDENT | NUMBER) (PLUS expression)? | {{:student:msc2009_umlrep:explicite:generatedmof4grammar.jpg?450x|}} | {{:student:msc2009_umlrep:explicite:high_quality_mof4grammar.jpg?450x|}} | ===== a UML-Based Rule Modeling Language (URML) ===== * developed by the REWERSE Working Group I1, * allows visual rule modeling based on UML class models, * supports the modeling of ++derivation rules|conditions->conclusions++, ++production rules|conditions->action++ and ++reaction rules|condition|event->action|postcondition++, * [[http://rewerse.net/I1/oxygen.informatik.tu-cottbus.de/rewerse-i1/@q=node_2f10.htm|Strelka]] – a tool for making graphical URML models. {{ :student:msc2009_umlrep:explicite:framgent_metamodelu_urlml.gif?x610 | }} ===== URML examples (DR) ===== //A bachelor is a male that is not a husband.// {{ :student:msc2009_umlrep:explicite:dr3_is_bachelor_0.png | }} ===== URML examples (PR) ===== //If the reservation date of a rental is 5 days before the start date of a rental, then grant the rental a discount of 10.// {{ :student:msc2009_umlrep:explicite:pr1_discount_rental.png |}} ===== URML summary ===== * http://rewerse.net/I1/oxygen.informatik.tu-cottbus.de/rewerse-i1/@q=urml.htm * extends UML class diagrams, * single rules, * non-standard -> tool support ( //Strelka// - plugin for Fujaba), * rules serialized to R2ML, * in the future translations: R2ML <-> OCL and R2ML<->OWL/SWRL ===== The Production Rule Representation (PRR) [specification Beta 1] ===== A //production rule// is a statement of programming logic that specifies the execution of one or more actions in the case that its conditions are satisfied. * PRR should improve the modeling of production rules, especially with respect to UML, * PRR should allow interoperability across different vendors providing production rule implementations. The production rule is typically represented as: if [condition-list] then [action-list] ===== Example of PRR from specification Beta 1: ===== * **English text:** //If there is no CD item in the customer shopping cart then add a hyperlink to the CD page in the customer web page.// * **Proprietary rule language:** rule noCDItem { when { ?customer1: Customer(); ?shoppingCart1: ShoppingCart(customer == ?customer1); not Item(type == ItemType.CD ; shoppingCart == ?shoppingCart1); } then { modify ?customer1{ hyperlinkToCD = true; } } } * **PRR OCL:** Rule noCDItem ruleVariable: ?customer: Customer = Customer->any() ?sCart: ShoppingCart = ShoppingCart->any(c:customer|c=?customer) ?cdItems: Set = ?sCart.items->select(e:items|e.type=ItemType.CD) Condition: ?cdItems.isEmpty() Action: ?customer.hyperlinkToCD = true ===== PRR Summary ===== * no common agreement about the syntax of PRR, * different syntaxes, but common metamodel => translation between different syntaxes, * no defined PRR syntax => can be URML. {{ :student:msc2009_umlrep:explicite:prrmetamodel.jpg?x600 |}} ===== The Business Process Modeling Notation (BPMN) ===== * a graphical notation for specifying business processes in a Business Process Diagram (BPD), * is intuitive to business users and able to represent complex process semantics, * provides a mapping between the graphics of the notation to the underlying constructs of execution languages, particularly Business Process Execution Language. {{:student:msc2009_umlrep:explicite:bpmncoreelements.gif?800x|}} ===== Example of elements ===== \\ | {{:student:msc2009_umlrep:explicite:bpmnzdarzenia.gif?400x|}} | | {{:student:msc2009_umlrep:explicite:bpmnbramki.gif?400x|}} | ===== Example of usage BPMN ===== {{ :student:msc2009_umlrep:explicite:bpmn_example.png |}} ===== BMPN summary ===== * notation dedicated for business org (semantic for business org), * only one diagram BPD, but many artifacts -> allows specify even complex processes, * formal notation -> simulation, optimalization & error detection, * automatic generation of ++BPEL4WS|(Business Process Execution Language for Web Services)++ code, * lack of security support for data structure, users hierarchy and access to data. ===== Business rules ===== * describe the operations, definitions and constraints that apply to an organization in achieving its goals, * four categories of BR according to Business Rules Group: * definitions of business terms, * facts relating terms to each other, * constraints, * derivations. ===== BR Example ===== ++Example of detailed business rule|from http://www.agilemodeling.com/artifacts/businessRule.htm ++ The description defines the rule exactly (text, flow charts, UML activity diagrams, OCL, ILOG rules language, BRML...). {{ :student:msc2009_umlrep:explicite:brdetaild.jpg | }} ===== BR representation ===== * UML model {{ :student:msc2009_umlrep:explicite:br_uml_simple.png |}} * OCL – a formal language used to describe expressions on models eg. constraint: //The lower bound must be a non-negative integer literal.// lowerBound()->notEmpty() implies lowerBound() >= 0 * many dedicated approaches like presented URML, PRR... ===== UServ ===== UServ Financial Services case study: * a benchmark case study from the Business Rules Forum, * provides a full service portfolio of financial products of Insurance Company, * contains many business rules and Business Process Models, * more: [[hekatedev:hekate_case_userv]]. ===== UServ BR in URML ===== Example for Eligibility Business Rules / Automobile Eligibility / Potential Theft Category eg.\\ *//If all of the following are true, then the car's potential theft rating is moderate:// * //car's price is between $20,000 and $45,000,// * //car model is not on the list of "High Theft Probability Auto".// {{ :student:msc2009_umlrep:explicite:ae_ptc04.png |}} ===== UServ Business Rules ===== {{ :student:msc2009_umlrep:explicite:userv1.jpg |}} ===== UServ Business Process Model ===== {{ :student:msc2009_umlrep:explicite:userv2.jpg |}} ===== HeKatE ===== {{ :student:msc2009_umlrep:explicite:hekateprocess.png |}} ===== Our goals/tasks ===== * ARD & XTT representation in UML, * ARD & XTT rules on UML diagrams presentation, * integration of software & knowledge engineering methods. ===== ARD ===== Proposed model of ARD is based on component diagrams. ARD contains diferent kind of UML dependencies such as: * <> specifies a derivation relationship among model elements, where one of them can be computed from the another, * <> specifies a refinement relationship among model elements at different levels of development; refinement can be used to model transformation from one to another phase of a sequential model development, * <> specifies a trace relationship among model elements represents the same concept in different models; it is mainly used for tracking changes across models. ===== ARD example (1) ===== Example of ARD diagram:\\ UML model of that ARD diagram:\\ {{:pl:miw:miw08_umlandardxtt:umlandard:approach3_ard_8.png|:pl:miw:miw08_umlandardxtt:umlandard:approach3_ard_8.png}} ===== ARD example (2) ===== Exemplary fragment of TPH diagram showing <> dependecy in model:\\ {{:pl:miw:miw08_umlandardxtt:umlandard:trace_example.png|<> dependecy in model of TPH}} ===== TPH ===== \\ ^ TPH diagram ^ UML model of TPH diagram^ |{{:student:msc2009_umlrep:explicite:tph.png?301x601|}} | {{:pl:miw:miw08_umlandardxtt:umlandard:approach3_tph_8.png?418x601|:pl:miw:miw08_umlandardxtt:umlandard:approach3_tph_8.png}} | ===== XTT ===== Proposed model of XTT is based on activity diagrams, which are related to flow diagrams and can illustrate the activities taking place in the system. * Outline of XTT2UML translation algorithm (on the example of thermostat). * ++ UML2XTT translation is more complex.| see: [[student:msc2009_umlrep:xmi2xtt_spec|UML2XTT translation specification]] ++ * ++ Proposed model and algorithm is developed also for more complex cases. | see: [[student:msc2009_umlrep:xtt_metamodel#model|Model of table with many outputs]] ++ ===== Algorithm step 1 ===== All input attributes become input parameters and output attribute becomes output parameter of an activity\\ (for the sake of transparency the diagram can be divided into partitions with a swimlane). |{{:student:msc2009_umlrep:explicite:xtt_step1.jpg|}}|{{ :pl:miw:miw08_umlandardxtt:algorithm_step1.png |:pl:miw:miw08_umlandardxtt:algorithm_step1.png}}| ===== Algorithm step 2 ===== For each attribute (activity parameter), if there is more than one unique value in the XTT add a decision node\\ and for every unique value of attribute needs to be added: * the control flow with guard condition (with that unique value), * if the value occurs frequently, the flow is finished with a fork node with number of outputs equal to the number of times the value appears in XTT table. |{{:student:msc2009_umlrep:explicite:xtt_step2.jpg|}}|{{ :pl:miw:miw08_umlandardxtt:algorithm_step2.png |:pl:miw:miw08_umlandardxtt:algorithm_step2.png}}| ===== Algorithm step 3 ===== For each rule (a row in XTT) draw a join node with the number of inputs equal to the number of input parameters and one output. For each join node: * inputs are connected using an adequate flow (in accordance with the values of attributes in the rule), * outputs are connected (using a flow) with the action having a value corresponding to the output attribute in the rule: * directly, if the value of attribute occurred in XTT only once, * otherwise through a merge node. |{{:student:msc2009_umlrep:explicite:xtt_step3.jpg|}}|{{ :pl:miw:miw08_umlandardxtt:algorithm_step3.png |:pl:miw:miw08_umlandardxtt:algorithm_step3.png}}| ===== Algorithm step 4 ===== Outputs of all actions are merged in a merge node and a flow is lead to output parameter of activity. |{{:student:msc2009_umlrep:explicite:xtt_step4.jpg|}}|{{ :pl:miw:miw08_umlandardxtt:algorithm_step4.png |:pl:miw:miw08_umlandardxtt:algorithm_step4.png}}| ===== XTT th table representation example ===== \\ ^ Activity diagram for XTT th table:^^ |{{:pl:miw:miw08_umlandardxtt:xtt_th.png|:pl:miw:miw08_umlandardxtt:xtt_th.png}}|{{:pl:miw:miw08_umlandardxtt:th_3.png?600|:pl:miw:miw08_umlandardxtt:th_3.png}}| ===== Thermostat Case ===== Activity diagram for the whole XTT of thermostat: \\ {{:pl:miw:miw08_umlandardxtt:uml_activity_xtt_3.png?800|:pl:miw:miw08_umlandardxtt:uml_activity_xtt_3.png}} ===== Evaluation ===== Proposed representation: * shows both structure of dependecies in ARD and process of rules processing in XTT, * doesn't extend UML diagrams (like URML), * allows serialization to XMI. ===== Future work ===== * metamodel, * XSTL translators, * tools for verifing models with metamodel, * work in progress... ===== Thank you ===== \\ \\ \\ \\ Questions...