Monday, December 22, 2008

Devoxx and ORF 2008 presentations

Devoxx 2008
Declarative Programming with Rules, Workflow and Event Processing (Part I) - Mark Proctor
Declarative Programming with Rules, Workflow and Event Processing (Part II) - Kris Verlaenen

ORF 2008
Declarative Programming with Rules, Workflow and Event Processing - Mark Proctor
Extending Rete for Complex EventProcessing - Edson Tirelli
Share/Bookmark

Drools 5.0 M3/M4 New and Noteworthy Release Summary

Previous New and Noteworth release summary notes:
M1
M2

Drools Guvnor

  • Category rules allows you to set 'parent rules' for a category. Any rules appearing in the given category will 'extend' the rule specified - ie inherit the conditions/LHS. The base rule for the category can be set on package configuration tab. RHS is not inherited, only the LHS
  • Scenario runner detects infinite loops
  • Scenario runner can show event trace that was recorded by audit logger

  • DSL sentences in guided editor can now be set to show enums as a dropdown, dates as a date picker, booleans as a checkbox and use regular expressions to validate the inputs (DSL Widgets in Guvnor)
  • Status can be created, renamed and deleted
  • Functions can be edited with text editor

Drools API

Drools now has complete api/implementation separation that is no longer rules oriented. This is an important strategy as we move to support other forms of logic, such as workflow and event processing. The main change is that we are now knowledge oriented, instead of rule oriented. The module drools-api provide the interfaces and factories and we have made pains to provide much better javadocs, with lots of code snippets, than we did before. Drools-api also helps clearly show what is intended as a user api and what is just an engine api, drools-core and drools-compiler did not make this clear enough.

The most common interfaces you will use are:

  • org.drools.builder.KnowledgeBuilder
  • org.drools.KnowledgeBase
  • org.drools.agent.KnowledgeAgent
  • org.drools.runtime.StatefulKnowledgeSession
  • org.drools.runtime.StatelessKnowledgeSession

Factory classes, with static methods, provide instances of the above interfaces. A pluggable provider approach is used to allow provider implementations to be wired up to the factories at runtime. The Factories you will most commonly used are:

  • org.drools.builder.KnowledgeBuilderFactory
  • org.drools.io.ResourceFactory
  • org.drools.KnowledgeBaseFactory
  • org.drools.agent.KnowledgeAgentFactory

A Typical example to load a rule resource:

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newUrlResource( url ),
ResourceType.DRL );
if ( kbuilder.hasErrors() ) {
System.err.println( builder.getErrors().toString() );
}

KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( builder.getKnowledgePackages() );

StatefulKnowledgeSession ksession = knowledgeBase.newStatefulKnowledgeSession();
ksession.insert( new Fibonacci( 10 ) );
ksession.fireAllRules();

ksession.dispose();

A Typical example to load a process resource. Notice the ResourceType is changed, in accordance with the Resource type:

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newUrlResource( url ),
ResourceType.DRF );
if ( kbuilder.hasErrors() ) {
System.err.println( builder.getErrors().toString() );
}

KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( builder.getKnowledgePackages() );

StatefulKnowledgeSession ksession = knowledgeBase.newStatefulKnowledgeSession();
ksession.startProcess( "Buy Order Process" );

ksession.dispose();

'kbuilder', 'kbase', 'ksession' are the variable identifiers often used, the k prefix is for 'knowledge'.

We have uniformed how decision trees are loaded, and they are now consistent with no need to pre generate the DRL with the spreadsheet compiler:

DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration();
dtconf.setInputType( DecisionTableInputType.XLS );
dtconf.setWorksheetName( "Tables_2" );
kbuilder.add( ResourceFactory.newUrlResource( "file://IntegrationExampleTest.xls" ),
ResourceType.DTABLE,
dtconf );

It is also possible to configure a KnowledgeBase using configuration, via a xml change set, instead of programmatically. Here is a simple change set:

<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set change-set-5.0.xsd' >
<add>
<resource source='classpath:org/domain/someRules.drl' type='DRL' />
<resource source='classpath:org/domain/aFlow.drf' type='DRF' />
</add>
</change-set>

And it is added just like any other ResourceType

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newUrlResource( url ),
ResourceType.ChangeSet );
The other big change for the KnowledgeAgent, compared to the RuleAgent, is that polling scanner is now a service. further to this there is an abstraction between the agent notification and the resource monitoring, to allow other mechanisms to be used other than polling. These services currently are not started by default, to start them do the following:
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
There are two new interfaces added, ResourceChangeNotifier and ResourceChangeMonitor. KnowlegeAgents subscribe for resource change notifications using the ResourceChangeNotifier implementation. The ResourceChangeNotifier is informed of resource changes by the added ResourceChangeMonitors. We currently only provide one out of the box monitor, ResourceChangeScannerService, which polls resources for changes. However the api is there for users to add their own monitors, and thus use a push based monitor such as JMS.
ResourceFactory.getResourceChangeNotifierService().addResourceChangeMonitor( myJmsMonitor);
StatelessKnowledgeSessions now support in, inout and out parameters, as apposed to the GlobalExporter:
Parameters parameters = session.newParameters();
Map globalsIn = new HashMap();
globalsIn.put( "inString", "string" );
parameters.getGlobalParams().setIn( globalsIn );
parameters.getGlobalParams().setOut( Arrays.asList( new String[]{"list"} ) );

Map factIn = new HashMap();
factIn.put( "inCheese", cheddar );
parameters.getFactParams().setIn( factIn );
parameters.getFactParams().setOut( Arrays.asList( new String[]{ "outCheese"} ) );

StatelessKnowledgeSessionResults results = session.executeObjectWithParameters( collection, // these facts are anonymous
parameters );

Drools Fusion

Event Garbage Collection
Since events usually have strong temporal relationships, it is possible to infer a logical time window when events can possibly match. The engine uses that capability to calculate when an event is no longer capable of matching any rule anymore and automatically retracts that event.

Time Units Support
Drools adopted a simplified syntax for time units, based on the ISO 8601 syntax for durations. This allows users to easily add temporal constraints to the rules writing time in well known units. Example:
SomeEvent( this after[1m,1h30m] $anotherEvent )

The above pattern will match if SomeEvent happens between 1 minute (1m) and 1 hour and 30 minutes after $anotherEvent.

Drools Flow

The Drools Flow framework has been further extended with the following features:
  • Process instances can now listen for external events by marking the event node property "external" as true. External events are signaled to the engine using
    session.signalEvent(type, eventData)
    More information on how to use events inside your processes can be found in the Drools Flow documentation here: https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html/ch03.html#d0e917
  • Process instances are now safe for multi-threading (as multiple thread are blocked from working on the same process instance)
  • Process persistence / transaction support has been further improved. Check out the drools-process/drools-process-enterprise project for more information.
  • The human task component has been extended to support all kinds of data for input / output / exceptions during task execution. As a result, the life cycle methods of the task client have been extended to allow content data:
    taskClient.addTask(task, contentData, responseHandler)
    taskClient.complete(taskId, userId, outputData,responseHandler)
    taskFail.complete(taskId, userId, outputData,responseHandler)

    long contentId = task.getTaskData().getDocumentContentId();
    taskClient.getContent(contentId, responseHandler);
    ContentData content = responseHandler.getContent();
  • It is now possible to migrate old Drools4 RuleFlows (using the xstream format) to Drools5 processes (using readable xml) during compilation. Migration will automatically be performed when adding the RuleFlow to the KnowledgeBase when the following system property is set:
    drools.ruleflow.port = true
  • The "Transform" work item allows you to easily transform data from one format to another inside processes. The code and an example can be found in the drools-process/drools-workitems directory.
  • Function imports are now also supported inside processes.

Eclipse IDE

The Drools Eclipse Plugin contains the following improvements
  • Support multiple runtimes: The IDE now supports multiple runtimes. A Drools runtime is a collection of jars on your file system that represent one specific release of the Drools project jars. To create a runtime, you must either point the IDE to the release of your choice, or you can simply create a new runtime on your file system from the jars included in the Drools Eclipse plugin. Drools runtimes can be configured by opening up the Eclipse preferences and selecting the Drools -> Installed Drools Runtimes category, as shown below.


  • Debugging of rules using the MVEL dialect has been fixed
  • Drools Flow Editor
    • Process Skins allow you to define how the different RuleFlow nodes are visualized. We now support two skins: the default one which existed before and a BPMN skin that visualizes the nodes using a BPMN-like representation: http://blog.athico.com/2008/10/drools-flow-and-bpmn.html
    • An (X)OR split now shows the name of the constraint as the connection label
    • Custom work item editors now signal the process correctly that it has been changed

Share/Bookmark

Drools sighting - a client side app

Well its been out of fashion for a long time, but for some purposes a client side app is really the only answer !

Interestingly someone pointed out to me the Australian Tax Offices "eSAT" application (a multi-platform multi-lingual application for accountants) uses drools - and its a client side app !

This is an application that is distributed to about 12 000 accounting professionals (it has an offline and online component) related to superannuation (that's like 401k - retirement savings):

Interestingly, they use pre-compiled rules (being finance and government related, they tend to use a fair few rules !) - and only distribute the "runtime" as part of the app. One of the key constraints of this application is that it had to fit within a certain download size (so every dependency had to be analysed to see if it was really needed).

So there you go, client side apps are still around - and this one by Cordelta looks like a pretty good one when I tried it on my mac (they have distros for all platforms).

The ATO site where the app came from is here.
Share/Bookmark

Friday, December 05, 2008

Drools at Devoxx

Kris and myself will be at Devoxx next week, we will be co-presenting the University session "Declarative programming with Rules, Workflow and Event Processing".


Monday the 8th of Dec, 09.30, room 7.
Share/Bookmark

Monday, December 01, 2008

Fluent Process API

A recent addition to Drools Flow allows users to create processes using what could be called a "fluent API". While it has always been possible to create processes using our graphical editor or the underlying XML, we do acknowledge that some people simply prefer creating process definitions using an API. The underlying example shows how easy it is now to create a simple "Hello World" example process using this API:

RuleFlowProcessFactory factory =
RuleFlowProcessFactory.createProcess("org.drools.process");
factory
// header
.name("My process").packageName("org.drools")
// nodes
.startNode(1).name("Start").done()
.actionNode(2).name("Action")
.action("java", "System.out.println(\"Hello World\");").done()
.endNode(3).name("End").done()
// connections
.connection(1, 2)
.connection(2, 3);
RuleFlowProcess process = factory.validate().getProcess();

Many thanks go out to salaboy for doing a large part of the work and adding the different factories to create the various types of nodes supported in RuleFlow. This also shows how easy it is to contribute to the Drools project if you want to: come join us at our #drools irc channel, describe what you want to do and we'll help you as much as possible and welcome contributions !

Kris
Share/Bookmark

Open Source Developers Conference - Sydney

Michael (that's me !) is speaking at the OSDC conference in Sydney this week (Wednesday morning to be precise).


OSDC is a community organised conference for open source developers (and end users/organisations). It has a fairly technical focus, and lots of jokes/fun (the lightning talks are usually quite amazing).
Share/Bookmark

Wednesday, November 26, 2008

Drools Live Documentation

Hudson, our continuous build server, now outputs our full documentation and javadocs with new summary pages for easy navigation. So now as we improve the docs, ready for Drools 5.0 final, you can see things as they change:
Documentation
JavaDocs
Share/Bookmark

Monday, November 24, 2008

Whats new in Drools 5 video and Q&A session

Last week (very late night my time) we had a "webex" online seminar talking about what is new in Drools 5, followed by a question and answer session.



Drools 5 Whats New from Michael Neale on Vimeo.

(You can also access the original webex video here - which has all the slides and some answers etc - you will need to download the free webex client however). Apologies: there is a blacked out bit around 10 mins in, I will see if I can correct it (its not that its showing anything secret - I promise !)

UPDATE: There was a higher fidelity quicktime one - but I burnt through the 2 gig monthly limit in hours (whoops - I totally forgot to read the fine print !). If people want the hi-fi one, I will make it available on another link. I forgot quite a few people read this !



Q&A following is most of the questions (with answers !) to the viewers that were online at the time:

_________________________________________________________________

Q: How is Drools Flow different from jBPM?

A: A different approach - behavioural modelling, event driven, integrated and mixed with rules. Process model is continually emitting events for the rules to consume. Same API (as rules).

_________________________________________________________________

Q: Drools5 is currently in MR2 phase. What is the planned GA date for Drools 5?

A: M3 will be out today - a candidate release is expected in the first week of December, shortly followed by "GA" unless major issues are found.
_________________________________________________________________


Q: For long-running processes involving human tasks, how is the state of the process/flow persisted?

A: Various approaches available - database via hibernate for instance, file system, all intended for high performance. Working Memories are now transactional and persistable (JPA is also an option).
_________________________________________________________________


Q: While you have "Flow" worklow as part of your solution, can the rules engine work with other BPM/workflow applications (e.g. Microsoft Sharepoint MOSS)

A: Certainly. You can use just rules, no issue. In that specific case with heterogenous environment, you could access the rules as a service via XML or JSON (drools-server) from the SharePoint side (or you could use the ESB, many options). You only need to use what you need for your specific project, it is not monolithic.
_________________________________________________________________


Q: Are there plans to integrate with Netbeans?

A: Eclipse is the developer tooling platform we target currently, however there have been informal chats with Netbeans people on this, but nothing concrete at this point in time. Ideally someone from the community will get involved with this, which would set a clear direction (that is how the Eclipse one started a few years ago).
_________________________________________________________________


Q: I am fairly new to DROOLS. can I hookup my Eclipse IDE with Guvnor?

A: Yes. There is a plug in which lets you explore artifacts in Guvnor. You can also browse the web GUI from within your IDE with this plug in.
_________________________________________________________________


Q: Does the new Asym Rete reduce Memory usage?

A: In some cases (a high end logistics user has reported some reduction in memory usages for very large heaps). For some smaller cases there may not be a noticable difference. The key difference is that fact objects do not need to be "shadowed" - this means the state of the facts does not have to be copied (obviously for large numbers of facts this reduces memory and increases speed).
_________________________________________________________________


Q: We saw Dynamic Fact model - does this mean for a change in the fact model, we dont have to build and redeploy the rules?

A: If you are making a change to the fact model - you will need to redeploy the rules if you want to use the new fields in the fact model (obviously !). The dynamic fact model is deployed along with the rules.
_________________________________________________________________


Q: Can a model be supplied from an external datasource?

A: A declarative model is "drl" source code - so it can come from any source, but must be available at rule "compile" time. But the data to populate the model instances (facts) - certainly !
_________________________________________________________________


Q: How is the associated pojo/class created and accessed when the model is defined from within Guvnor?

A: Using a reflection-like API (you can also use your own bean-mapping tools - as behind the scenes it is a class that follows the java bean pattern).
_________________________________________________________________


Q: any plans to support an API-based approach to create rules? (instead of drl file based)

A: There are several APIs that are used internally to generate rules (and there is the AST directly) - but there is no plan to have the "old" style "pojo rules" which can't easily cope with higher order logic which is common in a rule language.
_________________________________________________________________


Q: In BRMS 5.0.0.M1, I used to have an "upload" button to add DSL (just like I can upload Model jars). It was removed to just a copy/paste textarea in 5.0.0.M2. Why?

A: This was actually a mistake in M1 - it was always a text area (an additional upload may be provided in future if enough people want it).
_________________________________________________________________


Q: Can the enumarations be picked from a database?

A: Yes they can. An MVEL (expression language) expression can retrieve the lists via JDBC or any other means you choose.
_________________________________________________________________


Q: Is seamless integration with a BPM still possible and Drools 5 can be used just as a rules engine with BRMS (we would not need the Modeling and Processing as we need to integrate with our BPM).

A: Yes - as mentioned before, its totally modular and most features are optional (you only use what you need).
_________________________________________________________________

Q: When using the guided rule editor, what happens when you type a letter in an integer variable field? When is validation done? Also, will there be a date picker for date variable fields?

A: It will not allow you to enter invalid characters. Date picker is not available in that editor yet.
_________________________________________________________________

Q: When defining a fact model object as an analyst, types like "Integer, Boolean, Float" don't make sense to me. Will they be defined or renamed so analysts can understand what they stand for?

A: No reason - a bug has been raised to ensure this is corrected.
_________________________________________________________________


Q: Are java 5+ "Enums" supported in Guvnor for drop-down choices in web decision tables *and* in guided rule editor variable selection?

A: No, not at this stage.
_________________________________________________________________

Q: Can security integrate with other authentication/authorization sources such as LDAP/AD?

A: Yes - JAAS is used (via Seam). Coarse grained authorization (admin users) as well as Authentication can work with LDAP and AD (that is recommended).
_________________________________________________________________

Q: Are user permissions only enforceable at the package level, not by Categories? Once you have access to read/write a package, is everything in that package available to you, or can it be more fine-grained?

A: Can be enforced at the category level.
_________________________________________________________________

Q: Can the workflows (ruleflows) be defined from within the Guvnor (versus Eclipse)?

A: Not at present - only viewed (limited editing) but in the near future full editing of flow diagrams will be supported (we are trying out various ajax and possibly flex techniques to make sure we can target all the popular browser platforms).
_________________________________________________________________

Q: What does a Foo.scenario look like in the eclipse plugin if you open it up? Can you run scenarios from eclipse? Can they be grouped to be part of a continuous build/test nightly process?

A: It is XML. Yes you can - using the ScenarioRunner class (from code).
_________________________________________________________________

Q: In WebDAV, how are user permissions enforced? Can I change or edit rules in WebDAV mode?

A: Fine grained permissions are not enforced in WebDAV at the moment - only authentication.
_________________________________________________________________


Q: Are Web decision tables customizable?

A: To some extent - the grouping can be setup, as can widths/names of columns etc..., but not to the extend that spreadsheet based ones are.
_________________________________________________________________


Q: Regarding security, is it custom in Guvnor, or is it linked up to JAAS LoginModules like other standard apps?

A: JAAS. No out of the box authentication is provided - it is delegated to the container.
_________________________________________________________________


Q: Is security rights defined in the Guvnor also enforced when editing assets using the elcipse plugin?

A: Only authentication - as this uses the WebDAV facility (at present).
_________________________________________________________________


Q: is there any way to import xls file to rule repository

A: You can import - but it will not convert them to web based decision tables - it will simply be stored as is, and used as is in a rule package.
_________________________________________________________________


Q: Are fact models created within Guvnor versioned Such as source would be in cvs/SubVersion/clearcase . . .

A: Yes they are.
_________________________________________________________________


Q: Can rule flows be invoked via a JSR 94 interface?

A: Not at this stage.
_________________________________________________________________


Q: In drools 4 - we had to turn off the AOP - caching because it conflicted with our own cache. Has that whole concept of truth maintenance been re-vamped in drools 5?

A: It was highly likely it was the shadow facts (little proxy classes generated to copy data from facts) - these would cause havoc with AOP and other tools. Shadow facts are no longer needed in drools 5.
_________________________________________________________________


Q: Any Apache Camel or Spring Integration - support?

A: There are some members of the community working on this. In terms of spring - there are a few ways people have used it available on the wiki.
_________________________________________________________________


Q: Web service exposure of the rules is still through custom methods or is there "out of box" functionality to expose them?

A: There is an "out of the box" module called "drools-server" which uses the RuleAgent to expose rules as RESTful services (XML or JSON payloads for the facts).
_________________________________________________________________

Q: can business users publish the rule to production after testing the rules edited by them

A: This depends on the configuration - if you want, yes. Generally though someone with "full access" to Guvnor would create a snapshot for production usage which the remote rule agents then consume.
_________________________________________________________________


Q: What really is a partition for events? In traditional programming we have shared memory and threads working over that memory. Is a partition like a thread - or is an actual partition of the working memory? Would you please define your terms. Thank you.

A: There is some partitioning of the working memory for the concurrent threads handling the event streams - but it is of course one memory space (one java process) - so a partition exists to help this per-thread isolation.
_________________________________________________________________


Q: Is the goal of Drools 5 - BLIP + BPML + BPEL?

A: Not at this stage (for the 5.0 release anyway). BPML has had some interest and there has been quite a bit of work in both BPML and BPEL as popular standards. "BLiP" is really a cute acronym meaning the combined business logic approaches of rules and processes.
_________________________________________________________________


Q: Are thre any changes in the (de)serialization of rules in Drools 5? We had problems with the size of the serialized rules when having more than 2K rules because all imports for the package were included into every rule

A: There has been a LOT of work around serialization and de-serialization to make it much more efficient. You should certainly see an improvement here.
_________________________________________________________________


Q: Are there any integration with rule mining tools such as Relativity? i.e. Go throught the lines of cobol code harvest the rules and automagically import them in drools as a rule.

A: No - not that we have heard of (an ISV may have done something along these lines though).
_________________________________________________________________



Q: Are the rules stored in repository so that they can be reused

A: Not in this version, but that is on the roadmap for a near future version (requires dependency analysis so its slightly more complicated then it sounds).
_________________________________________________________________


Q: how do we use the binery package for further use?

A: You can use the RuleAgent to access the binary .pkg either directly from the repository, or from the file system.



Share/Bookmark

Thursday, November 06, 2008

Semantic SOA

So was talking to my friend Benjamin Grosof, ex MIT Sloan Professor, from Paul Allen's cutting edge research company Vulcan Inc. While talking about next generation stuff he introduced me to the concept of Semantic SOA, he personally believes this will be the next big thing. It took a while for the concept to sink in, but once it did I was shocked to my core over the possible impact of such technology. Unfortunately he's twisted my arm, so I can't talk about it further :( But I'd be very interested to here what other people think this is about, and whether Gartner or other analysts have picked up on this yet.

update (7th of Nov 2009): heh, this was a hoax for a bit of fun. While at BRF I mentioned that I'm pushing the term "Business Logic" for a product that was neither rule centric or process centric. So our minds went wandering about other possible names, then obviously we thought it would be funny if we combine the hype of Semantic Web with the hype of SOA and see the response :)
Share/Bookmark

Monday, November 03, 2008

Drools Presentation at Belgian JBug

I'll be giving a presentation about Drools in general (and some more details on Drools Flow specifically), on the first Belgian JBoss User Group, this Friday November 7th in Huizingen. The event starts at 17h. There will additional presentations from Nicolas Leroux on the latest development methods using Java EE, Seam, Hibernate, etc. and from Alexey Loubyanski on the new features of the upcoming JBoss AS 5 release.

All the information can be found on the Belgian JBug website: http://www.jbug.be/

As far as I know, the maximum capacity has not yet been reached so do not hesitate to register if you are around and interested in Drools, any of the other topics or just in JBoss in general !

KrisLink
Share/Bookmark

Monday, October 27, 2008

DSL Widgets in Guvnor

The Drools DSL format has been updated to allow for the addition of metadata to provide for user friendly widgets when using a DSL in combination with the guided editor. The DSL sentence can now display a dropdown for an enumeration, a date selector, a checkbox, and allows for the restriction of the value that can be entered in a text field via a regular expression. The regular expression validates against the contents of the text box and displays a message to the user when an invalid value is entered.Examples of each format are shown below along with screenshots from Guvnor


Defining a dropdown driven by a Guvnor Enum:
Format:
{<variablename>:ENUM:<type.fieldname>}


Example:
[when]When the credit rating is {rating:ENUM:Applicant.creditRating} = applicant:Applicant(credit=="{rating}")





Define a date selector via DSL:
Format:
{<variablename>:DATE:<date>}


Example:
[when]When the applicant dates is after {dos:DATE:dd-MMM-YYYY}=applicant:Applicant(applicationDate>"{dos}")





Defining a checkbox via DSL:
Format:
{<variablename>:BOOLEAN:defaultValue[checked | unchecked]}


Example:
[when]When the applicant approval is {bool:BOOLEAN:checked} =applicant:Applicant(approved=={bool})





Define a restriction on a textbox via a regular Expression:
Format:
{<variablename>:<regex>}


Example:
[when]When the age is less than {num:1?[0-9]?[0-9]} = applicant:Applicant(age<{num})





Share/Bookmark

Sunday, October 26, 2008

Symmetrical and Asymmetrical Rete

In my endeavours to understand Clips I realised that it's Rete implementation was different to the more classical approach, as used by Drools 4. I haven't read anything in the past that attempted to give this difference a name, so I adopted the terminology of symmetrical Rete and asymmetrical Rete. It was really nice to see this decision validated by Gary Riley, the author of Clips, who used the terminology in his presentation on Rete enhancements in Clips at the Rules Fest in Texas.

Here is a quick explanation of the difference, without getting into the details on merit, in Drools 4 we use the classical approach of the retract being the same work as assert, except on the assert data is added to the memory on retract data is removed. By this I mean that the fact propagates through the network, for each join node the constraints are evaluated to determine the joins, the join is made and the fact plus the new join fact are propagated, each propagation into a new join node is added to the join node's memory. The retract is exactly the same, the constraints are re-evaluated to determine the previous joins so that the join and propagation can be remade, this time the facthandle and it's joined data are removed from the join node memory. With the work done for the attract and assert being the same I dubbed this symmetrical Rete.

In Drools 5 we adopted the Clips algorithm. Here the assert uses a lot of linked reference so that the propagation creates a chain of tokens. The retract can now iterate this chain of references removing data from the node memories, the joins do not need to be recalculated to determine which facts we joined against, we already know this as we have the references. As the work done for the retract is now different to the assert I dubbed this assymetrical Rete.
Share/Bookmark

While everyone was having fun at ORF... (some of us got some work done !)

I (Michael) was not able to travel to texas for the meetup, due to an imminent addition to the family.

However, with the wonders of 2003 technology I was able to "attend" in a sense - Skype and Elluminate (skype had nicest voice quality - at least to my ears).

Just a quick update of some new features that fell out of some work that happened during ORF/rule meetup:

Jeff Delong requested that the Scenario runner be able to show an "audit log" of events (tracing the execution of the rules - this is similar to what you can do in the IDE using the logging event listener and the plugin. This was relatively easy to to:

So after you run a scenario, you can show the event log to trace the execution - very useful for explaining how the rules came to a certain conclusion. This shows all events (including ruleflow should it be invoked). Note that if you are using "pojo" facts, be sure to put in a sensible toString() method to show the state (the above ones did not, hence the "pointer address" style messages !).

Michael from Franklin American was at the rules meetup, and contributed a feature called "category rules" (more details on this in future) - it is a really clever idea: you specify that rules tagged in a certain category "extend" a specified rule. Before he could do this he had to add the "extends" feature to rules - so a rule can extend another rule (it "inherits" the conditional part - just single inheritance - very simple !).
(excuse my random keyboard-mashing names - unseasonal cold weather has locked up my joints for typing !). This is quite a neat idea - you could use it to simplify rule authoring so that the mere fact that a rule belongs in a certain category implicitly applies extra filtering constraints to it (that was the case Michael had in mind, I am sure he will provide a more concrete example in the future).

Also, Joe of Recondotech contributed an enhancement to DSL's to allow drop downs, dates and such to be configured in a DSL and an editor rendered accordingly - which provides a more user friendly way of building form-style UIs for business users.
Share/Bookmark

Thursday, October 23, 2008

October Rules Fest (day 1) and the upcoming RuleML conference

As mentioned before, we are all attending the October Rules Fest in Dallas. The very first thing that I said when I saw the presentation list was:

- Wow!!

The October Rules Fest group managed to host the best technical convention on BR I ever attended to, and managed to have not only the most known products and vendors attending, but specially some of the most known researchers in the rules engines field. Take a look at the speakers and the agenda: we have Charles Forgy, Gary Riley, Gopal Gupta, .... you name it!

Yesterday was the first day and it was a very good day. The presentation that most intrigued me was "Why systems fail, Why systems work" by Rolando Hernandez. I need to say that I was not familiar with the Zachman Enterprise Architecture Framework (wikipedia), but when he (and also Dr Leon A. Kappelman in the previous presentation) showed the diagram of the framework, it just made sense.

Rolando went a step further stating that Business Rules are not represented as a column or line the framework, but are the glue that binds together all the columns and permeates the enterprise architecture. He showed a "donuts like" hexagram, where each edge represents one of the columns in the framework and the center of the donut represents the business rules "glue". His presentation will be here, when he uploads it.

From my perspective, this is something that I firmly believe and matches the Drools vision of a platform that allows you to express your business rules in a declarative way. It was natural then to understand his diagram showing processes and event processing as component models of the whole architecture.

Now if you think about the problem, how can you write your rules, or model your business if you will, if your rules engine does not know the concept of events and processes? That is why we, at the Drools team, are working to expand the Drools engine so that processes and events can be handled as first class citizens of your Business Model.

If your rule involves events, just state it. If your rule involves processes, just state it.

The good news is that we are not the only ones saying it, and that proves we are not crazy (or at the very least not the only ones that are crazy). Take a look at the RuleML conference agenda for next week. Even being a rules related conference, look at both keynotes for the first day:


For those not familiar with them, Paul Haley is one of the fathers of current Business Rules technologies and David Luckham is one of the fathers of current Complex Event Technology. There is no way I will miss!

Can we get a better endorsement than that?

Happy Drooling,
Edson

PS: the presentation I did is available at the conference site.

[edit: fixed the reference to the actual conference organization group. Thank you for pointing that out James.]
Share/Bookmark

Monday, October 20, 2008

Drools Boot Camp T-Shirts

T-Shirts Finally Arrived today, so everyone was very excited :) Thought I'd put up some photo's of our motley crew - Asif and Andrea (who have been here the other days) could not make it today, so they missed out on the photo. Just click any of the photos to enlarge.




Share/Bookmark

Saturday, October 18, 2008

Drools Flow and BPMN

One of the main things we want to offer to end users is the ability to specify themselves what their processes look like. This includes the ability to extend the process engine with custom-defined nodes, to add domain-specific work items, etc. We now have introduced the concept of a (process) skin, which controls how the different nodes are visualized. This allows you to change the visualization of the different node types the way you like them (by implementing your own SkinProvider).

BPMN is a popular language used by business users for modeling business processes. BPMN defines terminology, different types of nodes, how these should be visualized, etc. People who are familiar with BPMN might find it easier to implement an executable process (possibly based on a BPMN process diagram) using a similar visualization. We have therefore created a BPMN skin that maps the Drools Flow concepts to the equivalent BPMN visualization.

For example, the following figure shows a process using some of the different types of nodes in the RuleFlow language using the default skin ...


Simply by switching the preferred process skin in the Drools preferences ...


and then reopening the editor shows the same process using the BPMN skin ...


Tell us what you like! Or more in general, let us know what you think the other features are that are important when deciding how to visualize (executable) business processes (as flow charts).
Share/Bookmark

Friday, October 17, 2008

Rules and BPEL (Joe White @ Recondo Technologies)

Joe is here with us in Texas for the Drools Boot Camp, his company is a big BPEL user and he's been sharing his pain with us. They turned to BPEL, having drunk the koolaid, with the aim to simplify the management of a collection of services and their input and output of data. He tells us the result is a fairly complex system, that lives in Speghetti hell, that is difficult to manage on its own. Joe has been kind enough to share a screen shot and his own thoughts (all pasted below) on where he'd like to go with his company to better address this issue in the future, with the hope that Drools can help.

The image below is a graphical representation of a business process in BPEL. The boxes and circles along the right are services, the lines running to those services are invocations, and the boxes in the middle are steps in the BPEL process (assign, invoke, copy etc.)

Spaghetti BPEL, welcome to hell!!!
(click to enlarge)

An alternative is to use rules to manage your business process. A purely rules based approach would use a rule set as a content based router and every decision point becomes an evaluation of your business routing rules. In addition, rules can manage service invocation by making the service invocation the consequence of firing into another rule set. Coupled with a BRMS like Guvnor the rules based process orchestration of services becomes accessible by business users in a managed environment. Coupled with a workflow or integration engine like Drools-Flow or Apache Camel the rules based business process management will allow for the management of complex long running business processes without some of the complexity and development overhead introduced by BPEL. The rules manage the decision points and the workflow engine helps manage the progression through your business process. The rules based approach won’t provide everything that you get with BPEL. For example state management, persistence, and ease of integration with WSDL are all advantages that BPEL provides that you wouldn’t get for free with a rules driven approach. In the end a rules based approach to business process orchestration should provide simplicity, modularity, and ease of development. As an architect it is worth considering a rules driven approach to business process management.
Share/Bookmark

Drools Boot Camp - Day 1

Day 1 of the Drools Boot Camp is going well, unfortunately Michael Neal from the core team couldn't make it in the end :( However Edson, Kris and Toni are all here :)

The Boot Camp runs until Wed 22nd of October where the Rules Fest conference starts, which we will all be attending. The Boot camp is open to all, so if you are in the Texas area, do please come and join us, we are staying in the Best Western Hotel, Addison.

Today we've been joined by:
  • Joel White from Recondo.
  • Michael Rhoden from American Franklin.
  • Asif Akram from Imperial College.
  • Andrej Sasko from the independent IT consulting 123Learning.de.
Jens Ruehmkorf from German Aerospace Centre is in Texas but is tracking down his luggage, which has been lost, hopefully he will be with us tomorrow.

It's been an interesting day and I'll do a separate project later on topics covered. We have discovered the best hotel ever with free food and beer :) Here are some photos of the day:

Free food and the beer, the beer cooler is at the square box in the left of the photo.


Kris and Toni caught enjoying the free beer :) and a general shot of the room


Some more general shots of everyone hard at work.


And finally a picture of us at lunch.

Share/Bookmark

Wednesday, October 15, 2008

Drools Boot Camp in Texas is now being Twittered

At the request of others I've setup a twitter account and will send out communications via Twitter on the Drools Boot Camp, Rules Fest, Business Rules Forum and RuleML conferences over the next 2 and a half weeks.

http://twitter.com/markproctor
Share/Bookmark

First Look - Drools 5.0 (James Taylor @ Smart Enough Systems)

I met up with James Taylor, author of Smart Enough Systems, the other week and showed him over the Drools 5.0 work. He's written a blog entry on his thoughts, which you can read here.



Share/Bookmark

Sunday, October 12, 2008

Drools 5.0 M2 New and Noteworthy Summary

5.o M2 New and Noteworthy Summary

The complete JIRA release notes can be found here.

Guvnor (the BRMS component)



  • Fine grained security (lock down access to the app per package or per category). Users who only have category permissions have limited UI capability (ideal for business users)
  • Import/export individual packages (to XML)
  • Execution server - access rules via XML or JSON for execution
  • Many more (check the JIRA logs !)
  • Many fixes (resource leak in M1 was fixed early on)

Drools Flow

Human task management is very important in the context of processes. While we allow users to plug in any task component they prefer, we have developed a human task management component that supports the entire life cycle of human tasks based on the WS-HumanTask specification, which is discussed in the following two blows:
Drools and WS-HumanTask
Creating a DSL for WS-HumanTask and when not to use a Rule Engine
Sample Eclipse views allow users to manipulate their tasks. The code can be found here.

The Drools Flow language itself has also been extended with new powerful functionality, including:
  • Event nodes that allow a process to respond to external events
  • Exception handlers and exception handler scopes to handle exceptions that could be thrown
  • A ForEach node allows instantiating a section of your flow multiple times, for each element in a collection
  • Data type support has been extended
  • Timers are integrated with common node types
As a result, new node types and properties have been added to the Drools Flow editor in Eclipse. You can also find examples of these new features in the integration tests (e.g. ProcessExceptionHandlerTest, ProcessTimerTest, etc.).

Finally, our pluggable work item approach allows you to plug in domain-specific work in your process in a declarative manner. We plan to build a library of common work items and already provide an implementation for sending emails, finding files, archiving, executing system commands, logging and human tasks.

Drools Expert and Fusion


fireUntilHalt()
Drools now supports "fireUntilHalt()" feature, that starts the engine in a reactive mode, where rules will be continually fired, until a halt() call is made. This is specially useful for CEP scenarios that require what is commonly known as "active queries".

Rule Base partitioning and multi-thread propagation
Drools ReteOO algorithm now supports an option to start the rule base in a multi-thread mode, where Drools ReteOO network is split into multiple partitions and rules are then evaluated concurrently by multiple threads. This is also a requirement for CEP where there usually are several independent rules running concurrently, with near realtime performance/throughput requirements and the evaluation of one can not interfere with the evaluation of others. This is a big topic and has several implications that I will discuss in a follow up blog post and the upcoming documentation.

XSD Model Support
Drools now supports XSD models, you can look at the unit test here to see how it works. Remember though the XSD model is generated as pojos local to the Drools classloader. A helper class is there to assist in the creation of the model in the packagebuilder. Once the data model is generated you'll typically use the JAXB dataloader to insert data.

Data Loaders

Drools now supports two data loaders, Smooks and JAXB. Smooks is an open source data transformation tool for ETL and JAXB a standard sun data mapping tool. Unit tests showing Smooks can be found here and JAXB here.
Share/Bookmark

Thursday, October 09, 2008

Nationwide Insurance to give Drools Blog

GoogleAlert just let me know that Nationwide
are doing a Drools presentation at the Central Ohio Java Users Group on the 14th of October. The details can be found here, and I've pasted them below. It's really nice to see other members in the community promoting the use of Drools, especially a big brand name like Nationwide:

Event
when: 10/14/2008 | 11:30 - 12:30
Event title JBoss (Drools) Rules Engine in J2EE Enterprise Applications
Where: OCLC's Kilgour building private dinning room - Dublin
Category: 2008 Meetings

Abstract

Provides a glossary view of rules engine. Some comparison between BRMS and Traditional Rules Engine (embedded). A quick look at JBoss Rules, different ways to represent the rules and some highlights of the overall programming environment.

Bio

Name: Keith Ebare
JobTitle: Consulting, IT Architect
Company: Nationwide P&C
Technical Area of Interest: J2EE and usage/applicability of open source products

Name: Anu Alwar
Job Title: Consulting IT Architect
Company: Nationwide P&C

Implementation of rules engines for externalizing business rules in a j2ee application.
Masters in Computer Science from Ohio State University. About 13 years of IT experience with about 10 in j2ee.

Location
Venue OCLC's Kilgour building private dinning room
Homepage: http://www.oclc.org/about/headquarters/maps/
Street: 6565 Kilgour Place
ZIP: 43017-3395
City Dublin
Country: OH

Share/Bookmark

Wednesday, September 24, 2008

Creating a DSL for WS-HumanTask and when not to use a Rule Engine

As previous discussed Drools is building a task system based on oasis spec WS-HumtanTask (WSHT). The spec has a number of operations to control the status of the task for a defined life cycle, where only certain people execute an operation based on given permissions. For a quick recap WSHT supplies the following:

A Task can be in one of the following states:
Created, Ready, Reserved, In Progress, Completed

And supports the following main actions:
Create, Claim, Start, Stop, Release, Suspend, Skip, Resume, Delegate, Forward, Complete, Fail.

WSHT supports the following role types, which it refers to as People Assignments:
Task Initiator, Task Owner, Potential Owners, Business Administrators, Excluded Owners, Recipients, Task Stakeholders.

Already it's obvious that we have rules and flow involved here. To give you an idea of the business logic involved lets look over some of them now - obviously the spec pdf has the complete set of business logic. The task starts off as Created and then moves to Ready where it can transition to Reserved or InProgress depending if the operation is claim or start. Only potential owners or business administrators may claim or start a task. Once in progress only the owner can fail or complete it. Potential owners can only forward a task if it has a status of Ready, once Reserved or In Progress only the owner or business administrator can forward it, further to that the person forwarding must be specified explicitly in the permission and not implicitly as part of some group.

The first thing that came to mind was "great we can model this with rules and flow using Drools" and after some thought I decided that Flow was a bit over kill for this as the flow was quite basic. Also flow diagrams can obscure the business logic, making you need to inspect each node to get a full understanding of the logic; if the flow is simple I think I'd prefer something that made the business logic more obvious. So I decided to defined a DSL that would define both the flow and the rules in a single way, that was also "self documenting" and that made it obvious what could be done where. I decided to use MVEL to model the DSL, as it allows for compact and minimal syntax when creating large graph objects. So lets look at what this DSL would look like.

We know that we first have an operation command (claim, start, stop, etc) and that those operations are only valid when the task is in given status, someone can only claim a task that is in the status Ready. Further to that we have allowed permissions, who can execute that task for the given status, only potential owners or business administrators may claim a task and then we have the resulting new status, which in this case would be Reserved, and the owner of the task must be set to the new user.

I first create the enum Operation which has entries for each possible operations (claim, start, stop, etc). I also create an enum Allowed which lists the different types of people/groups that may have permission for the operation (owner potential owner, business administrator). Then I create an OperationCommand object that will encapsulate the desired business logic in a declarative manner. As a start that OperationCommand would have the following fields:
public class OperationCommand
List status;
List allowed;
Status newStatus;
boolean setNewOwnerToUser;
So using the above we can use MVEL to declare the first entry for our DSL:
[   Operation.Claim
: [ new OperationCommand().{
status = [ Status.Ready ],
allowed = [ Allowed.PotentialOwner, Allowed.BusinessAdministrator ],
setNewOwnerToUser = true,
newStatus = Status.Reserved
} ]
]
Notice MVEL uses the "." suffix to allow in-line "with" field accessors for very compact syntax. What the above says is that we have a Map of possible operations and each key has an array of possible OperationCommands. In the above case there is only one possible status Claim can execute on and that is Ready.

Now we know that Start can be called while the task is in status Ready or Reserved, so lets look at that DSL entry:
[    Operation.Start
: [ new OperationCommand().{
status = [ Status.Ready ],
allowed = [ Allowed.PotentialOwner ],
setNewOwnerToUser = true,
newStatus = Status.InProgress
},
new OperationCommand().{
status = [ Status.Reserved ],
allowed = [ Allowed.Owner ],
newStatus = Status.InProgress
} ]
]

See the difference? Any potential owner can start a Ready task, where as only the owner can start a Reserved task. So what we have here is a self documenting DSL that is easy to understand and easy to administer. In reality WSHT gets a little more complex than there, where operations suspend and resume need to track previous status and as mentioned previously forwarding has an extra permissions check, and delegating will need to execute an additional command to also then Claim the task in the delegates name. The following links are for the full source code for OperationCommand and the operations-dsl.mvel.

Having written the DSL, forgoing Flow, the next question was - how do I write my rules to process the DSL. Given some more thought I realised that the rules where not large nor complex and the domain was known, in that they will not change often. further to this the data used with those rules is minimal - do I really need a rule engine for this? The obvious answer is no, I can hand crank some minimal Java code to process this DSL.

Java retrieved the list OperationCommands based on the requested operation the following java snippet shows how to iterate over the list of commands - note actually it processes the status and the previousStatus fields, but this is just for status:
        for ( OperationCommand command : commands ) {
// first find out if we have a matching status
if ( command.getStatus() != null ) {
for ( Status status : command.getStatus() ) {
if ( taskData.getStatus() == status ) {
statusMatched = true;

// next find out if the user can execute this operation
if ( !isAllowed( command,
task,
user,
targetEntity ) ) {
return new TaskError( "User '" + user + "' does not have permissions to execution operation '" + operation + "' on task id " + task.getId() );

}

commands( command,
task,
user,
targetEntity );
return null;
}
}
}
...

So in the case of "Start" we would have two OperationCommands and it would find the one that matches the current status of the Task. It then checks if the user has the correct permissions, which is encapsulated in the isAllowed(...) method. If the user has permissions it will then execute the commands, a java snippet for the commands method is below:
    private void commands(OperationCommand command,
Task task,
User user,
OrganizationalEntity targetEntity) {
PeopleAssignments people = task.getPeopleAssignments();
TaskData taskData = task.getTaskData();

if ( command.getNewStatus() != null ) {
taskData.setStatus( command.getNewStatus() );
} else if ( command.isSetToPreviousStatus() ) {
taskData.setStatus( taskData.getPreviousStatus() );
}

if ( command.isAddTargetEntityToPotentialOwners() && !people.getPotentialOwners().contains( targetEntity ) ) {
people.getPotentialOwners().add( targetEntity );
}

if ( command.isRemoveUserFromPotentialOwners() ) {
people.getPotentialOwners().remove( user );
}

if ( command.isSetNewOwnerToUser() ) {
taskData.setActualOwner( (User) user );
}

if ( command.isSetNewOwnerToNull() ) {
taskData.setActualOwner( null );
}
...

The full DSL processing code can be found in the TaskServiceSession source code.

So what can we take away from this?
  1. When the problem domain is well defined and known, try and design a self documenting DSL to represent the problem domain.
  2. We don't always have to use XML, you do have a choice. Typically the dsl is going to be authored through a custom GUI, or just edited by the develop by hand. So why not keep it simple with a nice compact syntax, which will help with the "self documenting" benefits of the DSL.
  3. If the Flow is simple, we don't have to use BPM software. Some times a DSL can be less verbose and provide more upfront visual information. Further to that a DSL encapsulates the flow and the rules in a single format.
  4. If their are a small number of non-complex rules that don't change often and don't require dynamic deployment with a small data set that won't benefit from indexing or from optimising of data changes over time, maybe we should just write a few hundred lines of java code with good unit testing.

Share/Bookmark

Thursday, September 18, 2008

Drools Research Network

The number of research projects around Drools is growing, however I've noticed that institutes are generally not aware of each others efforts. For this reason I'm launching the Drools Research Network. This consists of a web page (synced from a wiki page so anyone can edit) that shows all the University stakeholders in Drools and the various research projects. Please do help keep this page up to date and comprehensive. There is also a mailing list that is strictly for institute staff to discuss existing and potential projects, fundings, students and general collaboration to increase and improve Drools related research - if you fit in this category please subscribe.

Drools Research Network home page
The Wiki Page
The Mailing List
Share/Bookmark

Wednesday, September 17, 2008

Improving the Naval engineering process using Drools ( Michael Zimmermann )

Michael Zimmermann, from Rostock University, has emailed us an overview with findings for his Phd thesis on helping to improve the navel engineering process using Drools. The thesis title is "Knowledge based design patterns for detailed steel structural design".

The Scope: Naval Engineering,

In naval engineering vessels consists of thousands of parts (read: way more than an aircraft has today). Focusing on the steel structure, most of these parts are 2-dimensional plates of a certain size, thickness, grade and contour. For most fields of applications detailed regulations
from classification societies etc. exist.

Currently, the design of such objects is done using specialized CAD systems. Here the following issues are present in all cad systems and the design process today:
  • Design time is 6 - 18 months (and not 10 - 15 years as for an air plane)
  • This means concurrent design, i. e. different people are working on parts or features that are closely related (strength, fatigue, cost, functional aspects or just being in the same room) on different levels of granularity (changing the hull 6 weeks before building happens!).
  • No connection between design intent (specification on paper), design conditions (regulations, by the customer, results of calculations) and design solution chosen.
Result:
  • We just have the geometrical data, nothing more in the CAD-model
  • No automatic checks if a certain component is changed; no automatic tests if a chosen design solutions really satisfies the conditions at lowest cost today
  • Therefore, changes (which you can't avoid) are cost intensive and error prone. Also, no one really knows why a certain solutions was chosen
Enter Logic & Drools

The objective of our research is to make the design process context aware. Example: If I design a "door" in a watertight "wall" the cad system should check whether the selected door is a watertight model.

So, using one of the most popular commercial cad systems for naval engineering the approach is to define the standards (currently paper-based) electronically using DROOLS. Also, context-information like watertight, stress level=x ... is added to the model and reused in the design process. For standard design tasks (in a part of the field of detailed steel structural design) we use drools to completely automate the design process, i. e.
  • Find a design problem in the model
  • Select a suitable solution adhering to all known boundary conditions
  • Design the solution
  • And assign a assurance level for the solution (how good is it?)
Lessons Learnt from an Engineering POV
  1. Extracting the knowledge is hard
  2. Formulating it logically sound even harder (even official regulations are vague on a regular basis)
  3. Defining the context a solution is valid for is even more difficult.
  4. Current CAD systems in naval engineering are not really capable to store meta information and to interface with other applications.
Lessons Learnt from a Drools POV
  1. Drools is quite a nice system :-)
  2. With DSL even engineers can use it (once they are trained how to "Think Rules". And that is next to impossible)
  3. What's missing is some solution to easily define classes, class hierarchies and (!) instance data. We use OWL for now. eCore might be usable yet is terrible from a UI usability perspective
  4. Not drools is the problem but getting the data in and out!
    1. The Smooks binding could be a godsend for this
    2. Fact templates sound really promising if you think dynamically generated classes via web services...
What's missing in Drools?
  • An OWL/RDF binding would be really great (we use OWL to define, edit, store our standards. But encountered the clash of open world logic (DL) and closed world logic (CS) more than once.) I know there is quite a large interest for such a solution in the Ontology user base.
  • Better support for constraint programming (what we do here and there) for simple primitive cases (read: selection processes) would help. Drools solver is overkill; drools rules can not handle this if you think optional constraints. The custom operator "== (open world style)" we talked about helps, though.
University of Rostock, http://www.uni-rostock.de
Chair of Naval Architecture, http://www.schiffbauforschung.de
Contact: michael.zimmermann at uni-rostock.de
Share/Bookmark

Drools and WS-HumanTask

I've previously blogged about how Drools is becoming a Business Logic integration Platform that unifies rules, work flow and event processing. An important aspect of work flow is human task management, which to date has been missing in our efforts. Kris Verlaenen, the Drools Flow lead and general evil genius, did a review of the various specs and other non-standard implementations. As it turns out the WS-Humantask (WSHT) spec is pretty decent and comprehensive, the pdf can be found here, so when thinking about implementing this feature for Drools it made sense to base it on WSHT rather than a proprietary implementation such as the one found in jBPM. WSHT has become an oasis standard, which InfoQ covered back in january "BPEL4People and WS-HumanTask Head To OASIS".

Kris has been busy working away on a implementation of WSHT and it's almost at a usable stage, for now he has taken a more practical approach to this to deliver something that we can use for Drools, rather than just aiming for WSHT compliance. Although we do hope to eventually make this fully WSHT compliant, hopefully someone from the community can help us from that side.

The class model, which is made persistable through EJB3, is close to complete and able to represent the whole of WSHT - except for the presentation elements, which I have left off for now, these can be easily added later but we don't have much use for them yet.

For now we have chosen to do ignore the WS aspect and focus on a apache mina based client/server architecture this allows us to create a simpler and lower latency implementation for integration with our runtime and tooling, easily supports p2p and is more easily embeddable as mina is just a small JAR. The last one is important as the WSHT server needs to message events to running clients, who are typically in a wait state.

The spec does not specify anything about iCalendar notifications, so kris has added this anyway. So now when someone claims a task they get two iCalendar emails one for the first start date and one for the last start date. iCalendar VEvents was chosen over the more symantically correct VTodo as there doesn't seem to be much support for the later - neither gmail or zimbra can detect a VTodo sent via an email. Maybe over time we can make this configurable and users can specify whether they want events or todos.

Typically a Task has a start by date and an end by date, WSHT allows for multiple start deadlines and multiple end deadlines. Each deadline can have zero or more escalations that result in a re-assignment or a notification. WSHT doesn't specificy what form the notification takes place, this is one of their extension points. We have hooked up the notification system to integrate with our existing "work items" framework, initially with the email work item. Work items are pre made units of re-usable code, typically with GUI configuration in the flow editor, for executing actions. Later we could include a JMS or WS notification, leveraging any pre-made work items we have made.

A Task can be in one of the following states:
Created, Ready, Reserved, In Progress, Completed

And supports the following main actions:
Create, Claim, Start, Stop, Release, Suspend, Skip, Resume, Delegate, Forward, Complete, Fail.

WSHT supports the following role types, which it refers to as People Assignments:
Task Initiator, Task Owner, Potential Owners, Business Administrators, Excluded Owners, Recipients, Task Stakeholders.

To get an understanding of how the WSHT life cycle works with the various allowed operations the spec pdf provides this state transition diagram which hopefully makes it all clear.

WSHT Lifecycle from spec PDF

The Drools Task code currently lives here, while the WSHT client/server implementation is close to complete the tooling integration will be minimal for 5.0 due to time constriants. We hope to quickly crank that up to make the tooling in eclipse and the Guvnor BRMS feature full. This is a great project for anyone wanting to get involved as it's relatively self contained and thus straight forward and no complex algorithms :) Things to do include full WSHT compliance, improved tooling including various extensions like inbox style views that support task labelling and also "read" status.


For now here is a simple screenshot showing some of the minimal Task tooling integration into Eclipse.


Share/Bookmark