Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Guvnor presentation jervis liu


Published on

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Guvnor presentation jervis liu

  1. 1. GuvnorJervis Liu
  2. 2. What is Guvnor?● Business Knowledge Management System● Application to manage business knowledge ○ Business Rules (BRMS) ○ Business Workflows (BWMS)● Accessible through ○ Browser ○ REST webservice
  3. 3. Why would I need a BRMS like Guvnor?
  4. 4. Use case: mortgage● Mortgage approval● Mortgage rate calculation
  5. 5. Diploma Computer science + Economics + Medicine John Unfindable SmithProgrammers are not domain experts
  6. 6. Domain experts define rules● Mortgage manager == domain expert ○ defines rules ○ wants to edit rules Invalid: must be a number
  7. 7. Too complexNot flexible enough
  8. 8. when house near Fukushima then ... when guarantor invested in Lehman Brothers stock then ...Business rules change often
  9. 9. Only works for data changes
  10. 10. Too slow for business rules changes
  11. 11. Possible through Guvnor
  12. 12. How do I define my data model?
  13. 13. Business Model● POJO modelUpload a Java JAR file into Guvnor● Declarative modelDeclare a model within Guvnor● Enumerations
  14. 14. Business Model POJO ModelUploading a POJO model
  15. 15. Business Model Declarative modelDeclarative model editor ● Add CEP support to your classes 1. @role(event) annotation 2. Add to POJOs or declared types ● Example types: 1. Loan Application 2. Applicant 3. ... ● Example fields: 1. LoanApplication.amount 2. LoanApplication.approved
  16. 16. Business Model Declarative modelDeclarative model editor
  17. 17. Business Model Declarative modelAdding a new Type ● Types can extend Java classes ● Types can extend other declared typesAdding a field to a Fact
  18. 18. Business Model Enumerations● Java enumerationsDefined in POJO model● Guvnor enumerationsDefined declaratively in Guvnor
  19. 19. Business Model EnumerationsGuvnor enumeration editor:
  20. 20. Business Model EnumerationsGuvnor enumerations: ● Restrict any domain field ● Dependent enumerations ● Pull content from external source
  21. 21. Authoring rulesHow do I define my business rules?
  22. 22. Authoring rules● Web-based editor● Web-based templates● Web-based decision tables● Domain Specific Language● Free-form DRL
  23. 23. Authoring rules Web-based editorWeb-based editor: ● Visually define individual rules quickly and easily ● Supports a wide sub-set of Drools Expert DRL features 1. all of the following are true 2. any of the following are true 3. nested model accessors 4. from 5. accumulate 6. collect 7. CEP 8. etc
  24. 24. Authoring rules Web-based editorWeb-based editor
  25. 25. Authoring rules Web-based templatesWeb-based templates: ● Visually define multiple rules quickly and easily ● Extension of Web-based editor ● Define parameters in rules ● Backed by a table of data to build individual rules
  26. 26. Authoring rules Web-based templatesWeb-based templates (editor)
  27. 27. Authoring rules Web-based templatesWeb-based templates (data)
  28. 28. Authoring rules Web-based templatesResultant rules
  29. 29. Authoring rules Web-based decision tablesWeb-based decision tables: ● Visually define multiple rules quickly and easily ● Rapid construction using Wizard ● Extended entryValues are held in the decision table ● Limited entryValues are held in the column definition ● Expanded form ● Mergable cells ● Grouping of rows
  30. 30. Authoring rules Web-based decision tablesUsing a Wizard
  31. 31. Authoring rules Web-based decision tablesExtended Entry
  32. 32. Authoring rules Web-based decision tablesLimited Entry
  33. 33. Authoring rules Web-based decision tablesExpanded form ● One row for each combination of conditions ● Condition 1 with 3 values (25, 30, 35) ● Condition 2 with 3 values ("AA", "OK", "Sub prime") ● 3 x 3 = 9 rules
  34. 34. Authoring rules Web-based decision tablesMerging cellsGrouping cells
  35. 35. Decision table analysis● Impossible matches ○ 1 row can never match● Conflict detection ○ 2 rows match at same time for certain ranges ○ and contradict each other
  36. 36. Authoring rules Web-based decision tablesResultant rules
  37. 37. Authoring rules Domain Specific LanguageDomain Specific Language: ● Define domain specific sentences for use in rules ● Include DSL sentences in rules
  38. 38. Authoring rules Free-form DRLFree-form DRL: ● Cutting edge Drools Expert syntax 1. Backwards chaining 2. Declarative agenda 3. Traits ● Some people (developers) just prefer it
  39. 39. How do I check the quality of my rules?
  40. 40. Test Scenarios● Validates your decisions● Guards your knowledge● Rules specify what decisions to make with the given data ○ When the data exists. Then do the following● Test scenarios validate that the knowledge base does what is expected ○ Given we have this data. Expect the following to be true
  41. 41. Overall report of test statuses andcoverage
  42. 42. Single ScenarioA 17-year-oldshould never geta loan, even ifhe has anincome source.
  43. 43. Failing ScenarioIf a change inthe future willbreak theknowledgebase. Allowingloans forunderages. Thistest scenario willpick it up.
  44. 44. Rule Analysis● Looks for errors in the rule logic and mistakes made by the rule authors ○ Redundant and subsumptant rules ○ Missing ranges ○ Rules that can never fire ○ Rules that always fire ○ Rule optimization
  45. 45. Rule AnalysisReportExample report warningabout missing rangesand missing ruleconditions.
  46. 46. How do I define workflows?
  47. 47. Web-based BPMN2 authoring● Guvnor integration with jBPM5 Web Designer allows: ○ editing/creation of fully-executable jBPM5 processes ○ viewing the source of the process in different formats (png, pdf, json, bpmn2, svg) ○ automatic creation of human-task forms (fully executable in jBPM console) ○ creation of jBPM workitem definition configurations (via custom editor, similar to sprint context editor) ○ visual process validation ○ automatic installation of assets from the jBPM Service Repository ○ ability to convert jBPM3.2-based process definitions to BPMN2
  48. 48. Where does Guvnor fit into my infrastructure?
  49. 49. Jackrabbit Repository Configuration● All assets are stored in a content repository (JCR 2.0 compliant)● Configuring different repositories is possible● Default repository implementation is Apache Jackrabbit● Jackrabbit allows repository to be stored ○ File System (default) ○ External Database (Oracle, MySQL, etc)● Configuring Jackrabbit is often tedious mainly because of limited or not-existing documentation● Guvnor Admin section includes a repository configuration widget that helps with configuration creation.
  50. 50. Jackrabbit Repo. Configuration (2)● BRMS 5.2 repository configuration widget:
  51. 51. Jackrabbit Repo. Configuration (3)● Guvnor repository configuration widget:
  52. 52. Jackrabbit Repo. Configuration (4)● Guvnor repository configuration widget:
  53. 53. How do I release the knowledge?
  54. 54. Releasing the knowledge PackagingAssemble required assets into a single deployable unit
  55. 55. Releasing the knowledge VersioningBoth assets and packages are "versioned" in the Guvnor
  56. 56. Releasing the knowledge Lifecycle managementCreate status (life cycles):Change the status:
  57. 57. How do I use the knowledge?
  58. 58. Using the knowledgeThe Knowledge Agent
  59. 59. Using the knowledge The REST InterfaceThe Guvnor repository back end can be accessed via Restand WebDav. REST Examples:URL Mode Produces Mime- Consumes MIME- Description Type Type/packages/ GET application/atom+xml none Returns the metadata of the{packageName} package {packageName} as an Atom Entry./packages/ GET application/json none Returns the metadata of the{packageName} application/xml package {packageName} as Json or XML/packages/ GET application/octet- none Returns the compiled binary{packageName} stream of the package/binary {packageName} as a binary stream/packages/ PUT application/atom+xml none Updates the metadata of{packageName} package {packageName} with a given Atom Entry./packages POST application/atom+xml application/atom+xml Creates a package from an Atom Entry. Returns the newly created package in Atom Entry format
  60. 60. Spring Context Editor● Allows to create and manage Spring Context files:● Spring contexts have own asset type:● Retrievable via REST API by clients.● Easy to create custom editors for integration with other technologies.
  61. 61. Embeddable Asset Editors● Guvnor provides a set of Editors to author assets● Asset format determines the Editor used● Some existing editors: ○ Guided Rule Editor ○ DRL Editor ○ DSL Editor ○ Decision Table Editor ○ Spring Context Editor ○ jBPM5 Workitem Definition Editor ○ ...● Guvnor also has the ability to embed asset editors in client applications
  62. 62. Embeddable Asset Editors (2)● Embedding enabled via StandaloneEditorServlet● Client applications must perform request to /standaloneEditorServlet and can interact with the embedded editor(s) via JavaScript. ○ Restriction – since JavaScript is used, client application must run on the same server as Guvnor (cross-domain interaction only)● 100% community contribution● Three interaction modes available: ○ Guided Rule editing mode (new or existing assets) ○ Asset Editor (existing assets only) ○ New asset mode
  63. 63. Questions