How to migrate data from Guvnor 5.1.1 to 5.3.3.Final version.
by LaKhI ReDdY!!!!!!!!!!!
Hi ,
I need information on how to migrate existing repository from Guvnor 5.1.1
to 5.3.3.Final version.
Currently i am using Guvnor 5.1.1 version and data is stored in Oracle
database. I am moving to Guvnor 5.3.3.Final version.
I would like to migrate the existing data from Guvnor 5.1.1 to 5.3.3.Final
instance.
One way i see is export from Guvnor 5.1.1 and import the exported xml in
Guvnor 5.3.3.Final instance.
Is there any other way to migrate the data?
Regards,
Lakshmi Reddy
10 years, 6 months
Usage of List in Drools 5.5.0
by Rajeswari Devadass
Created a Model in Guvnor 5.5.0 with 3 fields - 2 Text, 1 java.util.List
The model is verified and validated - correctly.
Source looks like below
declare FormatConfig
fieldName: String
regEx: String
regExPatterns: java.util.List
end
While trying to create a Business Rule using the above created Model. The
rule gets fired and works fine.
rule "MyFormat"
dialect "mvel"
when
config : FormatConfig( fieldName == "AMOUNT" )
then
config.setRegEx( "123" );
retract( config );
end
But, the moment I try to use the List, by only declaring a List in the
"When" section, the rule stops working.
rule "MyFormat"
dialect "mvel"
when
config : FormatConfig( fieldName == "AMOUNT" )
regExPatterns1: java.util.List ( )
then
config.setRegEx( "123" );
retract( config );
end
My final intention is to modify the regExPatterns list in the "THEN" block
10 years, 6 months
kbase using kie
by Chris B
I am using 6.0.1 and having difficulties in kmodule.xml.
My goal is to have a directory where I can keep putting new rules which
should be automatically picked up.
But looks like drools is looking in the jar file for new rules.
What should be my entries.
My current kmodule.xml
###################
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="rules" packages="DRL" eventProcessingMode="stream">
<ksession name="ksession-rules"/>
</kbase>
</kmodule>
My pom.properties
####################
#Generated by Maven
#Wed Jun 25 17:53:00 PDT 2014
version=0.0.1
groupId=com.myc
artifactId=MyProject
The output which I am getting
#####################
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [INFO] Found kmodule:
jar:file:/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar!/META-INF/kmodule.xml
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [DEBUG] KieModule URL
type=jar
url=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Found and used
pom.properties META-INF/maven/com.myc/MyProject/pom.properties
2014-06-29 16:45:08 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Discovered
classpath module com.myc:MyProject:0.0.1
2014-06-29 16:45:09 o.d.c.k.b.i.KieRepositoryImpl [INFO] KieModule was
added:ZipKieModule[
ReleaseId=com.myc:MyProject:0.0.1file=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar]
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [INFO] Found kmodule:
jar:file:/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar!/META-INF/kmodule.xml
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [DEBUG] KieModule URL
type=jar
url=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Found and used
pom.properties META-INF/maven/com.myc/MyProject/pom.properties
2014-06-29 16:45:09 o.d.c.k.b.i.ClasspathKieProject [DEBUG] Discovered
classpath module com.myc:MyProject:0.0.1
2014-06-29 16:45:09 o.d.c.k.b.i.KieRepositoryImpl [INFO] KieModule was
added:ZipKieModule[
ReleaseId=com.myc:MyProject:0.0.1file=/home/chrism/apache-storm-0.9.1-incubating/lib/MyProject-0.0.1.jar]
2014-06-29 16:45:09 o.d.c.k.b.i.AbstractKieModule [WARN] No files found for
KieBase rules
----------------------------
As above it is not able to read the rules as the rules are located in the
filesystem somewhere else like in /a/b/c directory and it is in the
classpath, but not being read as it seems to be only looking in jar file
Any help greatly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/kbase-using-kie-tp4030187.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 6 months
Dynamic rules and inheritance
by ventilo35@free.fr
Hi
I'm exploring using dynamic rules (using Drools 6.0.0 Final), and I see a curious behaviour when the knowledge is built using inheritance.
What I notice is
- new rules which have conditions based on subclasses are fired all right
- but new rules which have conditions based on the base class are not always fired
- they are fired only if some initial rules where fired, based on the base class (?!?)
Here is an runnable example for clarity:
// knowledge classes
public static class Person {
private String firstName;
private String lastName;
public void setFirstName(String fname) {
this.firstName = fname;
}
public void setLastName(String lname) {
this.lastName = lname;
}
public String getFirstName() {
return this.firstName;
}
public String getLastName() {
return this.lastName;
}
}
public static class Contact extends Person {
private String msisdn;
public void setMsisdn(String m) {
this.msisdn = m;
}
public String getMsisdn() {
return this.msisdn;
}
}
// Drools session
KieServices ks = KieServices.Factory.get();
KieModuleModel kieModuleModel = ks.newKieModuleModel();
KieBaseModel kieBaseModel1 = kieModuleModel.newKieBaseModel( "rules")
.setDefault( true )
.setEqualsBehavior( EqualityBehaviorOption.EQUALITY )
.setEventProcessingMode( EventProcessingOption.STREAM );
KieSessionModel ksessionModel1 = kieBaseModel1.newKieSessionModel( "KSession1" )
.setDefault( true )
.setType( KieSessionModel.KieSessionType.STATEFUL )
.setClockType( ClockTypeOption.get("realtime") );
KieFileSystem kfs = ks.newKieFileSystem();
ReleaseId ri = ks.newReleaseId( "org.default", "artifact", "1.0.0" );
kfs.generateAndWritePomXML(ri);
// initial rules
kfs.write("src/main/resources/rules/initial.drl", ks.getResources().newFileSystemResource("src/main/resources/rules/initial.drl").setResourceType(ResourceType.DRL));
KieBuilder kieBuilder = ks.newKieBuilder( kfs ).buildAll();
KieContainer kContainer = ks.newKieContainer(ri);
KieSession kSession = kContainer.newKieSession();
Contact alice = new Contact();
alice.setFirstName("Alice");
alice.setLastName("Doe");
kSession.insert(alice);
Contact bob = new Contact();
bob.setFirstName("Bob");
bob.setLastName("Tester");
kSession.insert(bob);
kSession.fireAllRules();
// new rules
kfs = ks.newKieFileSystem();
ReleaseId ri2 = ks.newReleaseId( "org.default", "artifact", "1.1.0" );
kfs.generateAndWritePomXML(ri2);
kfs.write("src/main/resources/rules/initial.drl", ks.getResources().newFileSystemResource("src/main/resources/rules/initial.drl"));
kfs.write("src/main/resources/rules/newrules.drl", ks.getResources().newFileSystemResource("src/main/resources/rules/newrules.drl"));
kieBuilder = ks.newKieBuilder( kfs ).buildAll();
kContainer.updateToVersion(ri2);
kSession.fireAllRules();
initial.drl :
package com.sample
import com.sample.DroolsTest.Person;
import com.sample.DroolsTest.Contact;
rule "Hello World 1"
when
c: Contact()
then
System.out.println("initial, working, found Contact "+c.getFirstName());
end
rule "Hello World 2"
when
p: Person()
then
System.out.println("initial, working, found Person "+p.getFirstName());
end
newrules.drl :
package com.sample
import com.sample.DroolsTest.Person;
import com.sample.DroolsTest.Contact;
rule "Hello World 3"
when
c: Contact()
then
System.out.println("new rule, working, found Contact "+c.getFirstName());
end
rule "Hello World 4"
when
p: Person()
then
System.out.println("new rule, working, found Person "+p.getFirstName());
end
This examples produces :
initial, working, found Contact Bob
initial, working, found Contact Alice
initial, working, found Person Bob
initial, working, found Person Alice
new rule, working, found Contact Bob
new rule, working, found Contact Alice
new rule, working, found Person Bob
new rule, working, found Person Alice
But, if you comment out rule #2 in initial.drl, then the output becomes:
initial, working, found Contact Bob
initial, working, found Contact Alice
new rule, working, found Contact Bob
new rule, working, found Contact Alice
i.e. rule #4 isn't fired anymore...
Is this explainable?
Thanks
Francois
10 years, 6 months
Drools Session Persistence
by calcacuervo
Hey Guys.
I would like to persist a ksession in drools 6, but not every time I
interact with the session, as this would impact the performance and we have
lot of events and facts inserted per second.
Is this possible to manually persisting the session (for example, on
undeployment), and then, at the app startup load it?
Thanks!
Demian
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Session-Persistence-tp4030204.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 6 months