guvnor presentation jervis liu
DESCRIPTION
TRANSCRIPT
![Page 1: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/1.jpg)
Guvnor
Jervis Liu
![Page 2: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/2.jpg)
What is Guvnor?
● Business Knowledge Management System● Application to manage business knowledge
○ Business Rules (BRMS)○ Business Workflows (BWMS)
● Accessible through○ Browser○ REST webservice
![Page 3: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/3.jpg)
Why would I need a BRMSlike Guvnor?
![Page 4: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/4.jpg)
Use case: mortgage
● Mortgage approval● Mortgage rate calculation
![Page 5: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/5.jpg)
![Page 6: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/6.jpg)
Programmers are not domain experts
DiplomaComputer science
+Economics
+Medicine
John Unfindable Smith
![Page 7: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/7.jpg)
Domain experts define rules
● Mortgage manager == domain expert○ defines rules○ wants to edit rules
Invalid: must be a number
![Page 8: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/8.jpg)
Too complexNot flexible enough
![Page 9: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/9.jpg)
Business rules change often
when house near Fukushimathen ...
when guarantor invested in Lehman Brothers stockthen ...
![Page 10: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/10.jpg)
Only works for data changes
![Page 11: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/11.jpg)
Too slow for business rules changes
![Page 12: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/12.jpg)
Possible through Guvnor
![Page 13: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/13.jpg)
How do I define my data model?
![Page 14: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/14.jpg)
●POJO modelUpload a Java JAR file into Guvnor
●Declarative modelDeclare a model within Guvnor
●Enumerations
Business Model
![Page 15: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/15.jpg)
Business ModelPOJO Model
Uploading a POJO model
![Page 16: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/16.jpg)
Business ModelDeclarative model
Declarative model editor
● Add CEP support to your classes1. @role(event) annotation2. Add to POJOs or declared types
● Example types:
1. Loan Application2. Applicant3. ...
● Example fields:1. LoanApplication.amount2. LoanApplication.approved
![Page 17: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/17.jpg)
Business ModelDeclarative model
Declarative model editor
![Page 18: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/18.jpg)
Business ModelDeclarative model
Adding a new Type● Types can extend Java classes● Types can extend other declared types
Adding a field to a Fact
![Page 19: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/19.jpg)
Business ModelEnumerations
●Java enumerationsDefined in POJO model
●Guvnor enumerationsDefined declaratively in Guvnor
![Page 20: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/20.jpg)
Business ModelEnumerations
Guvnor enumeration editor:
![Page 21: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/21.jpg)
Business ModelEnumerations
Guvnor enumerations:
● Restrict any domain field● Dependent enumerations
● Pull content from external source
![Page 22: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/22.jpg)
How do I define my business rules?
Authoring rules
![Page 23: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/23.jpg)
●Web-based editor
●Web-based templates
●Web-based decision tables
●Domain Specific Language
●Free-form DRL
Authoring rules
![Page 24: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/24.jpg)
Authoring rulesWeb-based editor
Web-based editor:
● Visually define individual rules quickly and easily
● Supports a wide sub-set of Drools Expert DRL features1. all of the following are true2. any of the following are true3. nested model accessors4. from5. accumulate6. collect7. CEP8. etc
![Page 25: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/25.jpg)
Authoring rulesWeb-based editor
Web-based editor
![Page 26: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/26.jpg)
Authoring rulesWeb-based templates
Web-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
![Page 27: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/27.jpg)
Authoring rulesWeb-based templates
Web-based templates (editor)
![Page 28: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/28.jpg)
Authoring rulesWeb-based templates
Web-based templates (data)
![Page 29: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/29.jpg)
Authoring rulesWeb-based templates
Resultant rules
![Page 30: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/30.jpg)
Authoring rulesWeb-based decision tables
Web-based decision tables:
● Visually define multiple rules quickly and easily
● Rapid construction using Wizard
● Extended entryValues are held in the decision table
● Limited entry Values are held in the column definition
● Expanded form
● Mergable cells
● Grouping of rows
![Page 31: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/31.jpg)
Authoring rulesWeb-based decision tables
Using a Wizard
![Page 32: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/32.jpg)
Authoring rulesWeb-based decision tables
Extended Entry
![Page 33: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/33.jpg)
Authoring rulesWeb-based decision tables
Limited Entry
![Page 34: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/34.jpg)
Authoring rulesWeb-based decision tables
Expanded 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
![Page 35: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/35.jpg)
Authoring rulesWeb-based decision tables
Merging cells
Grouping cells
![Page 36: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/36.jpg)
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
![Page 37: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/37.jpg)
Authoring rulesWeb-based decision tables
Resultant rules
![Page 38: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/38.jpg)
Authoring rulesDomain Specific Language
Domain Specific Language:
● Define domain specific sentences for use in rules
● Include DSL sentences in rules
![Page 39: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/39.jpg)
Authoring rulesFree-form DRL
Free-form DRL:
● Cutting edge Drools Expert syntax 1. Backwards chaining2. Declarative agenda3. Traits
● Some people (developers) just prefer it
![Page 40: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/40.jpg)
How do I check the quality of my rules?
![Page 41: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/41.jpg)
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
![Page 42: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/42.jpg)
Overall report of test statuses and coverage
![Page 43: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/43.jpg)
Single ScenarioA 17-year-old should never get a loan, even if he has an income source.
![Page 44: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/44.jpg)
Failing ScenarioIf a change in the future will break the knowledge base. Allowing loans for underages. This test scenario will pick it up.
![Page 45: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/45.jpg)
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
![Page 46: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/46.jpg)
Rule Analysis Report
Example report warning about missing ranges and missing rule conditions.
![Page 47: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/47.jpg)
How do I define workflows?
![Page 48: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/48.jpg)
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
![Page 49: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/49.jpg)
Where does Guvnor fit into my infrastructure?
![Page 50: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/50.jpg)
![Page 51: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/51.jpg)
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.
![Page 52: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/52.jpg)
Jackrabbit Repo. Configuration (2)
● BRMS 5.2 repository configuration widget:
![Page 53: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/53.jpg)
Jackrabbit Repo. Configuration (3)
● Guvnor repository configuration widget:
![Page 54: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/54.jpg)
Jackrabbit Repo. Configuration (4)
● Guvnor repository configuration widget:
![Page 55: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/55.jpg)
How do I release the knowledge?
![Page 56: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/56.jpg)
Releasing the knowledgePackaging
Assemble required assets into a single deployable unit
![Page 57: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/57.jpg)
Releasing the knowledgeVersioning
Both assets and packages are "versioned" in the Guvnor
![Page 58: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/58.jpg)
Releasing the knowledgeLifecycle management
Change the status:
Create status (life cycles):
![Page 59: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/59.jpg)
How do I use the knowledge?
![Page 60: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/60.jpg)
Using the knowledgeThe Knowledge Agent
![Page 61: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/61.jpg)
Using the knowledgeThe REST Interface
The Guvnor repository back end can be accessed via Rest and WebDav. REST Examples:
URL Mode Produces Mime-
TypeConsumes MIME-Type
Description
/packages/{packageName}
GET application/atom+xml none Returns the metadata of the package {packageName} as an Atom Entry.
/packages/{packageName}
GET application/jsonapplication/xml
none Returns the metadata of the package {packageName} as Json or XML
/packages/{packageName}/binary
GET application/octet-stream
none Returns the compiled binary of the package {packageName} as a binary stream
/packages/{packageName}
PUT application/atom+xml none Updates the metadata of 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
![Page 62: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/62.jpg)
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.
![Page 63: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/63.jpg)
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
![Page 64: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/64.jpg)
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
![Page 65: Guvnor presentation jervis liu](https://reader033.vdocument.in/reader033/viewer/2022051816/54622a70b4af9f6c1c8b463d/html5/thumbnails/65.jpg)
Questions
http://www.jboss.org/drools