 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Clarification regarding .drl file
                                
                                
                                
                                    
                                        by Sarath Kumar Daruru
                                    
                                
                                
                                        Hi,
I'm new to Drools engine. I'm developing small application related to Insurance domain. I've defined my own rules to process the policy.
I have defined 5 rules in my application. I have small question here regarding rules file. Below is my drl file
rule "1 Policy Validation"
      salience 1
      when
            Claims($claimPolicyID :  policyID != "abc1234" && message == "A",$claimPolicyID1 : policyID );
            $c : Claims (message == "A");
      then
            modify( $c ) {
             setMessage("Entered wrong Ploicy Number "+$claimPolicyID1+" \n")
            }
end
rule "2 Claims Validation"
      salience 2
      when
            Claims($claimAmt :  amount >=10000 && message =="B");
            $c : Claims (message =="B");
      then
            modify( $c ) {
            setMessage( "You are entered more than policy allocated amount. Plese enter correct amount \n" )
            }
end
rule "3 Hospital Days Validation"
      salience 3
      when
            Claims($claimHospitalDays :  claimsHospitalStayeddays > 10 && message == "C");
            $c : Claims (message =="C");
      then
            modify( $c ) {
            setMessage( "You entered more nithgs than the maximum permitted  "+ $claimHospitalDays +" days, this is more nights than the maximum permitted by the policy \n")
            }
End
Problem: All rules are firing once I will give workingMemory.fireAllRules();
Here my doubt is how can I exit from rule file once my rule1 fire or rule 2 fire. I don't want to file all rules in .drl file. Once the rule is satisfy then I need to exit from .drl file.
Can you please give me the solution?
Ahead Together,
Sarath Kumar Daruru
Associate Technical Lead - (TEG) | BlueAlly (A Megasoft Division)
Megasoft Limited| 6-3-1192/2/1| Kundanbagh| Begumpet| Hyderabad-16|
Phone: +91 40 4033 0000 Extension 8175
Mobile: +91 994 999 3152
Email: sarathd(a)blueally.com<mailto:sarathd@blueally.com>
                                
                         
                        
                                
                                16 years, 10 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Drools API improvement sugestion
                                
                                
                                
                                    
                                        by Zoltan Farkas
                                    
                                
                                
                                        Based on current implementation, the following methods I think should
throw a exception, something like: 
ResourceNotFoundException
 
org.drools.compiler.PackageBuilder.addKnowledgeResource()
org.drools.builder.impl.KnowledgeBuilderImpl.add()
another option might be to verify the validity of a Resource object at
creation time and make ResourceFactory factory methods throw
ResourceNotFoundException.
 
I believe the case of a "not found resource" the user of the api should
be "ecouraged" to handle.
 
Another case that might be needed to be handled could be
InvalidResource?
 
Let me know what you guys think
 
Regards
 
--zoly
                                
                         
                        
                                
                                16 years, 10 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Automatic handling of relationships
                                
                                
                                
                                    
                                        by Mark Proctor
                                    
                                
                                
                                        I thought of a simple, yet powerful idea, anyone want to give this ago? 
It will be the start of making ontologies more sanily usable for java 
developers.
Person
   @relation(name="OwnerPetRelation", verb="IsOwnerOf")
    Set<Pet> pets;
Pet
   @relation(name="OwnerPetRelation", verb="IsOwnedByf")
    Person owner;
IsOwnerOf and IsOwnedBy do not live on the classpath. The engine detects 
those annotations and generates them as internal classes. Or actually it 
can be one class, where it's able to use the two keywords to reference 
that class in either direction. When you insert your Persons and Pets, 
the relations are automatically inserted too (assuming there are rules 
that use them). This allows people to more naturally explore the 
relational aspect of their data, without having to create and insert the 
relations themselves. Once a Relation is being maintained by the engine, 
any updates to the underlying collection will result in relations being 
added and removed.
If we build in relation inferrence, to avoid the extra binding, it would 
mean that by simply annotating their classes people can do the following 
(Assuming Cat is a type of Pet):
When
    Person( location == London ) IsOwnerOf() Cat( color == "Tabby")
    ....
The above will get all my london people and their tabby cats. The simply 
placement of the IsOwnerOf() pattern, would be nice if () was optioal, 
would constrain the Cat to those related to the Owner. i.e. the short 
hand equivalent of:
$p : Person( location == London ) IsOwnerOf( owner == $p, $c : Cat ) 
Cat( this == $c, color == "Tabby")
I think that's powerful and provides for a hyrbid OO and Relational 
modelling approaches,  asthey can still use graph notation:
person.pets[0].color == "tabby"
This also solves the question that people always ask, how do I insert my 
collection. With that in place there would still be plenty more to do, 
like constraints, but it would be a start to improving Drools' 
relationahip programming "out of the box" capabilities. So who's game?
Mark
                                
                         
                        
                                
                                16 years, 10 months
                        
                        
                 
         
 
        
            
        
        
        
            
        
        
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        drools-process-enterprise - JPAPersisterManager should take EntityManagerFactory as an input parameter
                                
                                
                                
                                    
                                        by Michal Bali
                                    
                                
                                
                                        Hi Kris,
The JPAPersisterManager is currently creating a new EntityManagerFactory.
It should probably also take an EntityManagerFactory as an input. This is
necessary if you already have an EntityManagerFactory in your application
you want to reuse it. Two EntityManagerFactories mean two transactional
resources that have to be managed by a distributed transaction and that is
unnecessary.
If you want I should be able to provide the patch. It should be a simple
constructor change :).
I hope I am not starting to bother you with my issues, I might have a few
more :)
Thank you.
Best Regards,
Michal
                                
                         
                        
                                
                                16 years, 11 months