[JBoss JIRA] Created: (JBRULES-1457) please support containment test for map keys
by Godmar Back (JIRA)
please support containment test for map keys
--------------------------------------------
Key: JBRULES-1457
URL: http://jira.jboss.com/jira/browse/JBRULES-1457
Project: JBoss Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: Drl Parser/Builder
Affects Versions: 4.0.4
Environment: any
Reporter: Godmar Back
Using MVEL as the language for clauses, there is no way to test whether a map's key contain a value.
For instance:
rule "number 1"
when
e : S(map.keySet() contains "x")
then
System.out.println("rule number 1");
end
leads to a syntax error because Drool's parser does not allow function calls ("keySet())" in clauses.
On the other hand, MVEL (according to Mike Brocks, please read http://jira.codehaus.org/browse/MVEL-53 ) does not provide an operator to test containment in a map's set (or values). He said he's considering adding a shortcut such as .keys and .values in 2.0 and recommended I open a Drools JIRA issue.
Please provide a way to test for membership in a map's key and value set.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months
[JBoss JIRA] Created: (JBRULES-2404) "not contains" operator doesn't work on inner fields
by Taras Svirskyi (JIRA)
"not contains" operator doesn't work on inner fields
-----------------------------------------------------
Key: JBRULES-2404
URL: https://jira.jboss.org/jira/browse/JBRULES-2404
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler
Reporter: Taras Svirskyi
Assignee: Mark Proctor
Consider following example.
There are nodes that are connected into directed graph. Each node has
special collection of attributes. Under some conditions attributes
should be propagated along the edges in the graph.
Lets model this with following code.
/******* propagation rules **********************/
package com.test.collection;
rule "move child"
when
c : Child()
s : CNode( children contains c)
l : Link( src == s,
t : target && target.children not contains c )
then
System.out.println("adding "+c+" from "+s+" to "+t);
t.addChild(c);
update(t);
end
/** Child.java (represent special attributes of a node) *******/
package com.test.collection;
public class Child {
private String name;
public Child(String name){
this.name = name;
}
public String getName() {
return name;
}
@Override
public String toString() {
return "child("+name+")";
}
}
/********* CNode.java - nodes of a graph *************/
package com.test.collection;
import java.util.HashSet;
import java.util.Set;
public class CNode {
private Set<Child> children;
public CNode() {
this.children = new HashSet<Child>();
}
public Set<Child> getChildren() {
return children;
}
public void addChild(Child ch){
children.add(ch);
}
@Override
public String toString() {
return "Node{children="+children+"}";
}
}
/**** Link.java - edges of a graph *******/
package com.test.collection;
public class Link {
private CNode src;
private CNode target;
public Link(CNode src, CNode target) {
this.src = src;
this.target = target;
}
public CNode getSrc() {
return src;
}
public CNode getTarget() {
return target;
}
}
/********************* populate session with facts **********/
Child c0 = new Child("x");
Child c1 = new Child("y");
Child c2 = new Child("z");
CNode src = new CNode();
src.addChild(c0);
src.addChild(c1);
CNode target = new CNode();
target.addChild(c0);
Link link = new Link(src,target);
// populate with facts
ksession.insert(c0);
ksession.insert(c1);
ksession.insert(c2);
ksession.insert(link);
ksession.insert(src);
ksession.insert(target);
/****************************************************************/
So with all that code listed above I've got following output from rules:
--
adding child(x) from Node{children=[child(x), child(y)]} to
Node{children=[child(x)]}
--
That means that 'not contains' operator actually works as 'contains'
one. Still when I changed it to older operator 'excludes' everything
goes right printing out.
---
adding child(y) from Node{children=[child(y), child(x)]} to
Node{children=[child(x)]}
---
I've noticed that rewriting rule in form of simple statements also fix
issue.
rule "move child"
when
c : Child()
s : CNode( children contains c)
t : CNode( children not contains c )
l : Link( src == s, target == t)
then
System.out.println("adding "+c+" from "+s+" to "+t);
t.addChild(c);
update(t);
end
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months
[JBoss JIRA] Created: (EJBTHREE-1870) stopDelivery on active MDB results in exception (Session not found)
by Philip Dodds (JIRA)
stopDelivery on active MDB results in exception (Session not found)
-------------------------------------------------------------------
Key: EJBTHREE-1870
URL: https://jira.jboss.org/jira/browse/EJBTHREE-1870
Project: EJB 3.0
Issue Type: Bug
Components: ejb3
Affects Versions: 1.1.3
Environment: Mac OS/X Leopard, JDK 6, JBoss 5.1.0GA
Reporter: Philip Dodds
Attachments: stopdelivery-mdb.zip
If you start an MDB and introduce a messages to it then use the stopDelivery method of the MDB's MBean to stop it consuming messages you get an exception. Note this problem only occurs if the MDB has a transaction in flight when the stopDelivery is called.
2009-05-20 12:30:52,499 ERROR [org.jboss.messaging.util.ExceptionUtil] (WorkManager(2)-44) Connectio
nEndpoint[fe-oz919yuf-1-mj809yuf-bruz48-x21o4c5] sendTransaction [ur4-b6b39yuf-1-mj809yuf-bruz48-x21
o4c5]
javax.jms.IllegalStateException: Cannot find session with id ie-qz919yuf-1-mj809yuf-bruz48-x21o4c5
at org.jboss.jms.server.endpoint.ServerConnectionEndpoint.processTransaction(ServerConnectionEndpoi
nt.java:835)
at org.jboss.jms.server.endpoint.ServerConnectionEndpoint.sendTransaction(ServerConnectionEndpoint.
java:497)
at org.jboss.jms.server.endpoint.advised.ConnectionAdvised.org$jboss$jms$server$endpoint$advised$Co
nnectionAdvised$sendTransaction$aop(ConnectionAdvised.java:101)
at org.jboss.jms.server.endpoint.advised.ConnectionAdvised$sendTransaction_N3268650789275322226.inv
okeTarget(ConnectionAdvised$sendTransaction_N3268650789275322226.java)
I have attached a slightly doctors version of the EJB3 MDB example code, it has been changed to introduce a sleep of 5 seconds in the MDB (to keep the transaction active longer) and also introduces a higher volume of messages to give you a chance to get to the JMX console and call stopDelivery. If you don't get an exception on the first attempt it is worth trying again as the transaction must be in flight for the problem to occur.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months
[JBoss JIRA] Created: (JBRULES-2248) Drools Expert User Guide errors
by Karsten Thoms (JIRA)
Drools Expert User Guide errors
-------------------------------
Key: JBRULES-2248
URL: https://jira.jboss.org/jira/browse/JBRULES-2248
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-docs
Affects Versions: 5.0.1.FINAL
Reporter: Karsten Thoms
Assignee: Mark Proctor
Priority: Trivial
Some minor issues I found when following the User Guide:
Improvement: Variable 'kbase' is not introduced in the first example. Add declaration and instantiation to example in 2.1.1.
Rule "Status output when things are ok"
error:
not Sprinkler( on === true )
correct:
not Sprinkler( on == true )
ERROR
if ( kbuilder.hasErrors() ) {
System.err.println( builder.getErrors().toString() );
}
CORRECT
if ( kbuilder.hasErrors() ) {
System.err.println( kbuilder.getErrors().toString() );
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months
[JBoss JIRA] Created: (JBRULES-2763) Event declaration using fqn
by Samuli Saarinen (JIRA)
Event declaration using fqn
---------------------------
Key: JBRULES-2763
URL: https://jira.jboss.org/browse/JBRULES-2763
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Environment: Java 1.6
Drools 5.1.1
Reporter: Samuli Saarinen
Assignee: Mark Proctor
I'm trying to create event declaration using fqn in the declaration but
for some reason it doesn't work. I have the following rule:
package com.test.pkg
declare com.test.Event1
@role(event)
@expires(2s)
end
compiling it produces the following error:
[6,11]: [ERR 103] Line 6:11 rule 'end_key' failed predicate:
{(validateIdentifierKey(DroolsSoftKeywords.END))}? in com
But if I change it as follows:
package com.test.pkg
import com.test.Event1
declare Event1
@role(event)
@expires(2s)
end
Everything works as expected...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months
[JBoss JIRA] Created: (JBRULES-2734) NPE loading changeset
by Tommy Odom (JIRA)
NPE loading changeset
---------------------
Key: JBRULES-2734
URL: https://jira.jboss.org/browse/JBRULES-2734
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core (expert)
Affects Versions: 5.1.1.FINAL
Reporter: Tommy Odom
Assignee: Mark Proctor
We are receiving a NPE when drools is attempting to load the deltas from guvnor in our webapp. This used to work fine in 5.0 but we recently upgraded to 5.1 and started receiving this error after we create a new snapshot in guvnor.
The output from our application server log is:
KnowledgeAgent applying ChangeSet
KnowledgeAgent performing an incremental build of the ChangeSet
no visitor implementation for : class org.drools.ruleflow.core.RuleFlowProcess : org.drools.ruleflow.core.RuleFlowProcess@30012e
Exception in thread "Thread-36"
org.drools.RuntimeDroolsException: java.lang.reflect.InvocationTargetException : [R
ule name=Project Part Custom Finishing Cost, agendaGroup=MAIN, salience=0, no-loop=false] at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:56)
at org.drools.agent.impl.BinaryResourceDiffProducerImpl.diff(BinaryResourceDiffProducerImpl.java:63)
at org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:785) at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:586)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
at org.drools.agent.impl.KnowledgeAgentImpl$ChangeSetNotificationDetector.run(KnowledgeAgentImpl.java:1106) at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.reflect.InvocationTargetException
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.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:47)
... 6 more
Caused by: java.lang.NullPointerException at org.drools.rule.EvalCondition.equals(EvalCondition.java:169)
at org.drools.rule.GroupElement.equals(GroupElement.java:273)
at org.drools.agent.impl.BinaryResourceDiffProducerImpl.compareRules(BinaryResourceDiffProducerImpl.java:258)
at org.drools.agent.impl.BinaryResourceDiffProducerImpl.visitRule(BinaryResourceDiffProducerImpl.java:117)
... 11 more
The rule that it mentions in the error is:
dialect "java"
ruleflow-group "finishing-price"
when
$pp : ProjectPart(finishTime > 0)
eval(salesChannelId != 4 && includeFinishing)
then
double finishingRate = 1;
double customFinishingCost = $pp.getQuantity() * $pp.getFinishTime() * finishingRate;
addToProjectFinishingCost($pp.getProject(), customFinishingCost);
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months