Checking for a lack of an object
by Chris Richmond
How do I fire a rule if an object with certain characterstics does not
exists.
For example my class Foo, if I have a rule:
rule "Identify Foos with values"
when
Foo(stringProp=="blah", intProp==5)
then
System.err.println("A Foo was found!");
end
So how do I check for lack of existence of an object with certain
characteristics
I tried:
rule "Flag missing Foos with values"
when
not(Foo(stringProp=="blah", intProp==5))
then
System.err.println("A proper foo does not exist");
end
I also tried:
rule "Flag missing Foos with values"
when
not(exists(Foo(stringProp=="blah", intProp==5)))
then
System.err.println("A proper foo does not exist");
end
13 years, 3 months
Rule(s) based on different (fact) dates (date-effective/date-expired?)
by dhartford
Hey all,
I see a couple of posts in the mailing list/forum around the date-effective
and date-expired.
Forgive my ignorance, I'm still learning as I go, but I have this example
and I'm wondering if that is where I should look, or if that is the wrong
path:
Given the mortgage example, lets say you have LoanApplications come in with
an 'Application Date'.
There may be one rule that has 3 different versions (all versions 'active')
depending on the date of the application, and the application may come in
later, and/or a rule may be a retroactive rule (I just made a new rule, but
it came into effect two days ago (say during a weekend and is only for those
two days), so any ApplicationDate based loan applications that show up on
Monday with dates from the past two days should use that retroactive rule
instead of, potentially, a new 'current' rule).
This is not the same as history (what *was* the rule(s) as of prior Friday),
which is also important, which is why I'm asking if someone has tackled this
area that will help someone new understand the best approach for date-based
rules while understanding/retaining history.
thanks!
-Darren
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-s-based-on-different-fact-dates-da...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Do really support the containsKey() function on maps?
by dvsnmurty
Hello all,
I am having trouble with the following drools file:
===========================================================
rule "vam"
when
$pfMapType : MapType( name == "vam" )
$inputKey : InputKey( email == true )
$ldapResponseMap : Map()
then
$pfMapType.setQueryFilterCheck(true);
end
rule "transport"
when
$pfMapType : MapType( name == "transport" )
$inputKey : InputKey( email == true )
$ldapResponseMap : Map()
eval(
($ldapResponseMap.get("zimbraMailDeliveryAddress").equals($inputKey)) ||
(($ldapResponseMap.containsKey("zimbraDomainName") == true)
&& ($ldapResponseMap.get("zimbraDomainName").equals($inputKey))) )
then
$pfMapType.setQueryFilterCheck(true);
end
===========================================================
In the above, the rule "vam" works fine. But the rule "transport" never
works. Could it be because of the use of containsKey() function?
Alternatively, I tries replacing the rule "transport" with the following
with no luck still:
===========================================================
rule "transport"
when
$pfMapType : MapType( name == "transport" )
$inputKey : InputKey( email == true )
$ldapResponseMap : Map()
eval(
($ldapResponseMap.get("zimbraMailDeliveryAddress").equals($inputKey)) ||
(($ldapResponseMap.keySet().contains("zimbraDomainName")) &&
($ldapResponseMap.get("zimbraDomainName").equals($inputKey))) )
then
$pfMapType.setQueryFilterCheck(true);
end
===========================================================
Appreciate your kind attention on this.
Regards,
Murty.
--
View this message in context: http://drools.46999.n3.nabble.com/Do-really-support-the-containsKey-funct...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
San Francisco Bay Area startup looking for Drools developer
by Roger Smith
San Francisco Bay area based technology startup looking for an experienced
Drools developer.
Must have extensive knowledge on Drools and excellent Java coding skills.
Part time or full time.
Please send me an email if interested.
Roger Smith
rogersmith1711 AT yahoo DOT com
13 years, 3 months
String.format question in the RHS
by Dean Whisnant
Hello,
Can anyone see an issue with the following RHS? The String.format is failing. I've copied it straight into java to verify my intentions and it works there.
What I'm trying to accomplish is to concatenate the string UH005 with a sequence number that is a fixed 10 digits, zero filled. So if CurrentClaimSeq_48 is the number 123, then I expect that TRN02_Check... would be populated with UH0050000000123.
Again, this is working fine in straight java, but not in a rule. What am I missing? Is there a better way to try to accomplish this in a rule?
rule "L1000_TRN02_UHC_BPA"
dialect "mvel"
when
CLM_835_SUPP( seq : currentClaimSeq_48 != ( null ) )
CLM_DET_LOAD( )
trn : x221TransactionHeader_TRN_ReassociationTraceNumber( )
then
trn.setTRN02_CheckOrEftTraceNumber( "UH005" + String.format ("%010d", seq) );
end
Here are the data types of the two fields involved.
private Integer CurrentClaimSeq_48;
public String TRN02_CheckOrEftTraceNumber;
Thank you!
Dean
13 years, 3 months
Guvnor 5.2 and Designer 1.0.0.054 "connection refused"
by dhartford
Hey all,
I'm trying to get the BPMN flow designer installed beside Guvnor on a jboss
5.1 system.
It opens the editor fine, and things look ok until I try to save, at which
point any work done for workflow designing disappears.
I was getting a different connection refused error, which led me to a post
to change the designer.war/profiles/jbpm.xml file, which I did, but still
getting 'connection refused'.
==============
16:37:49,827 INFO [STDOUT] ERROR 18-08 16:37:49,825
(LoggingHelper.java:error:69) Connection refused
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
.....
at
org.drools.guvnor.server.contenthandler.BPMN2ProcessHandler.serialize(BPMN2ProcessHandler.java:149)
at
org.drools.guvnor.server.contenthandler.BPMN2ProcessHandler.storeAssetContent(BPMN2ProcessHandler.java:120)
at
org.drools.guvnor.server.RepositoryAssetOperations.checkinVersion(RepositoryAssetOperations.java:125)
at
org.drools.guvnor.server.RepositoryAssetService.checkinVersion(RepositoryAssetService.java:226)
=======
jbpm.xml file segment:
<externalloadurl protocol="http" host="mypc.domain.com:48080"
subdomain="guvnor/org.drools.guvnor.Guvnor/oryxeditor" usr="guest"/>
========
jboss starting and working through port 48080, with a -b binding for
mypc.domain.com.
Any help would be appreciated, thanks!
-D
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-2-and-Designer-1-0-0-054-conne...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Planner: Packing items together
by JimK
Working from the cloud computing example I am modifying it as a learning
exercise that might have real world use for a client. The client makes items
that vary in size and weight. I have built rules to handle the weight and
size constraints to optimize loading of a box. Planner does a great job of
optimizing loading of the boxes with those rules. The one sticking point is
a sales order line must be packed in the same box or series of boxes. Can’t
quite get my head around how to craft rule(s) to enforce it.
1. Each order line is a job.
2. Each job is run complete from start to finish.
3. Jobs can be manufactured in any sequence.
4. Weight varies from order line to order line
5. Thickness varies from order line to order line.
6. Items on same order line are identical in thickness and weight.
7. Items are loaded into box as they come off line.
8. Items from different sales order lines can be packed in the same box.
Rules:
1. Total thickness of items in box must not exceed depth of box.
2. Total weight of items in box must not exceed weight capacity of box.
3. All items on the same order line must be packed in same box or sequential
boxes.
Thickness and weight are not always connected in the same direction. A
thicker item can be heavier or lighter than a thinner item.
Goal: Optimize the sequence that sales order lines come off the
manufacturing line to minimize the number of boxes needed without exceeding
depth or weight limitations of box.
Example:
• Order line X for Quantity 100
All in one box, OK
Box 1 100
Box 2 0
Started in Box 1, rest in box 2, OK
Box 1 25
Box 2 75
Box 3 0
Spread over multiple sequential boxes, OK
Box 1 25 (could have other sales order lines)
Box 2 50 (box can only contain Line X)
Box 3 25 (could have other sales order lines)
Some in one box, rest in a non-adjacent box, Not Allowed.
Box 1: 25
Box 2: 0 (box has items from other order lines)
Box 3: 75
This looks to be similar to the lecture compactness goal in the examination
problem. I can almost see what needs to be done but can’t quite articulate
it into rule(s) to ensure an order line has been packed sequentially in a
contiguous series of boxes.
Thanks much for any assistance
Jim Kinneman
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-Packing-items-together-tp326226...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
dialect java is not loading the facts in Drools
by santhosh kumar
Hi,
Can some one help in resolving the below issue or if there is any work
around for this?
There is a strange behaviour in terms of loading the facts using dialect
java and mvel.
Our requirement is that we should support dynamic changes to fact objects in
the application without a restart. So, to achieve that I am using jar
classloader to load the fact objects into memory. So before constructing
RuleBase I am switching the current class loader context to jar classloader.
By doing this, all the imported facts getting resolved if I use mvel dialect
where as if I use java dialect it's not able to resolve the fact. Can
someone help on how to resolve this issue.
I can't use mvel dialect as it's behaving strangely in case of accumulate.
So I need to use java dialect only.
Please let me know why java dialect is considering the facts only from
classpath. It's not loading from current classloader's context
Below is the code to switch classloader context
Thread.currentThread().setContextClassLoader(
jarClassLoader);
InputStream is = //reads from jar content
RuleBase ruleBase = RuleBaseLoader.getInstance().loadFromReader(
new InputStreamReader(is));
StatelessSession statelessSession = ruleBase.newStatelessSession();
statelessSession.executeWithResults(facts);
Thanks
Santhosh
13 years, 3 months