[rules-users] Drools Salience and no-loop

gboro54 gboro54 at gmail.com
Fri Mar 9 11:25:16 EST 2012


Perhaps I am building my packages weird but if all my drl/dslr are under the
same package the salience is honored and all the rules are fired in order.
Why would it work in this way? Since changing all the files to the same
package I have done 10 runs of the test with 100% success. Am I building the
kBase in weird manner(I don't think so but look below):


		if (logger.isDebugEnabled()) {
			logger.debug("Knowledge base with the following changeset was requested
built "
					+ changeset);
		}
		KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
				.newKnowledgeBuilder();
		kbuilder.add(ResourceFactory.newClassPathResource(changeset),
				ResourceType.CHANGE_SET);
		KnowledgeBuilderErrors errors = kbuilder.getErrors();
		if (errors.size() > 0) {
			StringBuilder sb = new StringBuilder();
			for (KnowledgeBuilderError error : errors) {
				sb.append(error + "\n");
				logger.error(error);
			}
			throw new IllegalArgumentException("Could not parse knowledge. \n"
					+ sb);
		}
		KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
		kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
		return kbase;

Would this cause any fragmenting when the engine is indexing the rules for
activation? I would think not. I am just going by the current results I have
gotten by declaring all rules in the same package. 




laune wrote
> 
> Salience is a field in the Activation object, used for ranking another
> entry when it is inserted into the List. Looking at the package name for
> this or at this time would be futile.
> -W
> 
> On 9 March 2012 16:44, gboro54 <gboro54@> wrote:
> 
>> No I am not using CEP and I didn't think STREAM mode made a difference. I
>> am
>> just as perplexed as you on why this is happening. Could it be salience
>> is
>> only respected in the same package(these are in different packages )? I
>> am
>> just taking a stab in the dark at this point. I generated audit logs and
>> it
>> can be seen that the removal rule activation is created first and
>> executed
>> first(it looks like 75% of the time based on my test this occurs)
>>
>>
>> laune wrote
>> >
>> > It's difficult to imagine that doing the same thing with equal facts in
>> > identically configured sessions would create differing objects. And it
>> > was the intent of my questions to unearth some irregularity, and to
>> > narrow it down.
>> >
>> > STREAM mode shouldn't matter as you aren't using windows, expiry
>> > or other CEP features - or are you?
>> >
>> > -W
>> >
>> >
>> > On 9 March 2012 15:53, gboro54 <gboro54@> wrote:
>> >
>> >> All sessions are against the same kBase. When I say replicate I mean I
>> >> create
>> >> 10000 separate Orders all the same way(same values for all
>> properties).
>> I
>> >> have not tried to insert all into one session and fire but can try if
>> >> this
>> >> really makes a difference(though I am not sure why it should). I will
>> add
>> >> an
>> >> update to 1 as well but again I am not sure why this would matter to a
>> >> low
>> >> ranking rule who does not care about the actual values from that rule
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://drools.46999.n3.nabble.com/Drools-Salience-and-no-loop-tp3812723p3812869.html
>> >> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> >> _______________________________________________
>> >> rules-users mailing list
>> >> rules-users at .jboss
>> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>
>> >
>> > _______________________________________________
>> > rules-users mailing list
>> > rules-users at .jboss
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Drools-Salience-and-no-loop-tp3812723p3813013.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at .jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> 
> _______________________________________________
> rules-users mailing list
> rules-users at .jboss
> https://lists.jboss.org/mailman/listinfo/rules-users
> 

--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Salience-and-no-loop-tp3812723p3813137.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list