Modelling Rulesets Using Ontologies
Many decision services are classifications: a certain case (think of an insurance claim) has to classified by looking at the facts related to this case. The processing of this case consist of a chain of classifications:
- at first we have to find out the claim type – think of an accident for example
- then we have to find out the subtype – think of an staircase accident
- then we have to find out whether this could be a distinctive feature and its type – think of a potential fraud case for example
- if the result of a classification is a distinctive feature it is likely that automatic processing has to be stopped and we have to find a person in charge who does a manual control, so we have to assign it to a working sets which is a classification, too.
So classifications are, besides calculations, an important type of decision service which occurs quite in automatic processes and especially in data driven IT systems. Therefore business experts define classifications as business rules which can be implemented using BRFplus for example. As blueprint I use ontologies, a tool from knowledge management that describe conceptual models using description logic. I will use an open source tool for creating ontologies and test an inference using an open source reasoner. If you have experience with so called semantic technology you can use them to analyze, structure and document decision service that compute classifications. With some more effort you can check consistency of your models.
Ontologies as Blueprints for Decision Services
The idea is very simple. Ontologies are artifacts which are used to model knowledge domains: concepts as formal definitions and entities that are realizations or materialization of those concepts. Knowledge workers dealing with very complex domains use them to formalize theories – think of classification of diseases, genes etc. with open standards like OWL. Moreover you can compute inferences and check models using open source tools. If you are a familiar with ontologies and tools like Protégé you will able to formalize your domain model, get a deeper understand, visualize it and even can check it. This formal description could be a specification for a BRFplus implementation where a classification could be developed by one or more functions or a few rulesets. So you can use the ontology can be used a blueprint for a BRFplus implementation.
A Simple Example
In the following I will show you a simple example. The domain model consists of:
- incidents – that is the class if objects that have to be classified
- as the result of the specification there are subclasses
- a certain subclass StaircaseAccident is a special incident that has the information (given by the claim holder) that it is indeed an accident where a staircase is involved
- then we define a rule that says that an information about a slippery staircase is sufficient for a staircase accident
- after that we define an incident having information about a slippery staircase and the reasoned will confirm the inference that it is a staircase accident as expected
This is done in a few seconds using Protégé ontology editor. At first I’m creating a concept of an Incident and a special accident where stairs are involved:
The concept is called “class” which means that elements (called individuals) can belong to it. If we want to perform a classification we will test whether a certain element belongs to the class – in our case staircase accident. But to do this we need some logical conditions which are defined in the following.
Therefore I define an information – in our case it is a statement of a claims holder which is the fundament of a classification in our case. We define two special types of information: the first says that we have a general accident on a staircase and the second one say that the staircase was slippery:
We define this information as a so called datatype property that assigns a value (“yes”, “no”, “nor information”) to this incident:
This is used to define a class: a StaircaseAccident is an incident where we have the additional information that the staircase was involved using above define datatype property:
Now we add the following rule to the ontology: if there is the information, that if the staircase was slippery we assume that the information is about a staircase accident:
This could be done using OWL but here I use the feature that an OWL ontology can be enhanced using SWRL rules.
No we define a concrete claim as an incident (member of Incident class) having a information about slippery staircase:
Now I switch on the reasoner (HermiT supports SWRL inferences) in Protégé that computes above defined classification as an inference: the member Claim was by definition an Incident but because of above defined data type property and a SWRL rule a memeber of StaircaseAccident class.
This inference is a very simple example but I blogged about more complicated inference in blogs of my “Enter Semantic” series. Unfortunately they have been scrambled after SCN migration and it is very difficult to restore them because in many examples using XML and URIs. Even if SCN team corrects them it will take much time for proofreading the corrections. But if there people who are interested in my old blogs I could spend some time on checking them.
Reasoners can do a lot more by evaluating logical conditions: they can test whether a class is a proper subclass or superclass of another class, they can calculate whether classes are disjoint and test logical consistency of an ontology. But I will come back to that topic in a future blog. This is in fact a very interesting topics because sometimes domain experts experts disagree in their conclusion and with ontologies you can formalize the differences.
Strengths and Weaknesses of the Approach
You can use ontologies to analyze and document complex domain models and classifications. Those models can contain comments and annotations which is very useful as documentation. Moreover you can define axioms to ensure consistency of your domain models with regards to those axioms. But ontologies have also weaknesses:
- Although you can use data types with ontologies and perform calculations you don’t have the strength of expression and tool support of BRFplus. Even generation of BRFplus artifacts from ontologies can be complicated.
- You can use Horn-like clauses(SWRL) in an ontology but I don’t think it can be used to exchange rules between BRM systems.But I will come back to ontologies in later entries of my blog and discuss more and even advanced applications in the area of business rules.
- Features from description logics can be quite confusing if you have no experience with mathematical logic.
But if you have experience with ontologies you have a powerful tool to analyzee, structure and document domain models.
If you want to try out the example above I recommend you to download Protégé and import the attached document as ontology in OWL 2.0 syntax.