Saturday, 23 February 2008

JServiceRules alpha 01 working version released.

Transform existing (or new) Enterprise Services in Semantic Services in no time. Based on a implementation of a generic Business Rules Engine (an implementation using Drools 4 is provided).

Features

# Quick and easy configuration (code or Spring based).


# Easy integration in existing services/applications (code or Spring based).

# Hides the complexity behind a BRE (configuration/development), allowing developers to concentrate in the development of the business logic and rules.

# Agnostic and focused API with the most common features that you'd need (plus new ones).

# New features that helps the BRE to interact with the environment (internal/external), for example invoking external services by rules (that are located in a external Spring context).

# Support package that provides integration out of the box for SpringHibernateMule etc..

Project Home

http://code.google.com/p/jservicerules

Binaries

http://jservicerules.googlecode.com/files/jservicerules-alpha1.tar

http://jservicerules.googlecode.com/files/jservicerules-alpha01-nodep.tar

Source Code

http://code.google.com/p/jservicerules/source/checkout

Quick Guide

http://code.google.com/p/jservicerules/wiki/IntroductionGuide

Monday, 18 February 2008

jSemantic-Core Beta 1 released.

The beta 1 for the jSemantic-Core has been released.

This package is the API for the jServiceRules framework, that allows to transform your regular Enterprise Services to Semantic Services on the fly backed by a rules engine.

This is an "agnostic" API, so it doesn't contain any references or dependencies to any rules engine.

This release contains binaries, API docs and dependencies.

Project Home

http://code.google.com/p/jservicerules

Binaries

http://jservicerules.googlecode.com/files/jsemantic-core-beta1.tar

Source Code

http://code.google.com/p/jservicerules/source/checkout

Quick Guide

http://code.google.com/p/jservicerules/wiki/IntroductionGuide

Sunday, 17 February 2008

jServiceRules (I). The Semantic Core.

The first package of the jServiceRules framework is the jSemanticCore, that contains all the interfaces, abstract factories, helpers so a Semantic Session could be implemented.

The Semantic Session is a core concept within the jServiceRules framework and is just a Working Memory object "on steroids". Essentially it offers a focused interface, improves the communication of the WM with the execution enviroment (internal/external) and hides all the complexity behind the backed rules engine. Also helps to manage some external knowledge we could need through the Knowledge Database.

Let's say that you want to execute some business stateless rules. To produce this is as simple as:
  • Creating a Semantic Session Factory associated to the rules file.
  • Getting an instance of the Semantic Session (stateless by default), produced by the factory.
  • Passing some facts to the session (related to the rules you want to evaluate).
  • The rules will be automatically evaluated and some results will be returned.
  • The session could be disposed.
SemanticSessionFactory factory = new SemanticSessionFactoryImpl("org/jservicerules/rules/test.drl");

SemanticSession session = factory.getInstance();

Collection results = session.execute(new Integer(10));

session.dispose();

A template to produce the rules files is provided with the package:

package org.jsemantic.templates
global org.jsemantic.core.context.SemanticContext ctx;

rule "rule_one"
when
then
end
.........
rule "rule_n"
when
then
end

For example, we'd like to know if a number it's even:

rule "even"
when
number:Integer()
eval(number.intValue() % 2 == 0)
then
ctx.addObject(number, "Number: " + number + " is even");
end

The Semantic Context is the object that allows to interact with the enviroment. One way is returning results of the rules evaluation through the addObject(id, value) method. There are other ways of interacting as using the ExternalContext or the Session Variables. I'll explain this in future posts.

Saturday, 9 February 2008

It´s been a long time since I ...

Well yes!, it´s been a long time since the last time I wrote in this blog.. and a lot of things happened as well. The thing is, that I have been doing a lot of stuff lately and I´m going to share some of it, starting with a little set of frameworks related to the main topic of this blog: semantics.

First of all, a little of history :D

My first experience with semantic programming was some years ago, when I was assigned (with 2 colleagues) to a "highly urgent project" :P for Telefonica. It was a use case simulator for testing, so we had a lot of different input/output cases.

In order to relate the thousands of different input/output (a group of inputs/outputs would be a use case, depending on some conditions) we used a rule engine to generate and filter them.

Why did we use a rule engine? Because we could declare the different use cases and it's driven conditions, using rules in a declarative fashion (that is, semantic programming), being easily read, changed or updated. Also we could filter the cases using the same rules.

At that time (2003 I think it was) the best open source option was Drools (http://labs.jboss.com/drools/) and still is in my opinion. JRules from iLog, it´s a very good one rules engine but it´s a commercial option though.

I starting using rules engines over the years, collecting a few utility/helper classes.Then last year after the summer, I started working with these classes expanding them with a lot of improvements and concepts, always having Drools 3 as a core.

Then Drools 4 was released, and it had some of the concepts and improvements I´d already added :D to my little framework (well done guys! by the way). For example, changing the concept of WorkingMemory to RulesSession (stateless & stateful). I got something similar, but I went further creating the SemanticSession, a concept that I´ll explain latter.

Anyway, at that point I decided:
  • first of all, to create an agnostic and simplified API, with the most common features that anyone would use (based in my own experience) and not related to a specific rules engine. It also expands some of the concepts and features. This API would become the jSemanticCore package.
  • Second of all, to create an implementation based on Drools 4, using its new features and adding/removing others. Also it implements the new concepts, as the SemanticSession, SemanticContext, KnowledgeDatabase etc. This would become the jServiceRules package.
  • And finally, a support package that provides integration classes for Spring, Hibernate, Mule etc..

I will be releasing all this packages the next 2 weeks through http://code.google.com/p/jservicerules/, in a alpha/beta state. Also, I will be publishing entries in the blog explaining how to use it, technical aspects and examples.