Drools: organizing and using a large fact base
by Ulrich Scholz
Dear all,
I'm designing a system that operates on data collected from software
installations deployed to customers. Every day, a batch of data comes in
from every customer. Over time, we want to build a knowledge base that,
e.g., fires for certain patterns in that data. (Yes, I think a rule engine
is the right tool for this task.)
The fact base will become large: 356 days x 1000 customers x 100 or so
facts. What are "reasonable" sizes of fact bases that Drools can cope with?
The kind of data and the expected rules might allow to restrict the data to
slices: Only data from one customer, only from a few customer in a time
period, etc. That sounds like OLAP: The data is a cube with dimensions
customer and time. For (re-)evaluating the rules to a specific end: slice
the cube, establish the Drools fact base from the slice, and fire rules of
the corresponding set.
Do you have suggestions on how to organize the data? What database
technologie to use?
Does what I say make any sense at all?
Best, Ulrich
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-organizing-and-using-a-large-fac...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
Disable strict mode in 5.2 via Spring configuration
by dcrissman
We are currently using an older version of Drools and are looking to upgrade
to the current. When we attempt this in testing we get a lot of issues
around mvel being in strict mode. While we certainly would love to address
these syntax issues on a case by case basis, for the time being we'd like to
just disable strict mode so that we can move forward with other testing that
we need to do.
We are using Spring context files to setup our Drools environment and would
love to be able to configure mvel in the same place. I have searched around
and have been unable to find a direct answer to this question...
Is there a way to disable strict mode from within a Spring context file?
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Disable-strict-mode-in-5-2-via-Spring-c...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 3 months
rule parse error for null check
by Neel
Hi,I'm using drools-5.3.0.Beta1. I've following rule file:
import java.util.*;
declare Student
name : String @key
subjectGradeMap : HashMap
end
rule "Subject grade points"
dialect "mvel"
when
$u : Student()
then
if($u.subjectGradeMap == null)
{
$u.subjectGradeMap = new HashMap<String,Integer>();
}
$u.subjectGradeMap["CompSc"] += 100;
System.out.println("Marks added");
end
I get following error while rule compilation:Unable to Analyse Expression if($u.subjectGradeMap == null);
{
$u.subjectGradeMap = new HashMap<String,Integer>();
};
$u.subjectGradeMap["CompSc"] += 100;
System.out.println("Marks added");:
[Error: was expecting type: java.lang.Object; but found type: <Unknown>]
[Near : {... if($u.subjectGradeMap == null) ....}]
^
[Line: 1, Column: 1] : [Rule name='Subject grade points']
Please let me know if this is correct usage in the above scenario.
Thanks,Neel
13 years, 3 months
fireAllRules() doesn't return back
by Neel
Hi,I'm using drools-5.3.0.Beta1. I've following rule definition:
import java.util.*;
declare Student
name : String @key
subjectGradeMap : HashMap
end
rule "Subject grade points"
dialect "mvel"
when
$u : Student()
then
$u.subjectGradeMap["CompSc"] += 100;
System.out.println("Marks added");
end
While executing RHS of above rule, fireAllRules() doesn't return, it hangs.Please help.Thanks,Neel
13 years, 3 months
best way to write this rule?
by Warner Onstine
I am new to Drools and I've been trying to figure this out through the
user guide and examples I've been finding, but I'm not sure what the
best way is to write this rule (or set of rules).
What I'm trying to write is a set of rules for determining when
someone has earned (or is starting to earn) a badge. I want to be able
to show their progress on badge completion as well as when they
finally complete said badge.
I'm passing in the following to the rule:
- Player
- Earned Badges (list)
- All possible badges
The first rule only deals with one specific badge. So I have something
like this in my when:
$badge : Badge(name == "Something") //my assumption is that Badge
comes from the list of all possible badges I've just passed in
Then, I decided to split the rule into two. One rule for when they had
not earned it yet:
and I call a function
function earnedBadge(List<EarnedBadge> badges, String name) {
boolean found = false;
for(EarnedBadge badge : badges) {
if(badge.getBadge().getName().equals(name)) {
found = true;
}
}
return found;
}
when:
earnedBadge(badges, $badge (name))
Then I got stuck. If they have completed one or more tasks I would
like to create (or use the badge they've started to earn) to track
their progress. So, If I have 5 possible things they need to do and
they've done three of those I'd like to create a new EarnedBadge for
the one they are earning and give it a percentage of 60%. What would
be the best way to do something like this?
Thanks for helping out the newbie, it's greatly appreciated :).
-warner
13 years, 3 months
Guvnor does not like my rule?
by Perrin John - jperri
Noob alert, first post.
I have a rule that works fine when I run it in a JUnit test. I've imported it into Guvnor (along with all my referenced pojos and functions) and it will not build there. Here is the error:
Unable to Analyse Expression for (String curr : (List<String>) $validList) { ValidValue aValidVal = new ValidValue(curr); drools.insert(aValidVal); }; for (int i=0; i<$validList.size(); i++) { String curr = (String)$validList.get(i); ValidValue aValidVal = new ValidValue(curr); drools.insert(aValidVal); };: [Error: unexpected token: $validList] [Near : {... rr : (List<String>) $validList) { ....}] ^ [Line: 1, Column: 35]
What the rules is trying to do is run values from a set of records through a validation function and then add each of the valid values as individual facts. Guvnor apparently doesn't like the way the iteration of the list is being done. I've tried a few different ways of iteration. Thanks in advance for any advice.
Here is the rule:
when
$validList : List()
from accumulate(
InRecord($value : value != ""),
ListValid($value))
then
for (String curr : (List<String>) $validList) {
ValidValue aValidVal = new ValidValue(curr);
insert(aValidVal);
}
for (int i=0; i<$validList.size(); i++) {
String curr = (String)$validList.get(i);
ValidValue aValidVal = new ValidValue(curr);
insert(aValidVal);
}
Regards,
John Perrin
***************************************************************************
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be legally
privileged.
If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.
If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.
Thank You.
****************************************************************************
13 years, 3 months
Rule one-by-one comparison
by miguel machado
Hi there everybody,
I need to perform rule comparison on a project I'm working on using drools
expert 5.0. For a specific feature implementation, I have two different
knowledge bases with several rules which I need to compare, one by one. By
comparing, I mean "inspect" certain conditions within the LHS.
Currently, I'm able to obtain several attributes from rules
(org.drools.rule.Rule), such as the agenda-group and the rule name and a few
others, but I haven't been able to do it all. Going deeper, there is
LiteralConstraint (for simple conditions) which I can parse and obtain data.
However, I don't know how to do it for OR-conditions, which I guess
represents a MultiRestrictionFieldConstraint. Perhaps there is another way?
I know this may seem like a very unorthodox thing to do, but I don't think
there is a better way of comparing knowledge packages (except for full text
comparison). Is there?
Thanks in advance,
_ miguel, PT
--
"To understand what is recursion you must first understand recursion"
13 years, 3 months