Defining facts declaratively with TypeDeclaration and assert facts from java
by Ronald Brindl
Referring to threads
http://thread.gmane.org/gmane.comp.java.drools.devel/2860
Dynamic Facts: how to get jar wih Facts declared in drl
http://thread.gmane.org/gmane.comp.java.drools.devel/2595
TypeDeclaration plugin heirarchy
I am just in the process of evaluating the possibilities of using Drools.
Our use case is the following:
We have a dynamic metamodel, which gets generated from database during
application initialisation phase. Then a runtime model gets instantiated,
which is fed from incoming messages (files, jms, etc.)
Both models are highly generic, basically maps of maps (lists of lists, for
model instances)
Now, i would like to publish the metamodel to Guvnor as fact model, so that
business rules users can use it there and define
In the last 2 days i dived into the sources, read the mailing list entries
above, documentation and so on, but i still don't have a clear vision on
how to accomplish that.
Our first approach was to use TypeDeclaration, i.e. to dynamically create
DRL that defines the fact types as defined in our metamodel, but i don't
have a clue on how to assert data for those types, since i don't have the
resulting java classes available in Java.
(There was also some confusion: in the documentation (M5) it says, bytecode
is generated for declaratively defined Facts, but i could not find anything
in the code, where this byte code is generated)
Our next approach was to generate interfaces as Fact types and create
proxies to access the data. This would also allow us to implement another
use case, that demands access to messages already stored in the database
with the same id as the incoming messages, and compare what fields are new
and to provide merging of new and old data.
I also had a quick look at the new Pipeline concept, but as far as i
understand that, it builds on a statically defined FactModel.
Then i dived a little bit more into the code and saw code generation for
accessing Java class facts, which also might be a reasonable solution for
us.
However, what i was asking myself was, if there is some entry point for
functionality like that, some existing API.
Thank you,
ron.
--
Ronald Brindl
Sr. Software Developer
Member of Architecture Team
The Goldensource Corporation
16 years, 10 months
Lucene usages in Guvnor ( BRMS )
by Ashish Soni
Hi All ,
I see lucene jar in Guvnor but not sure where and how it is exactly used ,
Can some one please put some lights on it.
Regards,
Ashish
16 years, 10 months
Cost of queries
by David Cracauer
Hi All,
I'm wondering if anyone can tell me the relative performance impact of
queries. Is it just the cost of matching facts against them ( regular
caching rules apply etc.)?
Thanks,
Dave
16 years, 10 months
How can I query tasks created by MinaServer?
by Cristiano Gavião
Hi,
Im trying to query the human tasks that was created and persisted by
the MinaServer.
Looking at junit tests I could see that for that job I should use
MinaTaskClient.getTasksAssignedAsPotentialOwner("Darth Vader", "en-
UK", responseHandler) or other methods like this one;
In this case I should pass one responseHandler that implements
TaskSummaryResponseHandler.
In the source code I could see that exists
BlockingTaskSummaryResponseHandler class that implements
TaskSummaryResponseHandler.
Should I use this class or create one myself???
By the way, these class isn't on M5 JAR.... I think because Its not
located on the right path. It is on src/test folder instead of src/
main.....
thanks and best regards
____________________________________
Cristiano Gavião
16 years, 10 months
one question about asserting facts
by Senlin Liang
Hi all,
I am trying to assert (or insert) a large number of facts (or
DataClass objects) in to a session, what i am doing right now is to
insert them one by one as
---------------------
while (line != null) {
str = bufRead.readLine();
session.insert(new DataClass(line, str));
line = bufRead.readLine();
}
---------------------
My question: is there an efficient way to insert all facts at once, so
that it takes less time?
Thanks,
Senlin
16 years, 10 months
Java Bean dependency
by Sachin Mangal
Hi,
I want to use Drools as a part of a classification system which consist of
Machine Learning based classification (semi supervised) followed by an
expert system (rule based classification). The issue is that ML part and the
framework is in C++ and Drools supports Java. So, I will use some IPC
mechanism for sending data objects from framework to the rule system (I have
my own serialization and deserialization modules for that). I just want to
know that the object classes correspoding to DRLs need to be in some special
format or any format with getter and setter methods will do?
Thanks in advance,
Sachin Mangal
Member of Research Staff,
Guavus Network Systems Pvt Ltd
16 years, 10 months
Eclipse guvnor plugin issue
by Steven Williams
Hi all,
I am using the snapshot version of the eclipse plugin from Feb 5. When I
attempt to drag a file from the repository explorer into the Navigator view
I get the following exception:
java.lang.Exception: Could not create directory C:\Documents and
Settings\Administrator\workspace\.metadata\.plugins\org.guvnor.tools\623d8213:11f48a3ddff:-7fff
at org.guvnor.tools.views.RepositoryView.prepareFileTransfer(Unknown
Source)
at org.guvnor.tools.views.RepositoryView.access$1(Unknown Source)
at org.guvnor.tools.views.RepositoryView$2.dragSetData(Unknown Source)
at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:54)
...
I am using Windows and can drag the file from a mapped webdav directory on
my computer. I think the problem is that the filename contains the invalid
character :
Should I raise a bug?
thanks
Steve
16 years, 10 months
Need help to pass Decision Table (XLS file) into RuleBase in Drools version 4.0.7
by Hong-Qiang Gao
Hi All,
In Drools version 2.1, I can pass the Decision Table (XLS file) into
RuleBase and it works great;
...
file = new File(dir, XLS _filename);
InputStream stream = null;
RuleBase ruleBase = null;
WorkingMemory wm = null;
try {
stream = new FileInputStream(file);
} catch{...
}
try{
ruleBase = DecisionTableLoader.loadFromInputStream(stream);
wm = ruleBase.newWorkingMemory();
} catch{ ...
}
return wm;
.
In Drool version 4.0.7, I tried to pass the Decision Table (XLS file) into
RuleBase in the following way and it is not worked yet, though I used the
same XLS file;
.
file = new File(dir, XLS _filename);
InputStream stream = null;
RuleBase ruleBase = null;
WorkingMemory wm = null;
try {
stream = new FileInputStream(file);
} catch{...
}
try{
ruleBase = RuleBaseFactory.newRuleBase();
PackageBuilder builder = new PackageBuilder();
SpreadsheetCompiler sCompiler = new SpreadsheetCompiler();
String drl = sCompiler.compile(stream, InputType.XLS);
builder.addPackageFromDrl(new StringReader(drl));
ruleBase.addPackage(builder.getPackage());
wm = ruleBase.newStatefulSession();
} catch{ ...
}
return wm;
.
Is above coding a correct way to pass Decision Table (XLS file) into
RuleBase in Drools version 4.0.7?
Are following exceptions related to the org.drools.decisiontable.model
changes (V2.1 Parameter, Ruleset, Variable vs V4.0.7 DRLOutput, Global,
Package)?
Above coding using v4.0.7 complains as following;
java.lang.NullPointerException
at jxl.biff.drawing.Drawing.initialize(Drawing.java:249)
at jxl.biff.drawing.Drawing.<init>(Drawing.java:157)
at jxl.read.biff.SheetReader.read(SheetReader.java:737)
at jxl.read.biff.SheetImpl.readSheet(SheetImpl.java:620)
at jxl.read.biff.WorkbookParser.getSheet(WorkbookParser.java:230)
at
org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:7
9)
at
org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.jav
a:89)
at
org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.jav
a:68)
...
java.lang.IllegalArgumentException: Invalid rule table header cell. Should
be in the format of 'RuleTable YourRuleName'. It was: RuleTable
(ControlledVocab vocab)]
at
org.drools.decisiontable.parser.RuleSheetParserUtil.invalidRuleTableDef(Rule
SheetParserUtil.java:47)
at
org.drools.decisiontable.parser.RuleSheetParserUtil.getRuleName(RuleSheetPar
serUtil.java:41)
at
org.drools.decisiontable.parser.DefaultRuleSheetListener.initRuleTable(Defau
ltRuleSheetListener.java:256)
at
org.drools.decisiontable.parser.DefaultRuleSheetListener.processNonRuleCell(
DefaultRuleSheetListener.java:307)
at
org.drools.decisiontable.parser.DefaultRuleSheetListener.newCell(DefaultRule
SheetListener.java:232)
at
org.drools.decisiontable.parser.xls.ExcelParser.newCell(ExcelParser.java:184
)
at
org.drools.decisiontable.parser.xls.ExcelParser.processSheet(ExcelParser.jav
a:122)
at
org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:8
0)
at
org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.jav
a:89)
at
org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.jav
a:68)
...
Thanks, Hong
16 years, 10 months
drools-solver results question
by Andrew Waterman
Hello,
I'm starting to work with the drools-solver to help on a gaming
project. Basically, we have a game that works in two modes: 1) a
competitive game where humans (or agents) compete with one another on
a well defined game board to achieve 24 points by using three (or
four) agricultural development tokens. 2. A puzzle, where all 4
players work cooperatively to create an equitable solution, where all
4 players win with at least 24 points by means of our agricultural
development tokens.
I am starting to work with drools-solver to address the puzzle part of
our game. Basically, we are interested in having the solver do two
things for us: a) find the optimal solution for our game/puzzle,
based upon our requirements [this part seems quite straightforward]
and b) getting the total number of solutions that satisfy our
constraints. We would like, as well, to be able to inspect these
other, sub-optimal, solutions, in order to explore our game and puzzle
further. From my reading of the "Solver" API , it looks like we will
only be able to get the optimal solution. Does anyone have any
suggestions for a workaround in this case? Or is there some
functionality in the solver that I am missing?
I look forward to your feedback.
best wishes,
Andrew
---------------------------------
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico
16 years, 10 months