[rules-users] Writing rules using terminology based expressions.

Shahim Essaid sessaid at essaid.com
Thu Aug 14 01:00:47 EDT 2008


Hi all,

I would appreciate some advice on how to best use Drools and how to 
write rules in my situation. I am new to Drools so my following 
descriptions might not be very accurate or clear.

I will be writing rules that compare SNOMED terminology expressions 
against similar expressions in the working memory. SNOMED is a medical 
terminology and it defines medical concepts by using attributes 
(relationships) and values. Both the attributes and the values are also 
concepts in the terminology. The concepts are hierarchical and they 
frequently have multiple inheritance as part of their definition. SNOMED 
expressions are basically one or more concepts (including nested 
concepts) composed together and they might have their properties refined 
and they might also have optional attributes set. There is an object 
model for these expressions and concepts. See the example below.

Basically, using a SNOMED expression (the query expression), it is 
possible to query a set of other expressions to see if one of them will 
satisfy the query criteria. There is an algorithm for applying this 
query to an expression and this algorithm can indicate if the query 
expression matches another expression or subsumes it. The other option 
is to send both expressions to a terminology service to perform this 
algorithm and get back a boolean result.

My question is about where I should implement this algorithm? How can I 
hook this algorithm into Drools so that Drools will treat these 
expressions in a special way? The usual type and value checks are not 
useful in this condition because the two expressions have to be first 
normalized and then compared. This normalization and comparison is done 
according to the SNOMED algorithms. Each attribute and value from both 
expressions will have to be tested to see if they have a parent-child 
relationship in the terminology’s semantic network.

The few options I thought of include treating expressions as strings. 
This will allow me to retrieve the expression string from each object in 
the working memory and then send it, along with the expression string in 
the rule, to the matching algorithm. The other option is to send the 
rule string to the memory object using an eval(). From what I know, I 
think that this will not be an efficient method because all the rules 
will fall under a single Java type.

The other option is to represent the expressions in their object form 
and have the objects implement the needed algorithms. In this case, how 
do I create an instance of this expression in a rule so that I can have 
it work with the expression objects in the memory?

A sample expression is shown below using a textual form. The terms could 
be removed and have the same expression represented using only the codes.

284196006|Burn of skin|:
246112005|Severity|=24484000|severe,
363698007|Finding Site|=
(113185004|Structure of skin between fourth and fifth 
toes|:272741003|Laterality|=7771000|left)

I am expecting that there will be a large number of rules and the 
working memory might have between 10 to 100 expressions.

Any ideas for how to approach this problem are greatly appreciated. I am 
interested in both a simple short term approach that I could use quickly 
and a more efficient long term approach.

Thank you,
Shahim




More information about the rules-users mailing list