[rules-users] Help needed - Repository not getting initialised?

2011-11-13 Thread Praveen
Hi,

Repository is not getting initialised, throws NPE.
Please advise.
TIA.

public static Repository repository;

public static Session getSession() throws Exception {
return getSession(true);
}

public static synchronized Session getSession(boolean erase) {
try {
if (repository == null) {

if (erase) {
File repoDir = new File(repository);
System.out.println(DELETE test repo dir: 
+ repoDir.getAbsolutePath());
RepositorySessionUtil.deleteDir(repoDir);
System.out.println(TEST repo dir deleted.);
}

JCRRepositoryConfigurator config = new
JackrabbitRepositoryConfigurator();
String home = System
.getProperty(guvnor.repository.dir);
  
repository = config.getJCRRepository(home);

Session testSession = repository
.login(new SimpleCredentials(alan_parsons,
password.toCharArray()));

RulesRepositoryAdministrator admin = new
RulesRepositoryAdministrator(
testSession);
if (erase  admin.isRepositoryInitialized()) {

admin.clearRulesRepository();
}
config.setupRulesRepository(testSession);
return testSession;
} else {
return repository.login(new SimpleCredentials(
alan_parsons, password.toCharArray()));
}
} catch (RepositoryException e) {
throw new IllegalStateException(e);
}

}

public static void main(String [] args) throws Exception{
getSession();
}


Below is the exception..

DELETE test repo dir: D:\drools\TestRepository\repository
TEST repo dir deleted.
Exception in thread main java.lang.NullPointerException: dispatcher
at
org.apache.jackrabbit.core.observation.ObservationManagerImpl.init(ObservationManagerImpl.java:97)
at
org.apache.jackrabbit.core.WorkspaceImpl.getObservationManager(WorkspaceImpl.java:748)
at
org.apache.jackrabbit.core.SessionImpl.removeRegisteredEventListeners(SessionImpl.java:1193)
at org.apache.jackrabbit.core.SessionImpl.logout(SessionImpl.java:1222)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doDispose(RepositoryImpl.java:2194)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.dispose(RepositoryImpl.java:2149)
at
org.apache.jackrabbit.core.RepositoryImpl.doShutdown(RepositoryImpl.java:1175)
at
org.apache.jackrabbit.core.RepositoryImpl.shutdown(RepositoryImpl.java:1127)
at
org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:544)
at
org.apache.jackrabbit.core.RepositoryImpl.init(RepositoryImpl.java:366)
at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:673)
at
org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:231)
at
org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:279)
at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:375)
at
org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:123)
at Hello.getSession(Hello.java:50)
at Hello.getSession(Hello.java:27)
at Hello.main(Hello.java:72)


Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-Repository-not-getting-initialised-tp3506064p3506064.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help needed - how to get Number and intValue in Guvnor

2011-10-20 Thread Praveen
Hello,

Anyone out there who has come across the above issue?

Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-how-to-get-Number-and-intValue-in-Guvnor-tp3430730p3437459.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help needed - how to get Number and intValue in Guvnor

2011-10-18 Thread Praveen
Hello,

I am new to Drools and trying to write rules using Guvnor GUI.
I have uploaded POJO's that are required for my rules.
I am facing issue trying to get Number()(the one in Bold-Italics) and
intValue in the Guvnor GUI.
Below is the rule for reference, its taken from one of the examples provided
in Drools Planner.


// Accumulate hard constraints
rule hardConstraintsBroken
salience -1 // Do the other rules first (optional, for performance)
when
$hardTotal : */Number(/)* from accumulate(
IntConstraintOccurrence(constraintType ==
ConstraintType.NEGATIVE_HARD, $weight : weight),
sum($weight) // Vote for
http://jira.jboss.com/jira/browse/JBRULES-1075
)
then
scoreCalculator.setHardConstraintsBroken($hardTotal.intValue());
end

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-how-to-get-Number-and-intValue-in-Guvnor-tp3430730p3430730.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help needed

2011-08-08 Thread Mattias Nilsson Grip

prasad.pbc wrote:
 
 Hi Guys,
   Iam using Eclipse tool for writing drl , i have written drl .
 Then i have written an ant script to convert this drl to PKG .
 i have used drools5.1.1.jars. i was sucessfully convert drl to pkg.
 
 knowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); 
 kbuilder.add( ResourceFactory.newFileResource(
 c:/Sample.pkg ), 
 ResourceType.PKG ); 
 iam getting below error:
 
 java.lang.ClassCastException: org.drools.reteoo.ReteooRuleBase cannot be
 cast to org.drools.rule.Package
 at
 org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:487)
 at
 org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
 at com.test.rules.MyRulesEngine.init(MyRulesEngine.java:51)
 at com.test.rules.MyRulesEngine.getInstance(MyRulesEngine.java:39)
 at com.test.rules.MyRulesExecuter.main(MyRulesExecuter.java:38)
 
 
 Can anybody help resolving my problem..
 
 Thanks
 prasad
 
Based on the stack trace I would guess that the file Sample.pkg contains a
serialized KnowledgeBase and not a serialized KnowledgePackage. Maybe you
could try to do your export like this:

KnowledgeBase kbase = ...;
KnowledgePackage kpackage = kbase.getKnowledgePackages().iterator().next();
FileOutputStream fos = new FileOutputStream(new File(c:/Sample.pkg));
DroolsStreamUtils.streamOut(fos, kpackage);

/Mattias

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-tp3224168p3234832.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help needed in configuring drools guvnor with MySql

2011-04-07 Thread Nicolas Héron
Hello,
and does your procedure work for Postgres ?
Thanks
Nicolas

-
Nicolas Héron
--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-in-configuring-drools-guvnor-with-MySql-tp844676p2791862.html
Sent from the Drools: User forum mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help needed in activationCreated and activationCanceled event

2010-11-04 Thread Michael Anstis
Please don't email me direct. I won't reply in the future. All questions and
answers are of value to the community as a whole.

To quote what I replied to an almost identical request a couple of days ago
and posted to the drools-user mailing list.

AFAIK, Activation Cancelled events would trigger in reaction to the
revocation of a logically inserted fact that caused an activation to trigger
in the first place. It would not help identifying which pattern in a rule
was not matched causing your rule not to activate.

On 4 November 2010 14:41, nku...@objectwave.com wrote:

 Hi, thanks for helping me out with that code. i have one more question, in
 activation cancelled event, it never gets executed.

 @Override
public void activationCancelled(ActivationCancelledEvent
 event) {
final Rule rule = event.getActivation().getRule();
final String ruleName = rule.getName();
System.out.println(Activation cancelled --  +
 ruleName);
rules.add(rule);
ruleNames.add(ruleName);
}


 @Override
public void activationCreated(ActivationCreatedEvent event)
 {
final Rule rule = event.getActivation().getRule();
final String ruleName = rule.getName();
System.out.println(Activation created --  +
 ruleName);
rules.remove(rule);
ruleNames.remove(ruleName);
}


 but my output never show this. i only have Activation created printed in
 console. which rule is not executed, that is not printing at the time when
 it is not activated. Please have a look on this.  My output is

 Rules not executed
 - GoodBye-rule
 - Hello World-rule
 - Never fires
 Activation created -- Hello World-rule
 Hello World
 Activation created -- GoodBye-rule
 Goodbye cruel world
 Rules not executed
 - Never fires


 this is the same code which you sent me. Never fires is the rule which
 never gets executed. we print this from the list of rules we have when we
 load the rule file. even if i skip that activation canceled it prints the
 same result.


 thanks

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help needed in Rule flow in Guvnor

2010-08-09 Thread Vignesh

Hi,

I am using Rule flow in Guvnor for setting some value out of the flow which
would be used for my further processing. Below is what I'm trying to
achieve,

I have two rule groups in the rule flow, out of which the first one would
set a key, value pair in a Map which is a field in one of the bean class
declared Global for the package when ever each rule is executed in the set
of rules in the group and the next rule group would be required to have a
set of rules that needs to be executed against this Map which was set in the
first rules group and send the final result as output out of the flow.

I have defined the rules in the first rule group and set the Map with
necessary keys and values, but I was not able to read the Map in this second
rule group. I had tried this second rule group as a custom java code in my
Java part after the rules execution from guvnor and able to read the map
that was set from the first rule group and able set the final decision.

I want to know whether reading the Map from the second rule group which was
set in the first rule group is possible or not. Or kindly let me know
whether I'm missing anything here and needed to add any other logic to
achieve the same.

Thanks,
Vignesh
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Help-needed-in-Rule-flow-in-Guvnor-tp1059410p1059410.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help Needed in Drools Flow

2010-07-15 Thread santosh mukherjee
Hi,

I have inserted some objects into the process session through
ksession.insert(Object arg0) method call in the class file that starts the
process.Now I want to access those objects in my workItem on entry action
code. Can I do it? If yes please let me know how??

Thanks
Santosh Mukherjee.

On Wed, Jul 14, 2010 at 4:37 PM, Chris Raschl 
c.raschl-mailingli...@dyless.com wrote:

 Am 14.07.2010 12:05, schrieb santosh mukherjee:
  Hi,
 
  I want to add some of my own customized components to Drools Flow
 components pannel. How can this be done. Is there some API available to do
 so ??

 Hi,
 i guess you want to add domain specific work items to use them in the
 process designer
 in eclispe. There is no API, to do that you just have to add a
 drools.rulebase.conf file
 and your own work item definition to your META-INF directory.

 There is an example in the drools flow manual:


 http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html_single/index.html#d4e1033

 Remind: You'll have to re-open the process to make the work items appear.

 Hope this helps,
 chris
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help Needed in Drools Flow

2010-07-15 Thread santosh mukherjee
This is the code that I am using in the OnEntryActions part of my workItem.

System.out.println(context.getProcessInstance().getWorkingMemory());
FactHandle fac=context.getProcessInstance().getWorkingMemory().insert(new
Name(santosh));
System.out.println(fac);
org.drools.runtime.rule.WorkingMemory
wrk=context.getProcessInstance().getWorkingMemory();
System.out.println(wrk);
System.out.println(wrk.getObject(fac));


But it gives this error:

Process Compilation error : org.drools.lang.descr.processde...@1ecfe07
com/sample/Process_com_sample_0.java (20:933) : Type mismatch: cannot
convert from org.drools.WorkingMemory to
org.drools.runtime.rule.WorkingMemory

Process Compilation error : org.drools.lang.descr.processde...@1ecfe07
com/sample/Process_com_sample_0.java (20:933) : Type mismatch: cannot
convert from org.drools.WorkingMemory to
org.drools.runtime.rule.WorkingMemory

Process Compilation error : org.drools.lang.descr.processde...@1ecfe07
com/sample/Process_com_sample_0.java (20:933) : Type mismatch: cannot
convert from org.drools.WorkingMemory to
org.drools.runtime.rule.WorkingMemory

java.lang.IllegalArgumentException: Could not parse knowledge.
at com.sample.ProcessTest.readKnowledgeBase(ProcessTest.java:47)
at com.sample.ProcessTest.main(ProcessTest.java:24)

Can anyone help how to get around this error???

Thank You.
Santosh Mukherjee


On Thu, Jul 15, 2010 at 5:33 PM, santosh mukherjee
sam.sensat...@gmail.comwrote:

 Hi,

 I have inserted some objects into the process session through
 ksession.insert(Object arg0) method call in the class file that starts the
 process.Now I want to access those objects in my workItem on entry action
 code. Can I do it? If yes please let me know how??

 Thanks
 Santosh Mukherjee.


 On Wed, Jul 14, 2010 at 4:37 PM, Chris Raschl 
 c.raschl-mailingli...@dyless.com wrote:

 Am 14.07.2010 12:05, schrieb santosh mukherjee:
  Hi,
 
  I want to add some of my own customized components to Drools Flow
 components pannel. How can this be done. Is there some API available to do
 so ??

 Hi,
 i guess you want to add domain specific work items to use them in the
 process designer
 in eclispe. There is no API, to do that you just have to add a
 drools.rulebase.conf file
 and your own work item definition to your META-INF directory.

 There is an example in the drools flow manual:


 http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html_single/index.html#d4e1033

 Remind: You'll have to re-open the process to make the work items appear.

 Hope this helps,
 chris
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help Needed in Drools Flow

2010-07-14 Thread santosh mukherjee
Hi,

I want to add some of my own customized components to Drools Flow components
pannel. How can this be done. Is there some API available to do so ??

Thanks
Santosh Mukherjee
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help Needed in Drools Flow

2010-07-14 Thread Chris Raschl
Am 14.07.2010 12:05, schrieb santosh mukherjee:
 Hi,
 
 I want to add some of my own customized components to Drools Flow components 
 pannel. How can this be done. Is there some API available to do so ??

Hi,
i guess you want to add domain specific work items to use them in the process 
designer
in eclispe. There is no API, to do that you just have to add a 
drools.rulebase.conf file
and your own work item definition to your META-INF directory.

There is an example in the drools flow manual:

http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html_single/index.html#d4e1033

Remind: You'll have to re-open the process to make the work items appear.

Hope this helps,
chris
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help needed in configuring drools guvnor with MySql

2010-05-26 Thread Dinesh kumar

Hi,
I am trying to configure Drools Guvnor with MySql. I am using JBoss 4.0 . I
searched the web and changed my repository.xml that was created in my
JBoss/bin . But I am getting one exception after another and finally I am
struck up in this exception. Any help on this will be of great help..


deploy, ctxPath=/drools-guvnor,
warUrl=.../tmp/deploy/tmp48046drools-guvnor-exp.war/
14:01:01,820 INFO  [STDOUT] ERROR 26-05 14:01:01,820
(BundleDbPersistenceManager.java:loadBundle:1228)failed to read bundle:
cafebabe-cafe-babe-cafe-babecafebabe: java.lang.IllegalStateException:
URIIndex not valid? javax.jcr.NamespaceException: URI for index 11 not
registered.
14:01:01,930 INFO  [STDOUT] ERROR 26-05 14:01:01,930
(ConnectionRecoveryManager.java:logException:447)could not execute
statement, reason: The statement was aborted because it would have caused a
duplicate key value in a unique or primary key constraint or unique index
identified by 'SQL100526101110450' defined on 'DEFAULT_BUNDLE'., state/code:
23505/2
14:01:01,930 INFO  [STDOUT] ERROR 26-05 14:01:01,930
(BundleDbPersistenceManager.java:storeBundle:1270)   failed to write bundle:
cafebabe-cafe-babe-cafe-babecafebabe
ERROR 23505: The statement was aborted because it would have caused a
duplicate key value in a unique or primary key constraint or unique index
identified by 'SQL100526101110450' defined on 'DEFAULT_BUNDLE'.
at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)
at
org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(Unknown
Source)
at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(Unknown 
Source)
at org.apache.derby.impl.sql.execute.IndexChanger.insert(Unknown Source)
at org.apache.derby.impl.sql.execute.IndexSetChanger.insert(Unknown 
Source)
at org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(Unknown
Source)
at
org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknown
Source)
at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown 
Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown
Source)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:365)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:292)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:257)
at
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:237)
at
org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.storeBundle(BundleDbPersistenceManager.java:1267)
at
org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.putBundle(AbstractBundlePersistenceManager.java:703)
at
org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.store(AbstractBundlePersistenceManager.java:643)
at
org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.store(BundleDbPersistenceManager.java:526)
at
org.apache.jackrabbit.core.state.SharedItemStateManager.createRootNodeState(SharedItemStateManager.java:1084)
at
org.apache.jackrabbit.core.state.SharedItemStateManager.init(SharedItemStateManager.java:194)
at
org.apache.jackrabbit.core.RepositoryImpl.createItemStateManager(RepositoryImpl.java:1201)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doInitialize(RepositoryImpl.java:1753)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(RepositoryImpl.java:1724)
at
org.apache.jackrabbit.core.RepositoryImpl.initWorkspace(RepositoryImpl.java:576)
at
org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:415)
at
org.apache.jackrabbit.core.RepositoryImpl.init(RepositoryImpl.java:305)
at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:557)
at
org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:245)
at
org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:265)
at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:333)
at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:363)
at
org.drools.guvnor.server.repository.BRMSRepositoryConfiguration.newSession(BRMSRepositoryConfiguration.java:112)
at

Re: [rules-users] Help needed - Problems with forall operator

2009-11-07 Thread Tom.E.Murphy
Thanks, everyone, for your insightful responses. You've made my day...

Tom Murphy
Business Process Consultant
Wells Fargo HCFG - CORE Deal Decisioning Platform
800 S. Jordan Creek Parkway | West Des Moines, IA 50266
MAC: X2301-01B
Office: 515 324 4853 | Mobile: 941 320 8014
This message may contain confidential and/or privileged information.  If you 
are not the addressee or authorized to receive this for the addressee, you must 
not use, copy, disclose, or take any action based on this message or any 
information herein.  If you have received this message in error, please advise 
the sender immediately by reply e-mail and delete this message.  Thank you for 
your cooperation.

--

Message: 1
Date: Sat, 7 Nov 2009 09:55:37 +0100
From: Wolfgang Laun wolfgang.l...@gmail.com
Subject: Re: [rules-users] Help needed - Problems with forall operator
To: Rules Users List rules-users@lists.jboss.org,
ed.tire...@gmail.com
Message-ID:
17de7ee80911070055k2469051agfebf3a5be24c7...@mail.gmail.com
Content-Type: text/plain; charset=iso-8859-1

Here's the explanation why Tom's version does not work. The first pattern of
a forall defines the domain, which is: all CreditReport facts; for each
object in this domain, the remaining patterns must match; since the FICO
pattern merely ascertains the existence of a single FICO chained to a parent
CreditReport with validScoreIndicator false, it fires as soon as there is
one for each of the existing CreditReports.

Jared's solution has the CreditReport CE in front of the forall, unadorned
with any quantifier, and the innate behavior of Drools makes sure that the
hole thing will be tried, once, for any existing CreditReport anyway. Then,
the forall domain is now FICOs with that CR's id and valid == false - but
what is the CE? I guess that Drool's behavior is somewhat off the
definition, using just FICO() - i.e., all existing FICO objects - as the
domain. (However, I think that Edson changed this recently for 5.1.0.) Thus,
Jared's rule indeed fires only when all FICOs are linked to the CreditReport
are false, but it fails to do so as soon as there is at least one other FICO
with either a different parent, or valid.

Therefore, to be on the safe side with multiple CreditReport facts and
assorted FICO's being in WM at the same time, I propose this rule:

rule somerule2
when
report: CreditReport( $parentCreditReport_1_Id : myId)
forall ( $f : FICO( parentId == $parentCreditReport_1_Id )
 FICO( this == $f, validScoreIndicator == false) )
then
System.out.println(somerule2 fired on  + $parentCreditReport_1_Id );
end

Here, the domain is explicitly given as all FICOs of the current CR; and for
all of them valid must be false.

Still, this solution is not perfect: It would also fire in the absence of
any FICO for some CR. To fix this, add a guard against there being no FICOs
for the current CR:

report: CreditReport( $parentCreditReport_1_Id : myId)
exists FICO( parentId == $parentCreditReport_1_Id )
forall ( $f : FICO( parentId == $parentCreditReport_1_Id )
 FICO( this == $f, validScoreIndicator == false) )

To complete the picture, one might equally well use the negation of forall,
which would have to be propagated into the predicate (read '|' as so
that):
forall x in D | P(x) = not existst x in D | not P(x)

Now the condition delimiting the domain and the negated predicate can be
merged again into one CE:

rule somerule3
when
report: CreditReport( $parentCreditReport_1_Id : myId)
exists FiCo( parentId == $parentCreditReport_1_Id )
not ( exists FiCo( parentId == $parentCreditReport_1_Id, validScore ==
true) )
then
System.out.println(somerule3 fired on  + $parentCreditReport_1_Id );
end

-W

On Fri, Nov 6, 2009 at 9:45 PM, Jared Davis sun...@davisprogramming.comwrote:

 I think this usage may work for your case.

 rule somerule
  when
report: CreditReport( $parentCreditReport_1_Id : myId)
forall (
   FICO( parentId == $parentCreditReport_1_Id, validScoreIndicator ==
 false)
)
  then
 System.out.print(Fired on  + $parentCreditReport_1_Id );
 end



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

-- next part --
An HTML attachment was scrubbed...
URL: 
http://lists.jboss.org/pipermail/rules-users/attachments/20091107/9bc576d5/attachment-0001.html
 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help Needed on BRMS with Tomcat

2008-03-03 Thread SB.Raghavendra
Hi All,
Iam very new to Drools BRMS.In one of the project we are implementing
drools.Currentluy iam working on BRMS.I have downloaded Insurance Example
from Jboss and deployed in BRMS.I have downloaded Binary package to
c:\Raghu.Now i want to use this downloaded binary package in one of my
rule project and wants to execute.I written following lines of code in the
main executable class :

*

package* com.test;

*

import* java.io.FileInputStream;
*

import* java.io.InputStreamReader;
*

import* java.io.Reader;

*

import* org.drools.RuleBase;
*

import* org.drools.RuleBaseFactory;
*

import* org.drools.StatefulSession;
*

import* org.drools.compiler.PackageBuilder;

*public* *class* Test1 {

/**

* [EMAIL PROTECTED] args

*/

*public* *static* *void* main(String[] args) *throws* Exception{

// *TODO* Auto-generated method stub

System.*out*.println(Method Starts...);

PackageBuilder builder = *new* PackageBuilder();

Reader source = *new* InputStreamReader(*new* FileInputStream(
testpackage.pkg));

System.*out*.println(Got source..);

//PackageBuilder builder = new PackageBuilder(new
Package(/testpackage.pkg));

builder.addPackageFromDrl(source);

//builder.addPackage(new PackageDescr(/testpackage.pkg));

System.*out*.println(After adding package : +builder.getPackage());

RuleBase ruleBase = RuleBaseFactory.*newRuleBase*();

ruleBase.addPackage(builder.getPackage());

StatefulSession session = ruleBase.newStatefulSession();

//RuleAgent.

Person adult = *new* Person(Raghu,25);

//Person child = new Person(John,12);

session.insert(adult);

session.fireAllRules();

System.*out*.println(Method Ends...);

}

}
But iam getting follwing error on console :

Exception in thread main *
org.drools.compiler.PackageBuilder$MissingPackageNameException*: Missing
package name for rule package.

at org.drools.compiler.PackageBuilder.validatePackageName(*
PackageBuilder.java:320*)

at org.drools.compiler.PackageBuilder.addPackage(*PackageBuilder.java:236*)

at org.drools.compiler.PackageBuilder.addPackageFromDrl(*PackageBuilder.java
:167*)

at com.test.Test1.main(*Test1.java:29*)

I kept downloaded pkg in the Rules project.

Iam trying to execute in Eclipse.Tomcat version 6.016.Could you please let
me know how to resolve the isse

Also Please let me know how to use the Binay package of BRMS..


-- 
Regards,
SB.Raghavendra.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help Needed.

2007-06-05 Thread Fernando Meyer

Hi Rajesh,

	You MUST use the org.drools.util.BinaryRuleBaseLoader to load a  
precompiled binary package into your RE classes.


public void testLoadAndExecBinary() throws Exception {
Person p = new Person();
BinaryRuleBaseLoader loader = new BinaryRuleBaseLoader();
loader.addPackage( this.getClass().getResourceAsStream( / 
RepoBinPackage.pkg ) );

RuleBase rb = loader.getRuleBase();
StatelessSession sess = rb.newStatelessSession();
sess.execute( p );
assertEquals(42, p.getAge());
}


Fernando Meyer
[EMAIL PROTECTED]
GPG: 5A6D 3374 B055 A513 9A02  A03B 3DB3 7485 D804 DDFB


On Jun 1, 2007, at 3:16 AM, Rajesh_Kumar wrote:



hi ,

First of all congratulations to you for JBRMS release.

You and your team has done a great job.


Micheal I am facing some issue , when I use jbrms.

I have written a sample technical rule by following all the steps  
as mentioned in the document.


I am able to download binary package also,but when I tried to use  
this package in my rule engine class using following code it’s  
giving some error like …




 FileInputStream fis = new FileInputStream( C:/drools/ 
TestPackage.pkg );


 ObjectInputStream ois = new ObjectInputStream( fis );

 Object objPackage = ois.readObject() ;


 when  ObjectInputStream object tries to read the object , its  
giving some  an error


  ois.close();

  fis.close();

Could you please help me out for this …

java.io.InvalidClassException: org.drools.rule.Rule; incompatible  
types for field salience


at java.io.ObjectStreamClass.matchFields(Unknown Source)

at java.io.ObjectStreamClass.getReflector(Unknown Source)

at java.io.ObjectStreamClass.initNonProxy(Unknown Source)

at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)

at java.io.ObjectInputStream.readClassDesc(Unknown Source)

at java.io.ObjectInputStream.readOrdinaryObject(Unknown  
Source)


at java.io.ObjectInputStream.readObject0(Unknown Source)

at java.io.ObjectInputStream.readObject(Unknown Source)

at java.util.HashMap.readObject(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown  
Source)


at java.lang.reflect.Method.invoke(Unknown Source)

at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)

at java.io.ObjectInputStream.readSerialData(Unknown Source)

at java.io.ObjectInputStream.readOrdinaryObject(Unknown  
Source)


at java.io.ObjectInputStream.readObject0(Unknown Source)

at java.io.ObjectInputStream.readObject(Unknown Source)

at org.drools.rule.PackageCompilationData.readExternal 
(PackageCompilationData.java:128)


at java.io.ObjectInputStream.readExternalData(Unknown Source)

at java.io.ObjectInputStream.readOrdinaryObject(Unknown  
Source)


at java.io.ObjectInputStream.readObject0(Unknown Source)

at java.io.ObjectInputStream.readObject(Unknown Source)

at org.drools.rule.Package.readExternal(Package.java:160)

at java.io.ObjectInputStream.readExternalData(Unknown Source)

at java.io.ObjectInputStream.readOrdinaryObject(Unknown  
Source)


at java.io.ObjectInputStream.readObject0(Unknown Source)

at java.io.ObjectInputStream.readObject(Unknown Source)

at com.sample.DroolsTest.readRule(DroolsTest.java:36)

at com.sample.DroolsTest.main(DroolsTest.java:17)


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help needed in using working memory logger !

2007-05-08 Thread Kris Verlaenen
The WorkingMemoryFileLogger creates a list of relevant events (you can use 
filters to define which events are relevant for you) and just stores that as 
XML in the specified file.  This log file is not intended to be used directly 
(as it is indeed very complex).  The easiest way to see the content of the file 
in a user-friendly manner is to use the eclipse IDE and use the audit view to 
open the file.  This view will then parse the content of the file and show it 
in a tree-like structure.

If you would like to personally define how events are written out to a log 
file, you can always extend the abstract WorkingMemoryLogger and define how 
events should be written out in the logEventCreated(LogEvent) method.

Any contributions to making auditing more configurable are greatly appreciated 
! ;)

Kris

  - Original Message - 
  From: nicolae oana 
  To: Rules Users List 
  Sent: Monday, May 07, 2007 6:56 PM
  Subject: Re: [rules-users] Help needed in using working memory logger !


  Dear Kris,

  I try to create a filter for my logger, in order to obtain some simple output 
(e.g. list modified objects), but the output is still very complex :( . I think 
that I did something wrong.

  Here is the code:

  final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger( 
workingMemory );
  logger.setFileName( log/testRules );
  ILogEventFilter filter = new ILogEventFilter(){
   
   public boolean acceptEvent(LogEvent event){
   
  if(event.getType()== LogEvent.OBJECT_MODIFIED)
 {
  logger.logEventCreated(event);
  
  return true;
  }
 return false;
   }
   };  

  logger.addFilter(filter);
  logger.writeToDisk();
 
  With kind regards,
Oana 


  Kris Verlaenen [EMAIL PROTECTED] wrote:
You just need to create a class that implements this interface and that 
determines which events should be logged (see the javadoc of the filter and the 
working memory logger).  See ActivationLogEventFilter and 
WorkingMemoryLogEventFilter for an example.  You can add your filter to the 
logger using the addFilter(ILogEventFilter) method.

Kris

  - Original Message - 
  From: nicolae oana 
  To: Rules Users List 
  Sent: Monday, May 07, 2007 3:22 PM
  Subject: [rules-users] Help needed in using working memory logger !



  Hi everybody,

  I try to define an ILogEventFilter on the working memory logger, but I 
didn't find anything about how to do this, on the available documentation.

  Please help me with some information about the Logger and its 
functionality!

  With kind regards, 
 Oana







--
  Ahhh...imagining that irresistible new car smell?
  Check out new cars at Yahoo! Autos. 

--

  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
  Ahhh...imagining that irresistible new car smell?
  Check out new cars at Yahoo! Autos. 


--


  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help Needed on garbage collection

2007-02-19 Thread shilpa.raghavendra

Hi,

 

I need to know how garbage collection will happen in Drools.

 

Because my system is taking too much time to execute the
business logic.

 

Please tell me how to rectify it?

 

One more question I will generate the email content
dynamically and send to the client but what will happening is it's
taking same content for all mail I think the 

 

Last content.

 

For example

 

Through business rule it has generated three mails and it has to send to
supervisor then all mail contains last main information like name,
Address etc. Please tell me how to rectify it.

 

 

I need to know how to assert two object of same type and
refer then in .drl file.

 

I need to know how to access string array.

 

 

Regards

Shilpa

 




The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.
 
www.wipro.com___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] Help Needed

2007-02-13 Thread shilpa.raghavendra



Thanks a lot Steve it worked fine.



 I need some more information on Agenda Groups. How we can use and
which scenario we can issue?

  

Thanks  Regards

Shilpa  

 



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Williams
Sent: Tuesday, February 13, 2007 9:21 AM
To: Rules Users List
Subject: Re: [rules-users] Help Needed


Hi Shilpa,

You can pass your DAOs (or any other object) into the working memory as
globals and then use them in the consequence of your rules.

cheers
Steve


On 2/13/07, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote: 

Hi,

 

I am using Drools 3.0 in our business logic. I need help in
the below situation

 

 

I will take the records from the database on daily basis and
each record is fact in the rule engine

 

I will check the fact against some constant value; if it
satisfies the condition then I need to update one field in the database.

 

I am using Ibatis as DAO framework. 

 

How I can connect to database in .drl file?

 

Please help me.

 

Thanks  Regards

Shilpa

 


The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s)
and may contain proprietary, confidential or privileged information. If
you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email. 

www.wipro.com


___
rules-users mailing list
rules-users@lists.jboss.org  mailto:rules-users@lists.jboss.org 
https://lists.jboss.org/mailman/listinfo/rules-users






-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] 
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference 




The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.
 
www.wipro.com___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help Needed

2007-02-12 Thread shilpa.raghavendra

Hi,

 

I am using Drools 3.0 in our business logic. I need help in
the below situation

 

 

I will take the records from the database on daily basis and
each record is fact in the rule engine

 

I will check the fact against some constant value; if it
satisfies the condition then I need to update one field in the database.

 

I am using Ibatis as DAO framework. 

 

How I can connect to database in .drl file?

 

Please help me.

 

Thanks  Regards

Shilpa

 




The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.
 
www.wipro.com___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help Needed

2007-02-12 Thread Steven Williams

Hi Shilpa,

You can pass your DAOs (or any other object) into the working memory as
globals and then use them in the consequence of your rules.

cheers
Steve

On 2/13/07, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:


 Hi,



I am using Drools 3.0 in our business logic. I need help in
the below situation





I will take the records from the database on daily basis and
each record is fact in the rule engine



I will check the fact against some constant value; if it
satisfies the condition then I need to update one field in the database.



I am using Ibatis as DAO framework.



How I can connect to database in *.drl* file?



Please help me.



Thanks  Regards

Shilpa



The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s) and
may contain proprietary, confidential or privileged information. If you are
not the intended recipient, you should not disseminate, distribute or copy
this e-mail. Please notify the sender immediately and destroy all copies of
this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses. The
company accepts no liability for any damage caused by any virus transmitted
by this email.

www.wipro.com

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users