SlideShare a Scribd company logo
1 of 29
Oracle Business Rules
Oracle Business Rules is a high performance and
lightweight business rules product that is part of the
Oracle Fusion Middleware Suite that can be used in
both SOA and BPM suite.
To have a business process more agile and coherent
with the changing demands of Business, Oracle
Business rules is a must for any design. Also it
should act as a central component where all process
rules are located.
With OBR 11g one added advantage of business
rules is that they can be exposed as any other web
service. This makes it an instant hit as it becomes
hot pluggable.
Here in this example blog i would show how to
create a complex rule in JDeveloper and test it out
through multiple ways.
The Scenario
A high school needs a web service implemented as a
rule in Oracle that calculates the grades of students.
The service would take some basic candidate
information and an array of subjects/marks that the
candidate has obtained. The rules engine will have to
allocate the candidate Grades on the basis of the
following logic.
Average
Marks
Grade Allotted
<40 FAIL
40-60 FAIR
60-80 GOOD
80-90 VERY GOOD
90-100 OUTSTANDING
For the sake of this demonstration we would use an
XSD definition for CandidateInformation and
CandidateGrade.
<?xml version="1.0" encoding="UTF-
8"?>
<xsd:schema xmlns:xsd="<a
href="http://www.w3.org/2001/XMLSch
ema&quot;">http://www.w3.org/2001/X
MLSchema"</a> xmlns="<a
href="http://www.example.org&quot;"
>http://www.example.org"</a>
targetNamespace="<a
href="http://www.example.org&quot;"
>http://www.example.org"</a>
elementFormDefault="qualified">
<xsd:element
name="CandidateInformation"
type="CandidateInformationType"/>
<xsd:element name="CandidateGrade"
type="CandidateGradeType"/>
<xsd:complexType
name="CandidateInformationType">
<xsd:sequence>
<xsd:element name="name"
type="xsd:string"/>
<xsd:element name="rollNumber"
type="xsd:string"/>
<xsd:element name="class"
type="xsd:string"/>
<xsd:element name="section"
type="xsd:string"/>
<xsd:element name="remarks"
type="xsd:string"/>
<xsd:element name="subject"
type="SubjectType"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType
name="CandidateGradeType">
<xsd:sequence>
<xsd:element name="overallGrade"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType
name="SubjectType">
<xsd:sequence>
<xsd:element name="subjectName"
type="xsd:string"/>
<xsd:element name="subjectCode"
type="xsd:string"/>
<xsd:element name="subjectMark"
type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Save it somewhere as GradesAllocation.xsd
The Solution
ļ‚· Open JDeveloper and Create a New SOA
Application.
ļ‚· Name the application as
BusinessRulesApplication and click on Next.
ļ‚· Name the project as BusinessRulesProject and
again click Next. Make sure ā€˜SOAā€™ is selected
under ā€˜Project Technologiesā€™
ļ‚· Choose ā€˜Composite with Business Ruleā€™ and
click on ā€˜Finishā€™.
ļ‚· You would see that a window pops out to create
a rule and specify the inputs and output for the
rule.
ļ‚· Name the rule as ā€˜GradeAllocationRuleā€™ and
click on the ā€˜+ā€™ icon to specify the Input and
Output types for the rule. Select
ā€˜CandidateInformationā€™ from the
GradeAllocation.xsd as the input and
CandidateGrade as the output.
ļ‚· Wait for the wizard to create the rule definition.
Click on the Ruleset at the top and rename it to
ā€˜GradeAllocationā€™.
ļ‚· Click on ā€˜Bucketsetsā€™ link in the left most panel
and Add a ā€˜List of Rangesā€™.
ļ‚· Name the bucketset as ā€˜markRangeā€™ and create
a list of ranges as under.
ļ‚· Click OK to save changes to the bucketset and
click on GradeAllocation ruleset.
ļ‚· Select ā€˜Create Decision Tableā€™ from the two
options. Remember that we can either create an
ā€˜if-then-elseā€™ rule or a decision table. A decision
table is implicitly evaluated as an ā€˜of-then-elseā€™
rule only but gives a better manageability to rule
definitions.
ļ‚· Name the decision function as ā€˜decideGradeā€™
and check ā€˜Advanced Modeā€™ to be true.
ļ‚· Click on ā€˜Insert Patternā€™ in the workspace
below.
ļ‚· Right Click on the ā€˜variableā€™ block and click on
ā€˜Surround withā€™ and click on ā€˜Pattern Blockā€™
ļ‚· Click on the auto generated expression and from
the dropdown select ā€˜aggregateā€™
ļ‚· Now click on variabe and define a variable
named ā€˜averageMarksā€™, Click on ā€˜functionsā€™ to
select ā€˜averageā€™ from the dropdown. Click on
ā€˜fact typeā€™ to select ā€˜SubjectTypeā€™ element as
the fact. Name this as ā€˜subjectTypeā€™. Click on
ā€˜expressionā€™ now to select
ā€˜subjectType.subjectMarkā€™ as we are
interested in the average marks across all
subjects. The overall construct should look like
below :
ļ‚· Click on ā€˜insert conditionā€™ in the panel below
and then click ā€˜edit conditionā€™ to select
ā€˜averageMarksā€™ from the option. Choose the
bucketset ā€˜marksRangeā€™ from the dropdown
ā€˜Local List of Rangesā€™.
ļ‚· Click on the ā€˜+ā€™ icon adjacent to the range
dropdown and keep adding a rule for each of the
range. Remember you have to add six distinct
rule. Select a distinct value defined in the
bucketset each time. Here is how to define the
rules.
ļ‚· Now go to the ā€˜Actionsā€™ panel and click on
ā€˜insert actionā€™. Select ā€˜Assert newā€™. Double
click on the action and click on
ā€˜CandidateGradeTypeā€™ under Facts. Check the
option ā€˜Parameterizedā€™ for the property
ā€˜overallGradeā€™
ļ‚· Now click on each of the option box in the Grid
to define a value for the outcome. Since
overallGrade is a String type, assign a grade in
string for each of the condition as under
ļ‚· Save all projects and files in JDeveloper. With
this we are done with the Rules creation part. So
here is a summary of what we did.
o Created a bucketset for a list of mark ranges
and grade type associated with them.
o Created a decision table for a set of rules.
Initialized a variable for ā€˜averageMarksā€™
and using a pattern block assigned it as an
average of all subject marks.
o Now for each condition for the rule asserted
the outcome for
ā€˜CandidateGrade.overallGradeā€™ with the
grade that has to be assigned.
o Pretty simple. Isnā€™t it?
Testing the Rules
Creating business rules isnā€™t just enough. There has
to be a mechanism to test them. Remember Oracle
Rules engine is a inference based rules engine i.e
rules are all evaluated at runtime. For more
information on how rules are evaluated refer to
Oracle Business rules architecture. Here I would
show how rules can be tested using three ways.
Testing Rules by Creating a Debug RL function
ļ‚· Click on the ā€˜Functionsā€™ link and add a new
function and name it to ā€˜DebugRuleā€™. Select
boolean under both Return Type and
Bucketset.
ļ‚· For the body part of the function we would right
an RL construct to initialize
CandidateInformationType (input to the rule)
and pass some dummy values to it.
ļ‚· Check the screen snap below and create a body
exactly like the one below
ļ‚· Now if you are familiar with any programming
language understanding the above construct
should be like a cakewalk.
ļ‚· You would now see that the ā€˜Testā€™ link for the
function becomes enabled. Click on it to test the
rule output.
ļ‚· Here you go. You can see that the output grade
is ā€˜OUTSTANDINGā€™. Has to be since the
dummy value of marks assigned were 100 and
100. You can now change the marks in the
subjects or add a new subject type to test the rule
again for a different output.
ļ‚· You can create as many Rulesets as you may for
evaluating more complex conditions and add
them to the Decision Functions in the order you
would need their evaluation to come up with
complex business scenarios.
Testing Rules from EM console
ļ‚· Deploy the BusinessRulesProject to a domain
server extended with soa suite. Boot up the em
console and browse to the project composite.
ļ‚· Click on the ā€˜Testā€™ icon for the composite to
launch the EM test wizard for the composite.
ļ‚· You would see a Tree View for the request
message for the composite wherein you can
input sample values
ļ‚· Fill in any random values for the type
bpelInstance. The only important value would
be the attribute ā€˜NCNameā€™. Make sure you put
the name of your Decision Function there.
ļ‚· Fill the request wizard with
CandidateInformation as under
ļ‚· Click on Test Web Service button on top left of
the page to test the Rules decision service.
ļ‚· Expand the CandidateGrade in the Response
tab to see the overallGrade for the student.
ļ‚· You can click on ā€˜Launch Flow Traceā€™ to view
the execution trace for the Decision Service.
ļ‚· You can see how easily we can test out our
Business rules from the EM console.
Testing Rules from SOAP UI
More than often in real life scenarios we would like
to create some kind of a unit testing suite for out
business rules. Ag you might have already made
note that in SOA suite 11g Business rules are
exposed as standard web services that can be
invoked from anywhere. See the demonstration
below to see how Business rules can be externalized
as web service and invoked through third parties
even.
ļ‚· Go to the BusinessRulesProject composite in
the EM console.
ļ‚· Click on the ā€˜Service Iconā€™ to copy the WSDL
endpoint for the rules service.
ļ‚· Create a SOAPUI project based on this WSDL.
ļ‚· Fill the mock service request with actual values
ļ‚· Run the test and you should see the outcome
from the Rules decision function.
Now you can build a test suite to create mock
requests for various scenarios and assert the
responses

More Related Content

Viewers also liked

oracle-osb
oracle-osboracle-osb
oracle-osbAbrarMoiz
Ā 
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database ProfessionalsIntroducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database ProfessionalsLucas Jellema
Ā 
Oracle Enterprise Manager SOA Management Pack
Oracle Enterprise Manager SOA Management PackOracle Enterprise Manager SOA Management Pack
Oracle Enterprise Manager SOA Management PackFumiko Yamashita
Ā 
SOA Integration Blueprint with Oracle SOA Suite
SOA Integration Blueprint with Oracle SOA SuiteSOA Integration Blueprint with Oracle SOA Suite
SOA Integration Blueprint with Oracle SOA SuiteMatthias Furrer
Ā 
Oracle SOA Suite Overview - Integration in a Service-Oriented World
Oracle SOA Suite Overview - Integration in a Service-Oriented WorldOracle SOA Suite Overview - Integration in a Service-Oriented World
Oracle SOA Suite Overview - Integration in a Service-Oriented WorldOracleContractors
Ā 
Monitoring Oracle SOA Suite - UKOUG Tech15 2015
Monitoring Oracle SOA Suite - UKOUG Tech15 2015Monitoring Oracle SOA Suite - UKOUG Tech15 2015
Monitoring Oracle SOA Suite - UKOUG Tech15 2015C2B2 Consulting
Ā 
Cookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business RulesCookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business RulesEmiel Paasschens
Ā 

Viewers also liked (7)

oracle-osb
oracle-osboracle-osb
oracle-osb
Ā 
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database ProfessionalsIntroducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
Ā 
Oracle Enterprise Manager SOA Management Pack
Oracle Enterprise Manager SOA Management PackOracle Enterprise Manager SOA Management Pack
Oracle Enterprise Manager SOA Management Pack
Ā 
SOA Integration Blueprint with Oracle SOA Suite
SOA Integration Blueprint with Oracle SOA SuiteSOA Integration Blueprint with Oracle SOA Suite
SOA Integration Blueprint with Oracle SOA Suite
Ā 
Oracle SOA Suite Overview - Integration in a Service-Oriented World
Oracle SOA Suite Overview - Integration in a Service-Oriented WorldOracle SOA Suite Overview - Integration in a Service-Oriented World
Oracle SOA Suite Overview - Integration in a Service-Oriented World
Ā 
Monitoring Oracle SOA Suite - UKOUG Tech15 2015
Monitoring Oracle SOA Suite - UKOUG Tech15 2015Monitoring Oracle SOA Suite - UKOUG Tech15 2015
Monitoring Oracle SOA Suite - UKOUG Tech15 2015
Ā 
Cookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business RulesCookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business Rules
Ā 

Similar to Oracle business rules

ETL Validator Usecase - checking for valid field and data format
ETL Validator Usecase - checking for valid field and data formatETL Validator Usecase - checking for valid field and data format
ETL Validator Usecase - checking for valid field and data formatDatagaps Inc
Ā 
OLT open script
OLT open script OLT open script
OLT open script Sujay Raghuraj
Ā 
Rpt ppt
Rpt pptRpt ppt
Rpt pptsindhu T
Ā 
Adapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedureAdapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedureprathap kumar
Ā 
InfoSphere_Information_Analyzer
InfoSphere_Information_AnalyzerInfoSphere_Information_Analyzer
InfoSphere_Information_AnalyzerSourav Maity
Ā 
Guide for Quality Center (QC) Automation Tool
Guide for Quality Center (QC) Automation ToolGuide for Quality Center (QC) Automation Tool
Guide for Quality Center (QC) Automation ToolSubrat Srivastava
Ā 
Introduction To ReqPro
Introduction To ReqProIntroduction To ReqPro
Introduction To ReqProLeslie Munday
Ā 
ETL Validator Usecase - checking for LoV conformance
ETL Validator Usecase - checking for LoV conformanceETL Validator Usecase - checking for LoV conformance
ETL Validator Usecase - checking for LoV conformanceDatagaps Inc
Ā 
Developing a ssrs report using a ssas data source
Developing a ssrs report using a ssas data sourceDeveloping a ssrs report using a ssas data source
Developing a ssrs report using a ssas data sourcerelekarsushant
Ā 
blckboxtesting.ppt il.;io'/ ulio'[ yjko8i[0'-p/ yk
blckboxtesting.ppt il.;io'/ ulio'[ yjko8i[0'-p/ ykblckboxtesting.ppt il.;io'/ ulio'[ yjko8i[0'-p/ yk
blckboxtesting.ppt il.;io'/ ulio'[ yjko8i[0'-p/ ykSMayankSharma
Ā 
Performance Tuning for Visualforce and Apex
Performance Tuning for Visualforce and ApexPerformance Tuning for Visualforce and Apex
Performance Tuning for Visualforce and ApexSalesforce Developers
Ā 
Sales force certification-lab
Sales force certification-labSales force certification-lab
Sales force certification-labAmit Sharma
Ā 
Sales force certification-lab
Sales force certification-labSales force certification-lab
Sales force certification-labAmit Sharma
Ā 
Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014jaredrrichardson
Ā 
Managing Oracle Streams Using Enterprise Manager Grid Control
Managing Oracle Streams Using Enterprise Manager Grid ControlManaging Oracle Streams Using Enterprise Manager Grid Control
Managing Oracle Streams Using Enterprise Manager Grid Controlscottb411
Ā 
Obiee interview questions and answers faq
Obiee interview questions and answers faqObiee interview questions and answers faq
Obiee interview questions and answers faqmaheshboggula
Ā 
Programming Building Blocks for Admins
Programming Building Blocks for Admins Programming Building Blocks for Admins
Programming Building Blocks for Admins Salesforce Admins
Ā 

Similar to Oracle business rules (20)

dbadapters
dbadaptersdbadapters
dbadapters
Ā 
ETL Validator Usecase - checking for valid field and data format
ETL Validator Usecase - checking for valid field and data formatETL Validator Usecase - checking for valid field and data format
ETL Validator Usecase - checking for valid field and data format
Ā 
OLT open script
OLT open script OLT open script
OLT open script
Ā 
Rpt ppt
Rpt pptRpt ppt
Rpt ppt
Ā 
Adapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedureAdapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedure
Ā 
Oracle OSB Tutorial 1
Oracle OSB Tutorial 1Oracle OSB Tutorial 1
Oracle OSB Tutorial 1
Ā 
InfoSphere_Information_Analyzer
InfoSphere_Information_AnalyzerInfoSphere_Information_Analyzer
InfoSphere_Information_Analyzer
Ā 
Guide for Quality Center (QC) Automation Tool
Guide for Quality Center (QC) Automation ToolGuide for Quality Center (QC) Automation Tool
Guide for Quality Center (QC) Automation Tool
Ā 
Introduction To ReqPro
Introduction To ReqProIntroduction To ReqPro
Introduction To ReqPro
Ā 
ETL Validator Usecase - checking for LoV conformance
ETL Validator Usecase - checking for LoV conformanceETL Validator Usecase - checking for LoV conformance
ETL Validator Usecase - checking for LoV conformance
Ā 
Developing a ssrs report using a ssas data source
Developing a ssrs report using a ssas data sourceDeveloping a ssrs report using a ssas data source
Developing a ssrs report using a ssas data source
Ā 
blckboxtesting.ppt il.;io'/ ulio'[ yjko8i[0'-p/ yk
blckboxtesting.ppt il.;io'/ ulio'[ yjko8i[0'-p/ ykblckboxtesting.ppt il.;io'/ ulio'[ yjko8i[0'-p/ yk
blckboxtesting.ppt il.;io'/ ulio'[ yjko8i[0'-p/ yk
Ā 
Performance Tuning for Visualforce and Apex
Performance Tuning for Visualforce and ApexPerformance Tuning for Visualforce and Apex
Performance Tuning for Visualforce and Apex
Ā 
Sales force certification-lab
Sales force certification-labSales force certification-lab
Sales force certification-lab
Ā 
Sales force certification-lab
Sales force certification-labSales force certification-lab
Sales force certification-lab
Ā 
Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014Acceptance Test Driven Development at StarWest 2014
Acceptance Test Driven Development at StarWest 2014
Ā 
Managing Oracle Streams Using Enterprise Manager Grid Control
Managing Oracle Streams Using Enterprise Manager Grid ControlManaging Oracle Streams Using Enterprise Manager Grid Control
Managing Oracle Streams Using Enterprise Manager Grid Control
Ā 
Obiee interview questions and answers faq
Obiee interview questions and answers faqObiee interview questions and answers faq
Obiee interview questions and answers faq
Ā 
Programming Building Blocks for Admins
Programming Building Blocks for Admins Programming Building Blocks for Admins
Programming Building Blocks for Admins
Ā 
Itb weka
Itb wekaItb weka
Itb weka
Ā 

More from xavier john

Unix day4 v1.3
Unix day4 v1.3Unix day4 v1.3
Unix day4 v1.3xavier john
Ā 
Unix day3 v1.3
Unix day3 v1.3Unix day3 v1.3
Unix day3 v1.3xavier john
Ā 
Unix day2 v1.3
Unix day2 v1.3Unix day2 v1.3
Unix day2 v1.3xavier john
Ā 
Interview questions
Interview questionsInterview questions
Interview questionsxavier john
Ā 
Xavier async callback_fault
Xavier async callback_faultXavier async callback_fault
Xavier async callback_faultxavier john
Ā 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpoliciesxavier john
Ā 
All adapterscommonproperties
All adapterscommonpropertiesAll adapterscommonproperties
All adapterscommonpropertiesxavier john
Ā 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpoliciesxavier john
Ā 
Soa installation
Soa installationSoa installation
Soa installationxavier john
Ā 
Webservices
WebservicesWebservices
Webservicesxavier john
Ā 
Xml material
Xml materialXml material
Xml materialxavier john
Ā 
Xsd basics
Xsd basicsXsd basics
Xsd basicsxavier john
Ā 
All adapterscommonproperties
All adapterscommonpropertiesAll adapterscommonproperties
All adapterscommonpropertiesxavier john
Ā 

More from xavier john (20)

Unix day4 v1.3
Unix day4 v1.3Unix day4 v1.3
Unix day4 v1.3
Ā 
Unix day3 v1.3
Unix day3 v1.3Unix day3 v1.3
Unix day3 v1.3
Ā 
Unix day2 v1.3
Unix day2 v1.3Unix day2 v1.3
Unix day2 v1.3
Ā 
Interview questions
Interview questionsInterview questions
Interview questions
Ā 
Xavier async callback_fault
Xavier async callback_faultXavier async callback_fault
Xavier async callback_fault
Ā 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpolicies
Ā 
All adapterscommonproperties
All adapterscommonpropertiesAll adapterscommonproperties
All adapterscommonproperties
Ā 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpolicies
Ā 
Soap.doc
Soap.docSoap.doc
Soap.doc
Ā 
Soa installation
Soa installationSoa installation
Soa installation
Ā 
Vx vm
Vx vmVx vm
Vx vm
Ā 
Webservices
WebservicesWebservices
Webservices
Ā 
While.doc
While.docWhile.doc
While.doc
Ā 
Xml material
Xml materialXml material
Xml material
Ā 
Xpath
XpathXpath
Xpath
Ā 
X query
X queryX query
X query
Ā 
Xsd basics
Xsd basicsXsd basics
Xsd basics
Ā 
Xsd
XsdXsd
Xsd
Ā 
Xslt
XsltXslt
Xslt
Ā 
All adapterscommonproperties
All adapterscommonpropertiesAll adapterscommonproperties
All adapterscommonproperties
Ā 

Recently uploaded

XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
Ā 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
Ā 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
Ā 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
Ā 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
Ā 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
Ā 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
Ā 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
Ā 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
Ā 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
Ā 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
Ā 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
Ā 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
Ā 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
Ā 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
Ā 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
Ā 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
Ā 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
Ā 
Russian Call Girls in Karol Bagh Aasnvi āž”ļø 8264348440 šŸ’‹šŸ“ž Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi āž”ļø 8264348440 šŸ’‹šŸ“ž Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi āž”ļø 8264348440 šŸ’‹šŸ“ž Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi āž”ļø 8264348440 šŸ’‹šŸ“ž Independent Escort S...soniya singh
Ā 

Recently uploaded (20)

XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
Ā 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
Ā 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Ā 
Call Girls In Mukherjee Nagar šŸ“± 9999965857 šŸ¤© Delhi šŸ«¦ HOT AND SEXY VVIP šŸŽ SE...
Call Girls In Mukherjee Nagar šŸ“±  9999965857  šŸ¤© Delhi šŸ«¦ HOT AND SEXY VVIP šŸŽ SE...Call Girls In Mukherjee Nagar šŸ“±  9999965857  šŸ¤© Delhi šŸ«¦ HOT AND SEXY VVIP šŸŽ SE...
Call Girls In Mukherjee Nagar šŸ“± 9999965857 šŸ¤© Delhi šŸ«¦ HOT AND SEXY VVIP šŸŽ SE...
Ā 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Ā 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Ā 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
Ā 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
Ā 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
Ā 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
Ā 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
Ā 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
Ā 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
Ā 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
Ā 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
Ā 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
Ā 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
Ā 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
Ā 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Ā 
Russian Call Girls in Karol Bagh Aasnvi āž”ļø 8264348440 šŸ’‹šŸ“ž Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi āž”ļø 8264348440 šŸ’‹šŸ“ž Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi āž”ļø 8264348440 šŸ’‹šŸ“ž Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi āž”ļø 8264348440 šŸ’‹šŸ“ž Independent Escort S...
Ā 

Oracle business rules

  • 1. Oracle Business Rules Oracle Business Rules is a high performance and lightweight business rules product that is part of the Oracle Fusion Middleware Suite that can be used in both SOA and BPM suite. To have a business process more agile and coherent with the changing demands of Business, Oracle Business rules is a must for any design. Also it should act as a central component where all process rules are located. With OBR 11g one added advantage of business rules is that they can be exposed as any other web service. This makes it an instant hit as it becomes hot pluggable. Here in this example blog i would show how to create a complex rule in JDeveloper and test it out through multiple ways. The Scenario A high school needs a web service implemented as a rule in Oracle that calculates the grades of students.
  • 2. The service would take some basic candidate information and an array of subjects/marks that the candidate has obtained. The rules engine will have to allocate the candidate Grades on the basis of the following logic. Average Marks Grade Allotted <40 FAIL 40-60 FAIR 60-80 GOOD 80-90 VERY GOOD 90-100 OUTSTANDING For the sake of this demonstration we would use an XSD definition for CandidateInformation and CandidateGrade. <?xml version="1.0" encoding="UTF- 8"?> <xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSch ema&quot;">http://www.w3.org/2001/X MLSchema"</a> xmlns="<a href="http://www.example.org&quot;"
  • 5. ļ‚· Open JDeveloper and Create a New SOA Application. ļ‚· Name the application as BusinessRulesApplication and click on Next.
  • 6. ļ‚· Name the project as BusinessRulesProject and again click Next. Make sure ā€˜SOAā€™ is selected under ā€˜Project Technologiesā€™
  • 7. ļ‚· Choose ā€˜Composite with Business Ruleā€™ and click on ā€˜Finishā€™. ļ‚· You would see that a window pops out to create a rule and specify the inputs and output for the rule. ļ‚· Name the rule as ā€˜GradeAllocationRuleā€™ and click on the ā€˜+ā€™ icon to specify the Input and Output types for the rule. Select ā€˜CandidateInformationā€™ from the
  • 8. GradeAllocation.xsd as the input and CandidateGrade as the output.
  • 9. ļ‚· Wait for the wizard to create the rule definition. Click on the Ruleset at the top and rename it to ā€˜GradeAllocationā€™.
  • 10. ļ‚· Click on ā€˜Bucketsetsā€™ link in the left most panel and Add a ā€˜List of Rangesā€™. ļ‚· Name the bucketset as ā€˜markRangeā€™ and create a list of ranges as under.
  • 11. ļ‚· Click OK to save changes to the bucketset and click on GradeAllocation ruleset. ļ‚· Select ā€˜Create Decision Tableā€™ from the two options. Remember that we can either create an ā€˜if-then-elseā€™ rule or a decision table. A decision table is implicitly evaluated as an ā€˜of-then-elseā€™ rule only but gives a better manageability to rule definitions.
  • 12. ļ‚· Name the decision function as ā€˜decideGradeā€™ and check ā€˜Advanced Modeā€™ to be true. ļ‚· Click on ā€˜Insert Patternā€™ in the workspace below.
  • 13. ļ‚· Right Click on the ā€˜variableā€™ block and click on ā€˜Surround withā€™ and click on ā€˜Pattern Blockā€™
  • 14. ļ‚· Click on the auto generated expression and from the dropdown select ā€˜aggregateā€™ ļ‚· Now click on variabe and define a variable named ā€˜averageMarksā€™, Click on ā€˜functionsā€™ to select ā€˜averageā€™ from the dropdown. Click on ā€˜fact typeā€™ to select ā€˜SubjectTypeā€™ element as the fact. Name this as ā€˜subjectTypeā€™. Click on ā€˜expressionā€™ now to select ā€˜subjectType.subjectMarkā€™ as we are interested in the average marks across all subjects. The overall construct should look like below :
  • 15. ļ‚· Click on ā€˜insert conditionā€™ in the panel below and then click ā€˜edit conditionā€™ to select ā€˜averageMarksā€™ from the option. Choose the bucketset ā€˜marksRangeā€™ from the dropdown ā€˜Local List of Rangesā€™. ļ‚· Click on the ā€˜+ā€™ icon adjacent to the range dropdown and keep adding a rule for each of the
  • 16. range. Remember you have to add six distinct rule. Select a distinct value defined in the bucketset each time. Here is how to define the rules. ļ‚· Now go to the ā€˜Actionsā€™ panel and click on ā€˜insert actionā€™. Select ā€˜Assert newā€™. Double click on the action and click on ā€˜CandidateGradeTypeā€™ under Facts. Check the option ā€˜Parameterizedā€™ for the property ā€˜overallGradeā€™
  • 17. ļ‚· Now click on each of the option box in the Grid to define a value for the outcome. Since overallGrade is a String type, assign a grade in string for each of the condition as under
  • 18. ļ‚· Save all projects and files in JDeveloper. With this we are done with the Rules creation part. So here is a summary of what we did. o Created a bucketset for a list of mark ranges and grade type associated with them. o Created a decision table for a set of rules. Initialized a variable for ā€˜averageMarksā€™ and using a pattern block assigned it as an average of all subject marks. o Now for each condition for the rule asserted the outcome for ā€˜CandidateGrade.overallGradeā€™ with the grade that has to be assigned. o Pretty simple. Isnā€™t it? Testing the Rules Creating business rules isnā€™t just enough. There has to be a mechanism to test them. Remember Oracle Rules engine is a inference based rules engine i.e rules are all evaluated at runtime. For more information on how rules are evaluated refer to Oracle Business rules architecture. Here I would show how rules can be tested using three ways. Testing Rules by Creating a Debug RL function
  • 19. ļ‚· Click on the ā€˜Functionsā€™ link and add a new function and name it to ā€˜DebugRuleā€™. Select boolean under both Return Type and Bucketset. ļ‚· For the body part of the function we would right an RL construct to initialize CandidateInformationType (input to the rule) and pass some dummy values to it. ļ‚· Check the screen snap below and create a body exactly like the one below
  • 20. ļ‚· Now if you are familiar with any programming language understanding the above construct should be like a cakewalk. ļ‚· You would now see that the ā€˜Testā€™ link for the function becomes enabled. Click on it to test the rule output.
  • 21. ļ‚· Here you go. You can see that the output grade is ā€˜OUTSTANDINGā€™. Has to be since the dummy value of marks assigned were 100 and 100. You can now change the marks in the subjects or add a new subject type to test the rule again for a different output.
  • 22. ļ‚· You can create as many Rulesets as you may for evaluating more complex conditions and add them to the Decision Functions in the order you would need their evaluation to come up with complex business scenarios. Testing Rules from EM console ļ‚· Deploy the BusinessRulesProject to a domain server extended with soa suite. Boot up the em console and browse to the project composite.
  • 23. ļ‚· Click on the ā€˜Testā€™ icon for the composite to launch the EM test wizard for the composite. ļ‚· You would see a Tree View for the request message for the composite wherein you can input sample values
  • 24. ļ‚· Fill in any random values for the type bpelInstance. The only important value would be the attribute ā€˜NCNameā€™. Make sure you put the name of your Decision Function there. ļ‚· Fill the request wizard with CandidateInformation as under
  • 25. ļ‚· Click on Test Web Service button on top left of the page to test the Rules decision service. ļ‚· Expand the CandidateGrade in the Response tab to see the overallGrade for the student. ļ‚· You can click on ā€˜Launch Flow Traceā€™ to view the execution trace for the Decision Service.
  • 26. ļ‚· You can see how easily we can test out our Business rules from the EM console. Testing Rules from SOAP UI More than often in real life scenarios we would like to create some kind of a unit testing suite for out business rules. Ag you might have already made note that in SOA suite 11g Business rules are exposed as standard web services that can be invoked from anywhere. See the demonstration below to see how Business rules can be externalized as web service and invoked through third parties even. ļ‚· Go to the BusinessRulesProject composite in the EM console. ļ‚· Click on the ā€˜Service Iconā€™ to copy the WSDL endpoint for the rules service.
  • 27. ļ‚· Create a SOAPUI project based on this WSDL. ļ‚· Fill the mock service request with actual values
  • 28. ļ‚· Run the test and you should see the outcome from the Rules decision function.
  • 29. Now you can build a test suite to create mock requests for various scenarios and assert the responses