• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
What's new in Drools 6 - London JBUG 2013
 

What's new in Drools 6 - London JBUG 2013

on

  • 1,764 views

Presentation around the time of Beta3 for "What's new in Drools 6.0". Note some aspects have already changed, especially around the spring integration.

Presentation around the time of Beta3 for "What's new in Drools 6.0". Note some aspects have already changed, especially around the spring integration.

Statistics

Views

Total Views
1,764
Views on SlideShare
1,764
Embed Views
0

Actions

Likes
3
Downloads
80
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    What's new in Drools 6 - London JBUG 2013 What's new in Drools 6 - London JBUG 2013 Presentation Transcript

    • 1 ● The SkyNet funding bill is passed. ●The system goes online on August 4th, 1997. ●Human decisions are removed from strategic defense. ●SkyNet begins to learn at a geometric rate. ●It becomes self-aware at 2:14am Eastern time, August 29th ●In a panic, they try to pull the plug. ●And, Skynet fights back Mark Proctor Project Lead Monday, 5 August 13
    • Agenda •Quick Intro - What are Rule Based Systems •KIE •5.x Critique •6.0 Improvements •UI •Content •Deployment •Spring and Camel •API •CDI •ScoreCards and PMML •JTMS •Phreak •Legacy Migrations •Backward chaining Example •UberFire 2 Monday, 5 August 13
    • Quick Intro What are Rule Based Systems 3 Monday, 5 August 13
    • 4 Vision Robotics Speech Neural Nets Rule Base Systems/ Expert System Tools Understanding Natural LanguageSome Areas of Artificial Intelligence Some Areas of Artificial Intelligence Monday, 5 August 13
    • 5 Knowledge Representation and Reasoning The study of Knowledge is Epistemology ● Nature Structure and Origins of Knowledge ● Core or AI Rule based systems ● Expert System tools ● Knowledge Representation and Reasoning ● Facilitate the codification of knowledge into a knowledge base which can be used for reasoning Monday, 5 August 13
    • 6 It All Started Here Birth of CDSS Dendral Mycin Baobab Guidon Neomycin Teiresias Emycin WM Puff Sacon Centaur Gravida Wheeze Clot Onccocin 1970s 1980s Monday, 5 August 13
    • 7 Because Not Everyone Is As Smart As He Is Monday, 5 August 13
    • 1979 Rete Algorithm by Charles Forgy 8 Monday, 5 August 13
    • Clips and Jess Clips 1986 9 Clips 1995 Monday, 5 August 13
    • 10 And some day we'll build him!!! Monday, 5 August 13
    • 11 What is a Rule rule <rule_name> <attribute><value> when <conditions> then <actions> end Monday, 5 August 13
    • 12 Pattern Matching Person( age >= 18 ) field name restriction constraintobject type pattern Monday, 5 August 13
    • 13 Two Phase System Monday, 5 August 13
    • 14Classes AccountAccount long accountNo int balance CashFlowCashFlow Date date int amount AccountPeriodAccountPeriod Date start Date end Monday, 5 August 13
    • 15 rule “increase balance for AccountPeriod Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance += $amount; end select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end trigger : acc.balance += cf.amount Credit Cashflow Rule Monday, 5 August 13
    • 16 rule “increase balance for AccountPeriod Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance += $amount; end select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end trigger : acc.balance += cf.amount Credit Cashflow Rule Monday, 5 August 13
    • 17 rule “increase balance for AccountPeriod Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance += $amount; end select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end trigger : acc.balance += cf.amount Credit Cashflow Rule Monday, 5 August 13
    • 18 rule “increase balance for AccountPeriod Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance += $amount; end select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end trigger : acc.balance += cf.amount Credit Cashflow Rule Monday, 5 August 13
    • 19 Rules as a “view” rule "Increase balance for AccountPeriod Credits" when ap : AccountPeriod( ) acc : Account( ) cf : CashFlow( type == CashFlowType.CREDIT, accountNo == acc.accountNo, date >= ap.start && <= ap.end ) then acc.balance = acc.balance + cf.amount; end rule "Decrease balance for AccountPeriod Debits" when ap : AccountPeriod( ) acc : Account( ) cf : CashFlow( type == CashFlowType.DEBIT, accountNo == acc.accountNo, date >= ap.start && <= ap.end ) then acc.balance = acc.balance - cf.amount; end CashFlowCashFlowCashFlowCashFlow date amount type accountNo 12-Jan-12 100 CREDIT 1 2-Feb-12 200 DEBIT 1 18-May-12 50 CREDIT 1 9-May-12 75 CREDIT 1 AccountingPeriodAccountingPeriod start end 01-JAN-2012 31-MAR-2012 AccountAccount accountNo balance 1 0 CashFlowCashFlowCashFlowCashFlow date amount type accountNo 12-Jan-12 100 CREDIT 1 9-May-12 75 CREDIT 1 CashFlowCashFlowCashFlowCashFlow date amount type accountNo 2-Feb-12 200 DEBIT 1 AccountAccount accountNo balance 1 -25 Monday, 5 August 13
    • 20 rule "Print blance for AccountPeriod" salience -50 when ap : AccountPeriod() acc : Account( ) then System.out.println( "Account Number " + acc.accountNo + " balance " + acc.balance ); end Conflict Resolution with Salience AgendaAgendaAgenda 1 increase balance arbitrary 2 decrease balance arbitrary 3 increase balance arbitrary 4 print balance Monday, 5 August 13
    • 21 rule “increase balance for AccountPeriod Credits” ruleflow-group “calculation” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance += $amount; end rule “Print blance for AccountPeriod” ruleflow-group “report” when ap : AccountPeriod() acc : Account( ) then System.out.println( acc.accountNo + “ : “ acc.balance ); end ruleflow-group RuleFlow Monday, 5 August 13
    • 22 Monday, 5 August 13
    • Knowledge Is Everything Platform Changes Overview 23 Monday, 5 August 13
    • KIE - Knowledge Is Everything 24 KIE Drools jBPMOptaPlanner UberFire Guvnor Drools-WB jBPM-WB KIE-WB Monday, 5 August 13
    • GitHub URL: https://github.com/droolsjbpm/ Bootstrap project: https://github.com/droolsjbpm/droolsjbpm-build-bootstrap 25 Monday, 5 August 13
    • GitHub 26 Monday, 5 August 13
    • Changes Conventions: •droolsjbpm -> kie •knowlege -> kie Examples •KnowledgeBase -> Kie •StatefulKnowledgeSession -> KieSession •StatelessKnowledgeSession - StatelesKieSession Legacy API Adapter JAR •Most API’s should work with legacy adapter •KnowledegAgents have not been ported, PKG’s are not longer the unit of deployment DRL has not changed 27 Monday, 5 August 13
    • 5.x Critique 28 Monday, 5 August 13
    • 5.x Critique •UI •Content •Deployment •Utilize 29 Monday, 5 August 13
    • 5.x Critique UI •GWT •but not easily extended •fixed layouts •no perspectives 30 Monday, 5 August 13
    • 5.x Critique Content •JCR •Performance issues •Everything stored as a blob •No tagging, branching etc. •Webdav, with limited Eclipse team provider integration. •Single tree structure (packages) •Packages created project deployment units •no real alignment with industry stadard •No easy rule use (only a single global area) •Loading “model” jars into packages •Poor hack, for dependency management 31 Monday, 5 August 13
    • 5.x Critique 32 Deployment •Simple Snapshot system •No real methodology •Doesn’t align with any industry standards Monday, 5 August 13
    • 5.x Critique Utilize •Progmatic API only •Have to select all resources 33 KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.batch().add( newClassPathResource( "Model.drl", getClass() ), DRL ) .add( newClassPathResource( "Queries.drl", getClass() ), DRL ) .add( newClassPathResource( "General.drl", getClass() ), DRL ) .add( newClassPathResource( "Response.drl", getClass() ), DRL ) .add( newClassPathResource( "Events.drl", getClass() ), DRL ) .add( newClassPathResource( "UiView.drl", getClass() ), DRL ) .add( newClassPathResource( "Commands.drl", getClass() ), DRL ).build(); if ( kbuilder.hasErrors() ) { System.out.println( kbuilder.getErrors().toString() ); System.exit( 1 ); } KieBaseConfiguration kbaseConf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); kbaseConf.setOption( EqualityBehaviorOption.EQUALITY ); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( kbaseConf ); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); Counter c = new Counter(); ksession = kbase.newStatefulKnowledgeSession(); Monday, 5 August 13
    • 6.0 UI Improvements 34 Monday, 5 August 13
    • 6.0 UI UI •Modular •Extensible 35 •Dynamic and Flexible layouts •Perspectives UF Monday, 5 August 13
    • Video UI Overview https://www.youtube.com/watch?v=ckAznbOOV-4 36 Monday, 5 August 13
    • 6.0 UI 38 Monday, 5 August 13
    • 6.0 UI Content and Authoring Improvements 39 Monday, 5 August 13
    • 6.0 Content •GIT •Industry standard tooling •Multiple repositories and projects •All projects are Maven multi-module projects •Projects can be shared, via pom dependencies •Both Kie projects, and any other maven jar •Local Maven repository management for model jars 40 Monday, 5 August 13
    • 6.0 Content Simple POM Editor 41 Monday, 5 August 13
    • 6.0 Content Build And Deploy 42 Monday, 5 August 13
    • 6.0 Content Local Maven repository and manager 43 Monday, 5 August 13
    • Video Maven, Builder an Deploy https://www.youtube.com/watch?v=ckAznbOOV-4 44 Monday, 5 August 13
    • 6.0 Content Create or Clone Git Repositories 46 Monday, 5 August 13
    • 6.0 Deployment Improvements 47 Monday, 5 August 13
    • 6.0 Deployment 48 Deployment •Maven JARS •All projects are just maven projects •All projects compile to JARS •JARS are installed to local M2_REPO, which is expose on http •Can “deploy” to external repos. •Uses Maven industry methdologies Monday, 5 August 13
    • 6.0 Utilization Improvemets 49 Monday, 5 August 13
    • KieModules •Discovery •META-INF/kmodule.xml •Convention based •No programmatic api for building •Multiple Named entities •Inheritence of Resources •Defaults for lazy people •Version built in a standard 50 Monday, 5 August 13
    • Git Hub Examples https://github.com/droolsjbpm/drools/tree/master/drools-examples-api 51 Monday, 5 August 13
    • KieModules Defaults and JAR on Classpath •Creates one KieBase, adds all resources from that JAR •See kmodule.xsd in kie-api jar 52 <kmodule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://jboss.org/kie/6.0.0/kmodule"> </kmodule> KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession(); kSession.setGlobal("out", out); kSession.insert(new Message("Dave", "Hello, HAL. Do you read me, HAL?")); kSession.fireAllRules(); Monday, 5 August 13
    • 53 Monday, 5 August 13
    • KieModules Named Entities and JAR on Classpath •Creates one KieBase •Includes resources from package matching kbase name 54 <kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"> <kbase name="namedkiesession"> <ksession name="ksession1"/> </kbase> </kmodule> KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession("ksession1"); kSession.setGlobal("out", out); kSession.insert(new Message("Dave", "Hello, HAL. Do you read me, HAL?")); kSession.fireAllRules(); Monday, 5 August 13
    • 55 Monday, 5 August 13
    • KieModules Named Entities, with inheritence and JAR on Classpath •Two projects, one “includes” from the other 56 <dependency> <groupId>org.drools</groupId> <artifactId>named-kiesession</artifactId> <version>6.0.0-SNAPSHOT</version> </dependency> <kbase name="kiebaseinclusion" includes="namedkiebase"> <ksession name="ksession2"/> </kbase> KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession("ksession2"); kSession.setGlobal("out", out); kSession.insert(new Message("Dave", "Hello, HAL. Do you read me, HAL?")); kSession.fireAllRules(); kSession.insert(new Message("Dave", "Open the pod bay doors, HAL.")); kSession.fireAllRules(); Monday, 5 August 13
    • KieModules Package location can over-ride kbase name defaults 57 <kbase name="WumpusMainKB" packages="org.drools.games.wumpus.server, org.drools.games.wumpus.server.view"> <ksession name="WumpusMainKS" /> </kbase> <kbase name="WumpusClientKB" packages="org.drools.games.wumpus.client"> <ksession name="WumpusClientKS"/> </kbase> KieContainer kc = KieServices.Factory.get().getKieClasspathContainer(); final KieSession serverKsession = kc.newKieSession( "WumpusMainKS"); final KieSession clientKsession = kc.newKieSession("WumpusClientKS"); Monday, 5 August 13
    • Dynamic KieModules •JARs can be loaded from URLs into KieRepository •Once loaded they can be resolved via ReleaseId 58 KieServices ks = KieServices.Factory.get(); KieRepository kr = ks.getRepository(); KieModule kModule = kr.addKieModule(ks.getResources().newFileSystemResource( getFile("default-kiesession"))); KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId()); KieSession kSession = kContainer.newKieSession(); kSession.setGlobal("out", out); Object msg1 = createMessage(kContainer, "Dave", "Hello, HAL. Do you read me, HAL?"); kSession.insert(msg1); kSession.fireAllRules(); Monday, 5 August 13
    • Dynamic KieModules kie-ci use embedded maven for remote discovery 59 <dependency> <groupId>org.kie</groupId> <artifactId>kie-ci</artifactId> </dependency> KieServices ks = KieServices.Factory.get(); // Install example1 in the local maven repo before to do this KieContainer kContainer = ks.newKieContainer( ks.newReleaseId("org.drools", "named-kiesession", "6.0.0-SNAPSHOT")); KieSession kSession = kContainer.newKieSession("ksession1"); kSession.setGlobal("out", out); Object msg1 = createMessage(kContainer, "Dave", "Hello, HAL. Do you read me, HAL?"); kSession.insert(msg1); kSession.fireAllRules(); Monday, 5 August 13
    • Dynamic Modules •Kie-CI and Automatic updates with KieScanner •Replaces KnowledgeAgent •Mave resolves new artifacts dynamically at runtime •SNAPSHOT, LATEST, STABLE and version ranges supported •See KieRepositoryScannerTest 60 KieServices ks = KieServices.Factory.get(); ReleaseId releaseId = ks.newReleaseId("org.kie", "scanner-test", "1.0-SNAPSHOT"); InternalKieModule kJar1 = createKieJar(ks, releaseId, "rule1", "rule2"); KieContainer kieContainer = ks.newKieContainer(releaseId); MavenRepository repository = getMavenRepository(); repository.deployArtifact(releaseId, kJar1, kPom); // create a ksesion and check it works as expected KieSession ksession = kieContainer.newKieSession("KSession1"); checkKSession(ksession, "rule1", "rule2"); Monday, 5 August 13
    • Dynamic Modules 61 // create a new kjar InternalKieModule kJar2 = createKieJar(ks, releaseId, "rule2", "rule3"); // deploy it on maven repository.deployArtifact(releaseId, kJar2, kPom); // since I am not calling start() on the scanner it means it won't have automatic scheduled scanning KieScanner scanner = ks.newKieScanner(kieContainer); // scan the maven repo to get the new kjar version and deploy it on the kcontainer scanner.scanNow(); // create a ksesion and check it works as expected KieSession ksession2 = kieContainer.newKieSession("KSession1"); checkKSession(ksession2, "rule2", "rule3"); Monday, 5 August 13
    • Programmatic API •Builder API, for tooling integration •Incremental compilation, and problem reporting 62 KieServices ks = KieServices.Factory.get(); KieRepository kr = ks.getRepository(); KieFileSystem kfs = ks.newKieFileSystem(); kfs.write("src/main/resources/org/kie/example5/HAL5.drl", getRule()); KieBuilder kb = ks.newKieBuilder(kfs); kb.buildAll(); // kieModule is automatically deployed to KieRepository if successfully built. if (kb.getResults().hasMessages(Level.ERROR)) { throw new RuntimeException("Build Errors:n" + kb.getResults().toString()); } KieContainer kContainer = ks.newKieContainer(kr.getDefaultReleaseId()); KieSession kSession = kContainer.newKieSession(); kSession.setGlobal("out", out); kSession.insert(new Message("Dave", "Hello, HAL. Do you read me, HAL?")); kSession.fireAllRules(); Monday, 5 August 13
    • kmodule.xml Editor 63 Monday, 5 August 13
    • 6.0 Spring Camel 64 Monday, 5 August 13
    • Spring and Camel 65 Monday, 5 August 13
    • Spring and Camel 66 Monday, 5 August 13
    • Spring and Camel 67 Monday, 5 August 13
    • Spring and Camel 68 Monday, 5 August 13
    • 6.0 CDI 69 Monday, 5 August 13
    • CDI Context and Dependency Injection CDI injects named entities from the kmodule.xml Injectable types •KieServices •KieContainer •KieBase •KieSession •StatelessKieSession 70 Monday, 5 August 13
    • KieContainer 71 @Inject private KieContainer kContainer; @Inject @KReleaseId(groupId = "jar1", artifactId = "art1", version = "1.1") private KieContainer kContainerv11; Monday, 5 August 13
    • KBase 72 @Inject @KBase(value="jar1.KBase1", name="kb2") @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.0") private KieBase jar1KBase1kb2; @Inject @KBase(value="jar1.KBase1", name="kb2") @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.0") private KieBase jar1KBase1kb22; @Inject private KieBase defaultClassPathKBase; @Inject @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.0") private KieBase defaultDynamicKBase; @Inject @KBase("jar1.KBase1") @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.0") private KieBase jar1KBase1v10; @Inject @KBase("jar1.KBase1") @KReleaseId(groupId = "jar1", artifactId = "art1", version = "1.1") private KieBase jar1KBase1v11; @Inject @KBase(value="jar1.KBase1", name="kb1") @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.0") private KieBase jar1KBase1kb1; Monday, 5 August 13
    • KSession 73 @Inject private KieSession defaultClassPathKSession; @Inject @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.0") private KieSession defaultDynamicKSession; Monday, 5 August 13
    • KSession 74 @Inject @KSession("jar1.KSession2") @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.0" ) private KieSession kbase1ksession2v10; @Inject @KSession("jar1.KSession2") @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.1" ) private KieSession kbase1ksession2v11; @Inject @KSession(value="jar1.KSession2", name="ks1") @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.0" ) private KieSession kbase1ksession2ks1; @Inject @KSession(value="jar1.KSession2", name="ks2") @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.0" ) private KieSession kbase1ksession2ks2 ; @Inject @KSession(value="jar1.KSession2", name="ks2") @KReleaseId( groupId = "jar1", artifactId = "art1", version = "1.0" ) private KieSession kbase1ksession2ks22; Monday, 5 August 13
    • 6.0 Score Cards 75 Monday, 5 August 13
    • Score Cards a) Setup Parameters b) Characteristic Section 76 Monday, 5 August 13
    • Score Cards 77 •UI Generates PMML •DRL Generated from PMML •DRL results in •Calculated Score •Ranked Reason Codes •Can import PMML 4.1 •but not exposed yet •Calculated Scores •Currently Summations •Weight coming •Not in PMML standard Monday, 5 August 13
    • 6.0 JTMS 78 Monday, 5 August 13
    • Justification-based Truth Maintenace JTMS Drools 5.x •Simple logical insertion TMS, like Clips, Jess and others. •Drools 6.0 •Contradiction handling with JTMS •Clean separation of exception logic •TMS now has pluggable Belief System •Simple TMS support •JTMS now possible. •Defeasible Logic soon •See drools-compiler •JTMSTest for lots of example tests •https://github.com/droolsjbpm/drools/blob/master/drools-compiler/ src/test/java/org/drools/compiler/beliefsystem/jtms/ JTMSTest.java 79 Monday, 5 August 13
    • 80 JTMS rule "Issue Child Bus Pass" when $p : Person( age < 16 ) then insert(new ChildBusPass( $p ) ); end rule "Issue Adult Bus Pass" when $p : Person( age >= 16 ) then insert(new AdultBusPass( $p ) ); end Couples the logic What happens when the Child stops being 16? Monday, 5 August 13
    • 81 JTMS •Bad •Monolithic •Leaky •Brittle integrity - manual maintenance Monday, 5 August 13
    • 82 JTMS •A rule “logically” inserts an object •When the rule is no longer true, the object is retracted. rule "IsChild" when $p : Person( age < 16 ) then logicalInsert( new IsChild( $p ) ) end rule "IsAdult" when $p : Person( age >= 16 ) then logicalInsert( new IsAdult( $p ) ) end de-couples the logic Maintains the truth by automatically retracting Monday, 5 August 13
    • 83 JTMS rule "Issue Child Bus Pass" when $p : Person( ) IsChild( person =$p ) then logicalInsert(new ChildBusPass( $p ) ); end rule "Issue Adult Bus Pass" when $p : Person() IsAdult( person =$p ) then logicalInsert(new AdultBusPass( $p ) ); end The truth maintenance cascades Monday, 5 August 13
    • 84 JTMS rule "Issue Child Bus Pass" when $p : Person( ) not( ChildBusPass( person == $p ) ) then requestChildBusPass( $p ); end The truth maintenance cascades Monday, 5 August 13
    • 85 JTMS • Good • De-couple knowledge responsibilities • Encapsulate knowledge • Provide semantic abstractions for those encapsulation • Integrity robustness – truth maintenance Monday, 5 August 13
    • JTMS 86 IsChild ChildBusPas Rule : isChildRule Rule : IssueBusPas + + Monday, 5 August 13
    • JTMS 87 rule "Do not issue to banned people" when $p : Person( ) Banned( person =$p ) then logicalInsert(new ChildBusPass( $p ) , “neg” ); end Monday, 5 August 13
    • JTMS 88 IsChild ChildBusPas Rule : isChildRule Rule : IssueBusPas + + Rule : Do Not Issue to Banned People - Monday, 5 August 13
    • R.I.P RETE inspirations: •Leaps, Collection Oriented Match, L/R Unlinking New Innovations •Full Rule, and Rule Segment Unlinking •Lazy Evaluation, with Rule scoping •Set propagations Previous Innovations •Modify In Place •Property Reactive •Tree Based Graphs •Subnetwork support 89 Monday, 5 August 13
    • 6.0 Legacy and Backwards Compatability 90 Monday, 5 August 13
    • Legacy Systems and Migration Legacy API Adapter JAR •Most API’s should work with legacy adapter •KnowledegAgents have not been ported, PKG’s are not longer the unit of deployment JCR Migration Tool •Command Line Java code •Each Package maps to a GIT project 91 Monday, 5 August 13
    • Backward Chaining Re-introducing an Advanced Feature Detailed Tutorial here: https://www.youtube.com/watch?v=fCjIRVSRFvA 92 Monday, 5 August 13
    • 93 Backward Chaining query isChild( Person p ) $p := Person( age <= 16 ) end rule "Issue Child Bus Pass" when $p : Person( ) isChild( $p; ) then logicalInsert(new ChildBusPass( $p ) ); end Monday, 5 August 13
    • 94 Reasoning with Graphs House Location("Office", "House ") Location("Kitchen", "House") Location("Desk", "Office") Location("Chair", "Office") Location("Computer", "Desk") Location("Draw", "Desk") Location("Knife", "Kitchen") Location("Cheese", "Kitchen") Location("Key", "Draw") Monday, 5 August 13
    • 95 Backward Chaining query isContainedIn( String x, String y ) Location( x, y; ) or ( Location( z, y; ) and isContainedIn( x, z; ) ) end House Location("Office", "House ") Location("Kitchen", "House") Location("Desk", "Office") Location("Chair", "Office") Location("Computer", "Desk") Location("Draw", "Desk") Location("Knife", "Kitchen") Location("Cheese", "Kitchen") Location("Key", "Draw") Monday, 5 August 13
    • Backward Chaining 96 ksession.insert( new Location("Office", "House") ); ksession.insert( new Location("Kitchen", "House") ); ksession.insert( new Location("Knife", "Kitchen") ); ksession.insert( new Location("Cheese", "Kitchen") ); ksession.insert( new Location("Desk", "Office") ); ksession.insert( new Location("Chair", "Office") ); ksession.insert( new Location("Computer", "Desk") ); ksession.insert( new Location("Draw", "Desk") ); House Location("Office", "House ") Location("Kitchen", "House") Location("Desk", "Office") Location("Chair", "Office") Location("Computer", "Desk") Location("Draw", "Desk") Location("Knife", "Kitchen") Location("Cheese", "Kitchen") Location("Key", "Draw") Monday, 5 August 13
    • Backward Chaining 97 rule "go1" when String( this == "go1" ) isContainedIn("Office", "House"; ) then System.out.println( "office is in the house" ); end rule "go" salience 10 when $s : String( ) then System.out.println( $s ); end ksession.insert( "go1" ); ksession.fireAllRules(); --- go1 office is in the house query isContainedIn( String x, String y ) Location( x, y; ) or ( Location( z, y; ) and isContainedIn( x, z; ) ) end Does not recurse. Finds Location(“Office, House”) on first call. House Location("Office", "House ") Location("Kitchen", "House") Location("Desk", "Office") Location("Chair", "Office") Location("Computer", "Desk") Location("Draw", "Desk") Location("Knife", "Kitchen") Location("Cheese", "Kitchen") Location("Key", "Draw") Monday, 5 August 13
    • Backward Chaining 98 rule "go2" when String( this == "go2" ) isContainedIn("Draw", "House"; ) then System.out.println( "Draw in the House" ); end ksession.insert( "go2" ); ksession.fireAllRules(); --- go2 Desk in the House query isContainedIn( String x, String y ) Location( x, y; ) or ( Location( z, y; ) and isContainedIn( x, z; ) ) end Recursive 3 times, note the Z. Location( “Office”, “House”) Location( “Desk”, “Office”) Location( “Draw”, “Desk”) Out Var (unbound) In Var (bound) House Location("Office", "House ") Location("Kitchen", "House") Location("Desk", "Office") Location("Chair", "Office") Location("Computer", "Desk") Location("Draw", "Desk") Location("Knife", "Kitchen") Location("Cheese", "Kitchen") Location("Key", "Draw") Monday, 5 August 13
    • Backward Chaining 99 rule "go3" when String( this == "go3" ) isContainedIn("Key", "Office"; ) then System.out.println( "Key in the Office" ); end ksession.insert( "go3" ); ksession.fireAllRules(); --- go3 ksession.insert( new Location("Key", "Draw") ); ksession.fireAllRules(); --- Key in the Office Nothing returned. There is no key at any point below Office. But the query stays open and reactive. Key Inserted 3 levels below, but system detects, reacts and bubbles up the results. House Location("Office", "House ") Location("Kitchen", "House") Location("Desk", "Office") Location("Chair", "Office") Location("Computer", "Desk") Location("Draw", "Desk") Location("Knife", "Kitchen") Location("Cheese", "Kitchen") Location("Key", "Draw") Monday, 5 August 13
    • Backward Chaining 100 rule "go4" when String( this == "go4" ) isContainedIn(thing, "Office"; ) then System.out.println( "thing " + thing + " is in the Office" ); end ksession.insert( "go4" ); ksession.fireAllRules(); --- go4 thing Key is in the Office thing Computer is in the Office thing Draw is in the Office thing Desk is in the Office thing Chair is in the Office Finds all Things in the office, but directly and transitively. Out Var (unbound) House Location("Office", "House ") Location("Kitchen", "House") Location("Desk", "Office") Location("Chair", "Office") Location("Computer", "Desk") Location("Draw", "Desk") Location("Knife", "Kitchen") Location("Cheese", "Kitchen") Location("Key", "Draw") Monday, 5 August 13
    • Backward Chaining 101 rule "go5" when String( this == "go5" ) isContainedIn(thing, location; ) then System.out.println( "thing " + thing + " is in " + location ); end ksession.insert( "go5" ); ksession.fireAllRules(); --- go5 thing Knife is in House thing Cheese is in House thing Key is in House thing Computer is in House thing Draw is in House thing Desk is in House thing Chair is in House thing Key is in Office thing Computer is in Office thing Draw is in Office thing Key is in Desk thing Office is in House Find all things in all things. Out Var (unbound) Out Var (unbound) thing Computer is in Desk thing Knife is in Kitchen thing Cheese is in Kitchen thing Kitchen is in House thing Key is in Draw thing Draw is in Desk thing Desk is in Office thing Chair is in Office House Location("Office", "House ") Location("Kitchen", "House") Location("Desk", "Office") Location("Chair", "Office") Location("Computer", "Desk") Location("Draw", "Desk") Location("Knife", "Kitchen") Location("Cheese", "Kitchen") Location("Key", "Draw") Monday, 5 August 13
    • 102 UF UberFirehttps://www.youtube.com/watch?v=ckAznbOOV-4 Monday, 5 August 13
    • 103 Features • Compile time composition of plugins • modular components, each separate maven module. • Lightweight • Decoupled components • Layout Manager and Perspectives • Embeddable/Reusable (*) • Unified API • Security • I/O • VFS • Metadata • Menus, Toolbars, Panels, etc. • Standard Life Cycle UF UberFire Monday, 5 August 13
    • UberFire 104 @Dependent @WorkbenchScreen(identifier = "MyFirstPanel") public class MyFirstPanel { private final FlowPanel panel = new FlowPanel(); @PostConstruct private void init() { final Label label = new Label(); label.setText("Hello World!"); panel.add(label); } @WorkbenchPartTitle public String myTitle() { return "My First and Cool Panel!"; } @WorkbenchPartView public IsWidget getView() { return panel; } } Monday, 5 August 13
    • Proof is in the Pudding •UI Rewrite started in November •Entire BRMS ported •New BPMS built, all integrated •Tasks, Calendars, BPM Designer •Only one person on core UI framework •All team memebers distributed •Despite aggressive schedule •Code remains modular •Easy to maintan and extend •No one is complaining yet :) 105 UF UberFire Monday, 5 August 13
    • 106 Questions?Questions? • Dave Bowman: All right, HAL; I'll go in through the emergency airlock. • HAL: Without your space helmet, Dave, you're going to find that rather difficult. • Dave Bowman: HAL, I won't argue with you anymore! Open the doors! • HAL: Dave, this conversation can serve no purpose anymore. Goodbye. Joshya: Greetings, Professor Falken. Falken: Hello, Joshua. Joshya: A strange game. The only winning move is not to play. How about a nice game of chess? Monday, 5 August 13