[rules-users] Efficiency of rules with XPath...

Tomas Olsson tol at sics.se
Tue Apr 17 09:41:10 EDT 2007


Maybe you should look at this below
/Tomas

-------- Original Message --------
Subject: 	XPath and JBoss Rules integration with SXC
Date: 	Mon, 02 Apr 2007 00:14:22 GMT
From: 	<Mark Proctor>



SCX (Simple XML Compiler)
SXC has just been released and is a must have for any SOA project - 
http://sxc.codehaus.org/ - best of all it comes with JBoss Rules 
integration :) SXC is a pluggeable XML compiler that provides a high 
performance streaming XPath parser with JBoss Rules integration. It 
allows you to specify XPath querries in your rules, as the XML is parsed 
those rules are then applied, you do not need to write additional XPath 
statements else where.

rule "AddresTest"
when
    event : XPathEvent( expression == "/order/address[@country]" );
then
    System.out.println("Success! - " + drools.getRule().getName());
end



Schwenker, Stephen wrote:
> Hey all,
>  
> I'm trying to make my rule more efficient but I'm not sure how.  I've 
> designed my rules based around xml objects.  Basically, I have these 
> documents and XPath queries are executed against the Object to 
> determine if the rule should be executed.  The problems is, is that we 
> have over 900 rules that need to be executed.  The performance isn't 
> really that bad but I would like to Make it even better.
>  
> To do the job,  I have written an XmlUtils class to execute the 
> expression.  The class first gets the XPathFactory.  Then compiles the 
> expression and then executes the expression.  This happens for every 
> expression, and will happen each time the same expression is 
> executed.  I want to make the rules more efficient by getting the 
> XPathFactory once and compiling the expression once and then execute 
> the expression n time on the same compiled object.
>  
> I would like to know if there is a way I can have the rule object that 
> is generated by the package build do the compile of the XPath 
> Expression and then use it instead of compiling it every time.
>  
> Here is a sample of one of my rule criteria.
>  
>     asset: AssetDocument()
> *    eval*( XmlUtils.evaluatePathBoolean( asset, 
> "boolean(//ass:asset/ass:properties/ass:property[@name = 
> 'Desk']/ass:value/text() = 'column')") )
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>   




More information about the rules-users mailing list