Friday, 29 February 2008
Setup and Dependencies of jServiceRules
The only issue could be getting the right dependencies. If you have downloaded the no dependencies package you can get it in a separate file.
For further information a documentation guide is available.
Thursday, 28 February 2008
Transforming Pojo / Web / Enterprise Services into Semantic Services / Agents using jSemanticService
How would you do that? Well, in just three steps:
First Step
Writing a SemanticServiceFactory bean (and it's collaborators if needed) in the Spring Context file.
Second Step.
Either inject a reference to the SemanticServiceFactory directly in the service or extend the SemanticServiceSupport abstract class.
public class EvenService {
private SemanticSessionFactory semanticSessionFactory = null;
public Collection check(Collection numbers) {
SemanticSession session = semanticSessionFactory.getInstance();
Collection results = session.execute(numbers);
session.dispose();
session = null;
return results;
}
public void semanticSessionFactory(SemanticSessionFactory semanticSessionFactory){
this.semanticSessionFactory = semanticSessionFactory:
}
}
Now a method that uses the new added semantics functionality can be written. For that matter there is a method in the base class: getInstance(). This method returns a Semantic Session instance that is bound to the current thread. If we dispose the session then we'll get a new one. If not, the same session will be reused.
Third Step
Inject the Semantic Session Factory in the service bean.
And that's all, now the Semantic Service is ready to roll!.
Read the complete article in:
http://code.google.com/p/jservicerules/wiki/TransformServicesIntoSemantics
Tuesday, 26 February 2008
Why to use Semantics and Rules in your Services.
Well, using semantics or rules should be another tool in you toolset. And it's a very useful one, even though is very underrated maybe because it´s never been easy to use. Or because semantic or functional programming has never been that popular.
That is changing nowaydays because of SOA and BPM's, that rely heavily upon on Business Rules, specially sSOA.
With the jServiceRules / jSemanticService frameworks I tried to cover up some of that gaps:
# Adapting the BRE to Services and Java environments.
# Integration with another third party frameworks.
When to use Semantics or Rules
# If you have a complex model you could write a semantic model to process it.
# Business rules that would change over the time.
# Business rules that you'd like to isolate from the code.
# Different types of events or objects you'd want to recognize and process.
Sunday, 24 February 2008
About the jServiceRules alpha working release.
Even though it's functional and I've tested it in different enviroments (windows, linux, mac os) using unit and stress testing, still some bugs could appear. Also I'm still improving it, so minor changes could be found in the next version. But that's the reason it's an alpha release :) .
This release includes the dist binaries, dependencies (if you choose so), API docs, and two examples.
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).
# 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 Spring, Hibernate, Mule etc..
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.
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.
- 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.
Saturday, 9 February 2008
It´s been a long time since I ...
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.