Facing Problem in BRL
by Sumeet Karawal
Hi,
I am using Drools-Expert. I am having a class "Person" with data members as
age and discount.
I am trying to create a .brl. I have these statements in drools.package
package com.rules;
import com.model.PersonDetails;
and in the example.brl I am providing the details of when and then
conditions
but on execution I am getting the following error :
java.lang.RuntimeException: [4] Unable to expand: PersonDetails( age <
"20" )[6] Unable to expand: PersonDetails fact0 = new PersonDetails
();[7] Unable to expand: fact0.setDiscount( 10 );[8] Unable to
expand: insert(fact0 );
It would be helpful is somebody guide me on how execute it.
Also, I am creating the knowledgebase as:
private static KnowledgeBase createKnowledgeBase() {
KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
builder.add (ResourceFactory.newClassPathResource(
"com/rules/example.brl"),ResourceType.BRL);
if (builder.hasErrors()) {
throw new RuntimeException (builder.getErrors().toString ());
}
KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages ());
return knowledgeBase;}
Thanks & Regards,
Sumeet Karawal
CEG - Open Source Technology Group
Tata Consultancy Services
Ph:- +912267782556
Cell:- +919833236440
Mailto: sumeet.karawal(a)tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
14 years, 11 months
How to run one example of drools in eclipse?
by clement.pernot
hi,
I have download: "Drools Examples" on http://www.jboss.org/drools/downloads
I use eclipse in order to build.
I have follow this:
https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/blob/master/READ...
in order to configure eclipse.
I don't know what i must do.
After one build i got this:
Apache Maven 3.0.2 (r1056850; 2011-01-09 01:58:10+0100)
Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
Java home: /home/newel/eclipse/jre
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "2.6.35-28-generic", arch: "i386", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from EMBEDDED/conf/settings.xml
[DEBUG] Reading user settings from /home/newel/.m2/settings.xml
[DEBUG] Using local repository at /home/newel/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for
/home/newel/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Verifying availability of
/home/newel/.m2/repository/org/drools/drools/5.1.1/drools-5.1.1.pom from
[central (http://repo1.maven.org/maven2, releases=true, snapshots=false,
managed=false)]
[DEBUG] Using connector AsyncRepositoryConnector with priority 100 for
http://repo1.maven.org/maven2
[DEBUG] Reading resolution tracking file
/home/newel/.m2/repository/org/drools/drools/5.1.1/drools-5.1.1.pom.lastUpdated
[DEBUG] Writing resolution tracking file
/home/newel/.m2/repository/org/drools/drools/5.1.1/drools-5.1.1.pom.lastUpdated
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were
encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Could not find artifact
org.drools:drools:pom:5.1.1 in central (http://repo1.maven.org/maven2) and
'parent.relativePath' points at wrong local POM @ line 5, column 11
at
org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:325)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:632)
at
org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:581)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:233)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[ERROR]
[ERROR] The project org.drools:drools-examples:5.1.1
(/home/newel/workspace/drools-5.1.1-examples/drools-examples/pom.xml) has 1
error
[ERROR] Non-resolvable parent POM: Could not find artifact
org.drools:drools:pom:5.1.1 in central (http://repo1.maven.org/maven2) and
'parent.relativePath' points at wrong local POM @ line 5, column 11 -> [Help
2]
org.apache.maven.model.resolution.UnresolvableModelException: Could not find
artifact org.drools:drools:pom:5.1.1 in central
(http://repo1.maven.org/maven2)
at
org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:183)
at
org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:819)
at
org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:670)
at
org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:308)
at
org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)
at
org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:354)
at
org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:305)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:632)
at
org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:581)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:233)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could
not find artifact org.drools:drools:pom:5.1.1 in central
(http://repo1.maven.org/maven2)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:526)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:214)
at
org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:179)
... 21 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not
find artifact org.drools:drools:pom:5.1.1 in central
(http://repo1.maven.org/maven2)
at
org.sonatype.aether.connector.async.AsyncRepositoryConnector$3.wrap(AsyncRepositoryConnector.java:1409)
at
org.sonatype.aether.connector.async.AsyncRepositoryConnector$3.wrap(AsyncRepositoryConnector.java:1404)
at
org.sonatype.aether.connector.async.AsyncRepositoryConnector$GetTask.flush(AsyncRepositoryConnector.java:895)
at
org.sonatype.aether.connector.async.AsyncRepositoryConnector$GetTask.flush(AsyncRepositoryConnector.java:889)
at
org.sonatype.aether.connector.async.AsyncRepositoryConnector.get(AsyncRepositoryConnector.java:276)
at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:438)
... 23 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2]
http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-run-one-example-of-drools-in-ecl...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Drool 5 memberOf problem
by dxande6
I'm trying to validate that there is a Factor in a collection using the
global variable ownedProductFactorSet. I'm having trouble. I do not get an
error, it just doesn't resolve to true. I've validated the
ownedProductFactor set has the Factor
Java class that is contained withing the ownedProductFactorSet:
Factor
String key
String value
Here is the code in the drl:
global Set ownedProductFactorSet;
rule "Owned Products"
ruleflow-group "discount-pricing"
lock-on-active true
when
not Factor(key == FactorKeys.DISCOUNT)
String(FactorKeys.PHONE_PACKAGE memberOf ownedProductFactorSet)
Factor(key == RulesKeys.WIRELESS)
then
logger(kcontext).info("SUCCESS - *******************************");
insert(new Factor(FactorKeys.DISCOUNT)); end
It never gets to the consequence (RHS - "then" part) of this rule.
If I comment out the following line:
String(FactorKeys.PHONE_PACKAGE memberOf ownedProductFactorSet) It
will work.
Any help with the memberOf keyword is greatly appreciated.
Thanks,
-dxande6
--
View this message in context: http://drools.46999.n3.nabble.com/Drool-5-memberOf-problem-tp2953475p2953...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Rete
by Abhay B. Chaware
Have been reading about how Rete operates and how Drools implements Rete and so on .. and that Rete builds a network of nodes and each node is a pattern and has memory of facts which satisfy the pattern .... just as a curiosity, how does this all work internally ? what does it mean when they say that it builds a network .. and nodes are shared and attached .. what does really happen internally ?
Thanks
14 years, 11 months
Architectural problems and web service call
by Yoann Charpiot
Hi,
I'm new on Drools and i try to understand the architecture of the suite and
the dependencies between Guvnor and Expert.
I want to know if there is a physical link between the repository of rules
managed by Guvnor and the rules engine Expert when playing a rule in
production.
if not, is it possible to modify a rule in production without an IT
redeployment?
More generally, how are persist rules in the repository? Is it possible to
save them in a database or is it only persist in cache? if you have any
documentation on that.
And last question, do you have any documentation on how to expose a service
rule as a web service and how to consume it with the API?
Thanks you for your feedback.
14 years, 11 months
Use of StatelessKnowledgeSession
by aminmc
Hi there
I was wondering if someone might be able to help with what I am trying to
do. I have the following rule definition:
rule "open work item"
when
Task ( status == "OPEN")
then
insert(new Action("Take","take_task"));
insert(new Action("Complete","complete_task"));
insert(new Action("Close","close_task"));
end
Basically I want to insert a Task and then get back a list of Actions that
are available for the Task (based on the status. I have this working with a
statefulknowledgesession with the code:
List<Command> commands = new ArrayList<Command>();
for (Task task : tasks) {
commands.add(CommandFactory.newInsert(task));
}
session.execute(CommandFactory.newBatchExecution(commands));
session.fireAllRules();
session.dispose();
//this returns the actions
Collection objects = session.getObjects(new
ClassObjectFilter(Action.class));
I was wondering whether it is possible to do this with a
statelessknowledgesession instead? I could'nt see how to achieve this
without updating the task to include the actions.
Any help would be appreciated.
Cheers
--
View this message in context: http://drools.46999.n3.nabble.com/Use-of-StatelessKnowledgeSession-tp2828...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Cast error message and DSL
by Giorgio Spagnardi
Hi to all,
I used the business rule guided editor to write a new rule. I'm verifying
the wrtitten rule but Guvnor returns the error message:
[MyRule] Unable to build expression for 'consequence': [Error: unable to
cast type: int; to: class java.lang.Integer] [Near : {...
tValue()));drools.update($sa); ....}] ^
[Line: 1, Column: 67] ' $sa.setBonusEsclusivo(percentuale(25,
((Integer)$cm).intValue()));update($sa);'
In DSL there is: [consequence][] Assign customer bonus of {num} percent=
$sa.setBonusEsclusivo(percentuale({num},
((Integer)$cm).intValue()));update($sa);
I didn't find a similiar error message....
Thanks in advance,
G.
--
View this message in context: http://drools.46999.n3.nabble.com/Cast-error-message-and-DSL-tp2951642p29...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Drools with LDAP
by Sumeet Karawal
Hi,
Is it possible to integrate Drools - BRMS with LDAP. I want to use roles
defined in LDAP as roles for BRMS for role based access of rules. Also can
it be Integrated with any Reporting tool.
Thanks & Regards,
Sumeet Karawal
Mailto: sumeet.karawal(a)tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
14 years, 11 months
unable to determine operator for symbol [before]
by vladimiro
Hi all,
I'm building a KnowledgeBase with KnowledgeAgent and a precompiled
rule package. When the package contains a rule using temporal operators
such "after" or "before" I get the exception listed at the end of this
message.
I'm using the latest version of drools 5 and my runtime configuration
includes the following libraries:
* drools-core - the rule engine itself.
* drools-api
* mvel2-2.0.10
* joda-time-1.6
the rule causing such a behaviour is:
rule 'Test2'
dialect 'mvel'
when
u1:UserType( firstName=="UserA" )
lie:UserEventType( event=="Login", user.id==u1.id)
loe:UserEventType(event=="Logout", user.id==u1.id, this before lie)
then
Message msg = new Message();msg.setText("Test2
fired");driver.getMessages().add(msg);
end
java.lang.RuntimeException: KnowledgeAgent exception while trying to
deserialize KnowledgeDefinitionsPackage
at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:418)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:120)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:109)
at
info.vladimiro.tesi.peservice.KnowledgeBaseService.<init>(KnowledgeBaseService.java:94)
at
info.vladimiro.tesi.peservice.KnowledgeBaseService.getInstance(KnowledgeBaseService.java:65)
at
info.vladimiro.tesi.peservice.PEListener$KBTask.run(PEListener.java:35)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: org.drools.RuntimeDroolsException: unable to determine
operator for symbol [before]
at
org.drools.base.evaluators.Operator.determineOperator(Operator.java:71)
at org.drools.base.evaluators.Operator.readResolve(Operator.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1033)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1728)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.base.BaseEvaluator.readExternal(BaseEvaluator.java:53)
at ...
Can someone help? Thanks in advance.
Vladimiro Corsi
14 years, 11 months