[JBoss JIRA] Created: (JBRULES-3065) Facts currently have to be Java Beans, but Mark has used POJOS, except the attached example does not work.
by Jim Tyrrell (JIRA)
Facts currently have to be Java Beans, but Mark has used POJOS, except the attached example does not work.
----------------------------------------------------------------------------------------------------------
Key: JBRULES-3065
URL: https://issues.jboss.org/browse/JBRULES-3065
Project: Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Reporter: Jim Tyrrell
Assignee: Mark Proctor
Attachments: Screen shot 2011-06-06 at 2.02.00 PM.png, Screen shot 2011-06-06 at 2.02.14 PM.png, Screen shot 2011-06-06 at 2.02.37 PM.png, SimpleSpreadSheetBasedPOJO.java, SimpleSpreadSheetBasedTest.drl, SimpleSpreadSheetBasedTest.java
When modeling spreadsheets for form/spreadsheet validation, see the attached screen shots, all of the tools use the convention of A, B, C for the column names (Open Office, Excel, and Numbers). When trying to create an object with variable names of A, B, etc, I get errors in the JBDS as the below:
Description Resource Path Location Type
BuildError: Unable to create Field Extractor for 'A' of '[ClassObjectType class=com.sample.SimpleSpreadSheetBasedPOJO]' in rule 'Validation 1' SimpleSpreadSheetBasedTest.drl /BugProject/src/main/rules line 16 Drools Error
No amount of massaging can get this error to go away.
When I run the attached classes, I get the following error message:
Unable to create Field Extractor for 'A' of '[ClassObjectType class=com.sample.SimpleSpreadSheetBasedPOJO]' in rule 'Validation 1' : [Rule name='Validation 1']
java.lang.IllegalArgumentException: Could not parse knowledge.
at com.sample.SimpleSpreadSheetBasedTest.readKnowledgeBase(SimpleSpreadSheetBasedTest.java:48)
at com.sample.SimpleSpreadSheetBasedTest.main(SimpleSpreadSheetBasedTest.java:23)
Even though a getter and setter method is available.
So I created an ID field, this seems to work fine, but if I create a field A1, this does not, if I create ID1, this seems to work...so something is amiss in the way in which fields, methods, etc are marshaled.
If a Java Bean is required that is fine, but then we need to retreat from marketing POJOs as facts, and also possibly create a better error message that tells us to use Java Beans and not POJOs.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (JBRULES-2989) Slotted/named syntax for bindings silently accepted as positional argument
by Wolfgang Laun (JIRA)
Slotted/named syntax for bindings silently accepted as positional argument
--------------------------------------------------------------------------
Key: JBRULES-2989
URL: https://issues.jboss.org/browse/JBRULES-2989
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 5.2.0.CR1
Reporter: Wolfgang Laun
Assignee: Mark Proctor
declare Article
artid : int;
artname : String;
custid : int;
end
rule "articles of a customer"
when
$a: Article( $artid: artid, $artname: artname, $custid : custid ; ) ### semicolon here! ###
then
System.out.println( "Art " + $artid + " " + $a.getArtname() + " by " + $custid );
end
This is accepeted by the compiler without error indication, but preceding a semicolon only positional argument should be permitted.
Expect: an error message, compilation failure.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (JBRULES-2956) Runtime error when using non-boolean expression as a constraint
by Wolfgang Laun (JIRA)
Runtime error when using non-boolean expression as a constraint
---------------------------------------------------------------
Key: JBRULES-2956
URL: https://issues.jboss.org/browse/JBRULES-2956
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler
Affects Versions: 5.2.0.M2
Reporter: Wolfgang Laun
Assignee: Mark Proctor
declare Num
num : Integer
even : boolean
end
rule start
when
then
insert( new Num( 42, true ) );
end
rule sumem
when
$n: Num( num, num + 1, eval(num + 1) )
then
end
All of these constraints result in a RUNTIME error ar java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Boolean org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:97)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (JBRULES-3139) NPE in KnowledgeAgentImpl due to missing change set
by Wolfgang Laun (JIRA)
NPE in KnowledgeAgentImpl due to missing change set
---------------------------------------------------
Key: JBRULES-3139
URL: https://issues.jboss.org/browse/JBRULES-3139
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core (expert)
Reporter: Wolfgang Laun
Assignee: Mark Proctor
A missing Change Set causes a NPE in KnowledgeAgentImpl.
import java.net.URL;
import org.drools.*;
import org.drools.agent.*;
import org.drools.conf.*;
import org.drools.builder.*;
import org.drools.io.*;
public void setup() throws Exception {
KnowledgeBaseConfiguration kBaseConfig =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kBaseConfig.setOption(EventProcessingOption.STREAM);
// kBaseConfig.setOption( cehOption );
ResourceChangeScannerConfiguration rcsConf =
ResourceFactory.getResourceChangeScannerService()
.newResourceChangeScannerConfiguration();
rcsConf.setProperty("drools.resource.scanner.interval", "20");
ResourceFactory.getResourceChangeScannerService().configure( rcsConf );
KnowledgeAgentConfiguration kaConf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaConf.setProperty("drools.agent.scanDirectories", "true");
kaConf.setProperty("drools.agent.scanResources", "true");
kaConf.setProperty("drools.agent.newInstance", "false");
KnowledgeBase kBase =
KnowledgeBaseFactory.newKnowledgeBase(kBaseConfig);
KnowledgeAgent kAgent =
KnowledgeAgentFactory.newKnowledgeAgent( "drools agent", kBase, kaConf);
String urlString = "file://tmp/MissingChangeSet.xml";
try {
URL url = new URL(urlString);
Resource urlResource = ResourceFactory.newUrlResource(url);
if( urlResource != null ){
System.out.println( "Resource " + urlResource );
}
kAgent.applyChangeSet( urlResource );
} catch (Exception e) {
System.out.println("Caught exception: " + e.getMessage());
e.printStackTrace();
}
}
Caught exception: null
java.lang.NullPointerException
at org.drools.agent.impl.KnowledgeAgentImpl.processChangeSet(KnowledgeAgentImpl.java:223)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:189)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:174)
at hashcode.Main.setup(Main.java:75)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (JBRULES-2801) Entry-point defaults for type, rule, package
by Wolfgang Laun (JIRA)
Entry-point defaults for type, rule, package
--------------------------------------------
Key: JBRULES-2801
URL: https://jira.jboss.org/browse/JBRULES-2801
Project: Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Implement the definition of the default entry point for an Event or Fact type via a metadata attribute, e.g.:
declare X
@role( event )
@entry-point( y )
end
so that this
a) declares the entry-point in the KnowledgeBase (the same way from entry-point "x" does)
b) removes the need to use from entry-point with all patterns referring to X
c) would still let me override the entry point with a "from entry-point" clause.
The same attribute can be used inside a rule, where it is associated with all fact patterns without an explicit entry point. Here it also overrides an entry-point declared with the type's declare, if any.
Since all rule attributes may also be used at package level (outside rules), this includes the new entry-point attribute. It will then be honoured in rules according to the current strategy for all other rule attributes.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (JBRULES-3001) Free form expression constraints: unexpected execution result; unexpected failure to compile
by Wolfgang Laun (JIRA)
Free form expression constraints: unexpected execution result; unexpected failure to compile
---------------------------------------------------------------------------------------------
Key: JBRULES-3001
URL: https://issues.jboss.org/browse/JBRULES-3001
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 5.2.0.CR1
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Given
public class Customer {
int custid;
//...
}
The following rule always fires, for any value of custid.
rule "articles of a customer"
when
$c: Customer( 150 <= custid <= 250 ) returns true
then
System.out.println( "Customer1 " + $c.getCustid() );
end
But the constraint
$c: Customer( 100 <= custid )
is refused by the compiler:
Unable to build constraint as '100' is invalid : [Rule name='articles of a customer']
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (JBRULES-2986) Confusing error reporting due to incomplete constraint
by Wolfgang Laun (JIRA)
Confusing error reporting due to incomplete constraint
------------------------------------------------------
Key: JBRULES-2986
URL: https://issues.jboss.org/browse/JBRULES-2986
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 5.2.0.CR1
Reporter: Wolfgang Laun
Assignee: Mark Proctor
declare Article
artid : int;
artname : String;
custid : int;
end
declare Customer
custid : int
end
rule "articles of a customer"
when
$c: Customer( $custid: custid )
$a: Article( $artid, artname == ("mou" + "se"), $custid : custid == $custid )
then
end
Produces many error messages (see below), where line number 1 and column numnber 1 are incorrect.
Expect: only one error message, with correct line number.
====================================================================
Unable to Analyse Expression $artid:
[Error: Failed to compile: 2 compilation error(s):
- (1,1) unable to resolve method using strict-mode: ex50.Article.$artid()
- (1,1) unqualified type in strict mode for: $artid]
[Near : {... $artid ....}]
^
[Line: 1, Column: 1] : [Rule name='articles of a customer']
Rule Compilation error : [Rule name='articles of a customer']
ex50/Rule_articles_of_a_customer_0.java (14:690) : $artid cannot be resolved
====================================================================
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (JBRULES-2987) Literal expression not possible in constraint
by Wolfgang Laun (JIRA)
Literal expression not possible in constraint
---------------------------------------------
Key: JBRULES-2987
URL: https://issues.jboss.org/browse/JBRULES-2987
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 3.0-beta3
Reporter: Wolfgang Laun
Assignee: Mark Proctor
declare Article
artid : int;
artname : String;
custid : int;
end
declare Customer
custid : int
endrule "articles of a customer"
when
$c: Customer( $custid: custid )
$a: Article( $artid: artid, artname == "mou" + "se", $custid : custid == $custid )
then
end
This produces the (misleading) error message below, but should work according to Mark Proctor.
Notice that artname == ("mou" + "se") works correctly.
Unable to return Declaration for identifier '"mou" + "se"' : [Rule name='articles of a customer']
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[JBoss JIRA] Created: (JBRULES-2878) NPE due to session.update with 1 or 2 invalid operands
by Wolfgang Laun (JIRA)
NPE due to session.update with 1 or 2 invalid operands
------------------------------------------------------
Key: JBRULES-2878
URL: https://issues.jboss.org/browse/JBRULES-2878
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 5.1.1.FINAL
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Counter counter = new Counter( initial );
this.session.insert( counter );
And now each of these calls
session.update( session.getFactHandle( null ), null );
session.update( session.getFactHandle( counter ), null );
session.update( session.getFactHandle( null ), counter );
results in a NPE
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.drools.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:58)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:382)
at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:981)
at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:954)
at org.drools.impl.StatefulKnowledgeSessionImpl.update(StatefulKnowledgeSessionImpl.java:266)
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months