Geneology Rules – Decoupling the Criteria

Drools Rules

This blog is an excerpt from the new Drools Training Course that I am currently writing for Skills421 (www.skills421.com)

::

For anyone interested in following the parts before this check out

The Project So Far

We have now got a working set of rules that will identify potential Father Son relationships in a Genealogy Tree.

The rules compare two people and make a number of checks including

  • are the surnames the same
  • are the surnames both “Walker”
  • is the Father 18 years older than the son
  • is the Father married
  • was the Father married 9 months before the son was born

Whilst this is fine and is generating matches – we may wish…

View original post 1,022 more words

Advertisements

Moving Geneology to Drools 6.0

Drools Rules

This blog is an excerpt from the new Drools Training Course that I am currently writing for Skills421 (www.skills421.com)

::

I set myself the challenge today of moving the Geneology Project to Drools 6.0.

For anyone interested in following the parts before this check out

The Project So Far

The Project so far comprises the following key files:

  • pom.xml
  • RuleRunner
  • TestRuleRunner
  • Person
  • ExtendedDate
  • Ancestry1.drl
  • Ancestry1.1.drl
  • Ancestry2.drl
  • Ancestry3.drl

Changing the Code

Of the files already coded we will need to change the following files to work with Drools 6.0.

  • pom.xml
    Change the Drools Version
  • RuleRunner
    Change to use the new org.kie api
  • Ancestry2.drl
    Our ExtendedDate needs to be Cast Explicitly
  • Ancestry3.drl
    Our ExtendedDate needs to be Cast Explicitly

With…

View original post 521 more words

Simple Genealogy Rules – part 5

Drools Rules

This tutorial is an excerpt from the new Skills421 (www.skills421.com) training course that I am writing for JBOSS Drools.

In part1 we covered the Problem Domain, in part2 we set up our project to work with Drools 5.4.0.Final and JUnit, and in part3 we will create the Classes for our Facts that we are going to pass to the Rule Engine.

In part4 we created the Person class which is the type of Fact that we insert into the Rule Engine, we created the Rule Runner that will build the Knowledge Base for our Rule Engine and insert our Facts into the Rule Engine, and we created and ran our first rule.

Now in part5 we will modify our rules to identify possible Father – Son relationships in the People from whom we have derived our facts.

Refining Our Rules

The first thing we will do is add…

View original post 1,065 more words

Simple Genealogy Rules – part 4

Drools Rules

This tutorial is an excerpt from the new Skills421 (www.skills421.com) training course that I am writing for JBOSS Drools.

In part1 we covered the Problem Domain, in part2 we set up our project to work with Drools 5.4.0.Final and JUnit, and in part3 we will create the Classes for our Facts that we are going to pass to the Rule Engine.

Now in part4 we will create the Person class which is the type of Fact that we will insert into the Rule Engine, we will create the Rule Runner that will build the Knowledge Base for our Rule Engine and insert our Facts into the Rule Engine, and we will create and run our first rule.

Creating the Rule Runner

The Rule Runner is responsible for parsing the rules that we pass to it and packaging them into a Knowledge Base.

It is also responsible for evaluating…

View original post 1,005 more words

Simple Genealogy Rules – part 3

Drools Rules

In part1 we covered the Problem Domain, in part2 we set up our project to work with Drools 5.4.0.Final and JUnit.  Now in part3 we will create the Classes for our Facts that we are going to pass to the Rule Engine.

Creating the Facts

If we remember from our Problem Domain, the main fact that we will provide to the Rule Engine (for now) is each Person for whom we have found a record.

For this reason we will need a Person class.  Also, since we are going to be doing a lot of Date comparison and manipulation, we will extend the java.util.Date class to give us and ExtendedDate class into which we can add any new methods that we require.

Since the Person class will have a dependency on the ExtendedDate class, let’s start with the ExtendedDate class.

ExtendedDate

in the src/main/java source folder, create the package com.skills421.training.extend.util

View original post 380 more words

Simple Genealogy Rules – part 2

Drools Rules

This is the second part from the excerpts from the Skills421 (www.skills421.com) training course that I am currently developing.

In part 1 we identified the problem domain.  Here in part 2 we will create a simple Drools Project with which to implement our solution.

Creating the Geneology Project

Some of you may have noticed that I have spelled Genealogy wrong.  This is a deliberate act so that I can build this project step by step alongside my real Genealogy project.

So – here we go installing the incorrectly spelled Geneology Project.

I am going to assume you have downloaded Eclipse and Maven and installed both.  If not, then have a look on www.skills421.com for the Maven tutorial.  It will be appearing there some time tomorrow.

  • Open Eclipse and right click in the Project Explorer window.
  • From the popup menu select New -> Other -> Maven Project

009-New Project

Select Maven…

View original post 277 more words

Simple Genealogy Rules – part 1

Drools Rules

The following is a simple excerpt from the coming Skills421 (www.skills421.com) Drools Training Course.

The Problem Domain

We are busy researching a family tree and have encountered a person by the name of Richard Walker from Thornhill in West Yorkshire in 1813.  Our task is to identify his immediate and extended family from the information we can gleam from Ancestry and Parish records.

The problem we are faced with is that nearly everybody in the area appears to be called Walker in the 1600s, 1700s and 1800s and we need to try and piece together relationships.  Parish records from the area provide scant information – name, date of the christening, fathers name and location.  On rare occasions we are provided with a mother’s name but very rarely.

Other than that we can sometimes find details of marriage date and location, birth date and location, christening date and location…

View original post 290 more words