Branch date for 5.2.x (= CR 1 and final): Thursday 28-APR 8:00 GMT
by Geoffrey De Smet
Next Thursday morning, we'll branch the 5.2.x release branch which will
spawn 5.2.0.CR1 and 5.2.0 itself.
All bugfixes and documentation updates should be pushed by Wednesday
27-APR evening to master.
Don't push any risky new features to master at this time.
Note that the documentation is included in the download zips,
so changes to the documentation after the branch date won't make the
download zip of 5.2.0.
--
With kind regards,
Geoffrey De Smet
13 years, 8 months
decision table building => NPE
by Wolfgang Laun
After pull from upstreammaster and mvn.
This used to work not so long ago; easy to follow:
KnowledgeBuilderImpl:
public void add(Resource resource, ResourceType type) {
pkgBuilder.addKnowledgeResource( resource, type, null ) ;
// Note the null!
}
PackageBuilder:
DecisionTableConfiguration dtableConfiguration =
(DecisionTableConfiguration) configuration;
String string =
DecisionTableFactory.loadFromInputStream( resource.getInputStream(),
dtableConfiguration ); // the null thing!
DecisionTableFactory:
public static String loadFromInputStream(InputStream is,
DecisionTableConfiguration configuration) {
return getDecisionTableProvider().loadFromInputStream( is,
configuration ); // the null thing!
}
DecisionTableProviderImpl:
public String loadFromInputStream(InputStream is,
DecisionTableConfiguration
configuration) {
return compileStream( is,
configuration ); // the null thing!
}
private String compileStream(InputStream is,
DecisionTableConfiguration configuration) {
SpreadsheetCompiler compiler = new SpreadsheetCompiler();
switch ( configuration.getInputType() ) {
// NPE
Exception in thread "main" java.lang.NullPointerException
at org.drools.decisiontable.DecisionTableProviderImpl.compileStream(DecisionTableProviderImpl.java:26)
at org.drools.decisiontable.DecisionTableProviderImpl.loadFromInputStream(DecisionTableProviderImpl.java:19)
at org.drools.compiler.DecisionTableFactory.loadFromInputStream(DecisionTableFactory.java:18)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:497)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at rss.drools.setup.Application.setup(Application.java:47)
-W
13 years, 8 months
Package building with declared model broken
by Michael Anstis
Hi,
This boiler plate code demonstrates a rather, I suspect large, problem:-
@Test
public void testPackageAttributesFromDRL() {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( new ClassPathResource( "org/drools/example.drl"
), ResourceType.DRL
); //<--- Error
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
}
throws:-
java.lang.NullPointerException
at
org.drools.compiler.PackageBuilder.generateDeclaredBean(PackageBuilder.java:1433)
at
org.drools.compiler.PackageBuilder.processTypeDeclarations(PackageBuilder.java:1272)
at
org.drools.compiler.PackageBuilder.mergePackage(PackageBuilder.java:895)
at
org.drools.compiler.PackageBuilder.newPackage(PackageBuilder.java:883)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:601)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:297)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:473)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at
org.drools.BinaryPackage.testPackageAttributesFromDRL(BinaryPackage.java:35)
In org.drools.compiler.PackageBuilder.generateDeclaredBean the call to the
following returns null.
JavaDialectRuntimeData dialect = (JavaDialectRuntimeData)
pkgRegistry.getDialectRuntimeRegistry().getDialectData( "java" );
DRL is:-
package example
declare Person
age: Integer
name: String
end
rule "Row 1 dtable"
salience 1
dialect "mvel"
when
$p : Person( name == "Bill" , age != "30" )
then
$p.setAge( 12345 );
end
It worked OK yesterday.
Any takers?
With kind regards,
Mike
13 years, 8 months
To match or not to match...
by Wolfgang Laun
The following is (hrrmph) difficult to understand. It was produced with a
very recent build of droolsjbpm/master.
rule "articles of a customer"
when
$c: Customer( 150 <= custid <= 250 )
$a: Article( $a1: artid, $a2: artname, custid == $c.getCustid() || == 3
)
then
System.out.println( "Customer " + $c.getCustid() );
System.out.println( " Article " + $a.getArtid() + " " + $a.getArtname()
+ " by " + $a.getCustid() );
end
Customer 3
Article 300 micro by 3
Customer 2
Article 300 micro by 3
Customer 1
Article 300 micro by 3
Customer 2
Article 300 speakers by 2
Customer 1
Article 200 mouse by 1
Customer 1
Article 100 keyboard by 1
-W
13 years, 8 months
Drools-friendly licenses?
by Michael Anstis
Hi,
Does anybody have a list of open source licenses we're OK to use?
I know Mark's quite keen on following the correct path to enlightenment.
Is Mozilla Public License Version 1.0 OK?
Cheers,
Mike
13 years, 8 months
Backwards chaining: the difference between input and output variables
by Geoffrey De Smet
Mark and I were discussing backwards chaining
http://blog.athico.com/2011/04/backward-chaining-emerges-in-drools.html
on IRC and we 'd like your opinion on a design issue.
The example
========
Let's say you have this data:
Location("crackers", "kitchen")
Location("apple", "kitchen")
Location("chocolate", "living room")
Location("chips", "living room")
Let's say you have this code:
|query| |editableThings( String thing, String location ) |
|||Location(thing, location)|
|end|
And then these 3 rules:
|rule| |outputinput
||when|
|||Here( loc : location) |
|||?||editableThings||(food, ||loc||;)|
|then|
System.out.println("Food " + f + " at location " + loc);
// Output:
// Food crackers at location kitchen
// Food apple at location kitchen
|end
|
|rule| |outputOutput
||when|
|||?||editableThings||(food, ||loc||;)|
|then|
System.out.println("Food " + f + " at location " + loc);
// Output:
// Food crackers at location kitchen
// Food apple at location kitchen
// Food chocolate at location living room
// Food chips at location living room
|end
|
|rule| |typo
||when|
|||Here( looc : location) |
|||?||editableThings||(food, ||loc||;)|
|then|
System.out.println("Food " + f + " at location " + loc);
// Output:
// Food crackers at location kitchen
// Food apple at location kitchen
// Food chocolate at location living room
// Food chips at location living room
|end|
The discussion
=========
Both rules have the same statement:
|?||editableThings||(food, ||loc||;)|
||In the outputInput rule, "|||loc|||" is an input variable.
||In the outputOutput rule, "|||loc|||" is an output variable.
I am wondering if we don't need a visual demarcation that a variable is
an output variable,
to make it stand out of an input variable?
Proposition 1: Suffix output variables with ":"
|rule| |outputinput
||when|
|||Here( loc : location) |
|||?||editableThings||(food:, ||loc||;)|
|then ... end
|
|rule| |outputOutput
||when|
|||?||editableThings||(food:, ||loc:||;)|
|then ... end|||
|rule| |typo
||when|
|||Here( looc : location) |
|||?||editableThings||(food:, ||loc||;) // compiler error because input
variable loc is not declared|||
|then ... end|
--
With kind regards,
Geoffrey De Smet
13 years, 8 months