JESS: Rule efficiency

View: New views
2 Messages — Rating Filter:   Alert me  

JESS: Rule efficiency

by DCWYRICK :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi, I sent this before but for some reason it double posted another message
that I replied to and didn't post this one.

...
Hello,

A project that I'm working on has a very large rulebase.  Many of these
rules were written with an editor that was made a long time ago, to ease
the process so that non-IT types could input their own rules.  We
discovered that the editor was coded so it wrote rules very inefficiently,
thus generating lots of partial matches.  We managed to re-write a lot of
the rules by hand so that they are more efficient, but there are simply too
many to go through completely by hand like this.

I was hoping to be able to use the (view) command to compile a list of the
worst offenders, but it seems very complex, especially with our large
rulebase.  Executing this command generates a window that is over 1.5 times
the width of my monitor, and it would take me days to go figure it all out.
Is there an easy way to look at the output of the view command to find the
information I need?  Are there other less involved methods of finding the
data I require?

Thanks

.                                                                                                                                                    This message and any attachments contain information from Union Pacific which may be confidential and/or privileged.
If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited by law. If you receive this message in error, please contact the sender immediately and delete the message and any attachments.



--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: Rule efficiency

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, I can throw out a few ideas for you, and leave it up to you to  
pick the most appropriate ones.

First, the "view" command can take the name of a rule as an argument,  
so you can see the network for a single rule at a time. Furthermore,  
the JessDE's "Rete Network View" using Eclipse's Graph Editing  
Framework to create a much more nicely laid-out network, and that  
immediately shows you the network for the single rule the cursor is  
inside of, so that might be very convenient if you wanted to wade  
through the rule text.

But there are lots of other things you might do, if you have a solid  
definition of what the bad rules look like. For example, you can use  
the XMLPrinter class (see http://www.jessrules.com/jess/docs/71/xml.html#writing)
  to translate the rules to XML, and write an XPath (i.e., XSLT) query  
to detect the problematic LHS pattern.

Another possibility: write Java code that uses jess.Defrule's API to  
probe the individual rules. There are methods there that let you  
explore the entire content of the patterns on a rule's LHS.

There's also a method "Defrule.listNodes()" which gives a human-
readable description of all the rule's Rete network nodes as one big  
String, and also getNodes() which returns an Iterator over all the  
rule's nodes.

So there are quite a few ways you might automate checking through the  
rules. If you want help or more details about any of these ideas, just  
let me know.


On May 9, 2008, at 3:13 PM, DCWYRICK@... wrote:

>
> Hi, I sent this before but for some reason it double posted another  
> message
> that I replied to and didn't post this one.
>
> ...
> Hello,
>
> A project that I'm working on has a very large rulebase.  Many of  
> these
> rules were written with an editor that was made a long time ago, to  
> ease
> the process so that non-IT types could input their own rules.  We
> discovered that the editor was coded so it wrote rules very  
> inefficiently,
> thus generating lots of partial matches.  We managed to re-write a  
> lot of
> the rules by hand so that they are more efficient, but there are  
> simply too
> many to go through completely by hand like this.
>
> I was hoping to be able to use the (view) command to compile a list  
> of the
> worst offenders, but it seems very complex, especially with our large
> rulebase.  Executing this command generates a window that is over  
> 1.5 times
> the width of my monitor, and it would take me days to go figure it  
> all out.
> Is there an easy way to look at the output of the view command to  
> find the
> information I need?  Are there other less involved methods of  
> finding the
> data I require?
>
> Thanks
>
> .                                                                                                                                                    This
>  message and any attachments contain information from Union Pacific  
> which may be confidential and/or privileged.
> If you are not the intended recipient, be aware that any disclosure,  
> copying, distribution or use of the contents of this message is  
> strictly prohibited by law. If you receive this message in error,  
> please contact the sender immediately and delete the message and any  
> attachments.
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users  
> you@...'
> in the BODY of a message to majordomo@..., NOT to the list
> (use your own address!) List problems? Notify owner-jess-users@...
> .
> --------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 ejfried@...
Livermore, CA 94550                 http://www.jessrules.com




--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------