Re: [rules-users] FactType returns null when creating a java client on Eclipse invoking a rule in Guvnor
by Andre Fonseca
Hi Kachan, thanks for your reply!
I took a look in your post and tried to adapt my code, this is below:
# Strategy 1
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("myagent");
kagent.applyChangeSet(ResourceFactory.newUrlResource("http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mort..."));
KnowledgeBase kbase = kagent.getKnowledgeBase();
FactType appType = kbase.getFactType("mortgages", "LoanApplication");
I copied the URL "http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mort..." and past it on the browser, it downloads the file mortgages.pkg, so its correct right?
But executing this code I got "(null: 1, 1): Content is not allowed in prolog."
So I changed the line 2 to use
#Strategy 2
kagent.applyChangeSet(ResourceFactory.newClassPathResource("src/main/resources/mortgage-changeset.xml"));
The mortgage-charset.xml is below
<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns="http://drools.org/drools-5.0/change-set"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...">
<add>
<resource source="http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/mort..."
type="PKG" basicAuthentication="enabled" username="admin" password="admin" />
</add>
</change-set>
With this change I dont have error, but the variable appType returns null again.
The point here is, I am using Guvnor with guest user (no authentication) this could be the problem?
The URL from Strategy1 is corrected, I tested it. The file in Stragety2 is corrected to, I debug it and see the file inputstream.
TIA
----- Original Message -----
From: kachaps4u
Sent: 01/08/12 05:54 PM
To: rules-users(a)lists.jboss.org
Subject: Re: [rules-users] FactType returns null when creating a java client on Eclipse invoking a rule in Guvnor
http://drools.46999.n3.nabble.com/urlResource-applyChangeset-and-authenti... Hey, Please read the above and see whether it can help you. I had the same problem returning null. Then I stopped it and now doing in ESB to access the resources using its rules processor. But sometimes the above discussion can help you and if you have anything positive please let me know too. I was trying my own example in fact and not the mortgage. I think this would help both of us. Thank you. Kachan -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-FactType-returns-null-when-... Sent from the Drools: User forum mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list rules-users(a)lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
12 years, 10 months
FactType returns null when creating a java client on Eclipse invoking a rule in Guvnor
by Andre Fonseca
Hi all,
I have imported the mortgage-sample-repository.xml to my guvnor instance. Its okey.
Then I tried to run the MortgageClientExample java class.
Everything is okey, but when I try to create the FactType
"FactType appType = kbase.getFactType("mortgages", "LoanApplication");"
I have null as the result for the appType variable.
The KnowledgeBase is okey also.
I used the same configurations of the example that comes with guvnor download.
I am in Windows with Tomcat 7.
I appreciate any help.
TIA
12 years, 10 months
答复: Concurrent rule fire
by Zhuo Li
Any comments?
发件人: Zhuo Li [mailto:milanello1998@gmail.com]
发送时间: 2012年1月8日 0:35
收件人: 'Rules Users List'
主题: Concurrent rule fire
Hi, folks,
My project will handle about 1.5 M transactions per hour using Drools and
the rules’ fire are scheduled based on business operation cycle which might
happen a few times a day. Say if I need to fire the same rule set twice at
10:00 PM and midnight. What will happen if the first execution has not
completed till midnight? Will the 2nd execution be held up till the 1st is
completed? I would assume there might still be transactions inserted into
working memory between 10:00 PM and midnight although it is very few.
My understanding is Drools will enforce only one active thread is working
for the same “then” section for data consistency. Any thoughts?
Best
Abe
12 years, 10 months
Rules, database and flow in JBRMS
by kachaps4u
I have this one scenario where the rules need to look on to a database and
see whether it matches the zipcode, state and whether that region is
eligible to do some actions. Now my BRMS is having its default repository. I
was using rule templates to show the demo with 3 states.
In the real scenario, I would need to have a larger database checking all
the requirements. My Project is having a xml database outside for user data
persistence and will be using oracle 11 g for business rules and
process(JBRMS, JBPM).
-Now where shuld I need to create the database for checking these rules?
-I assume that would be Oracle. But then where would i write the queries to
do it?
-If not should I call a java method searching in the xml database?
In my scenario, rule has to change the value of the variable and this
variable should will be input of the next rule. I was doing with uploaded
POJO JARs and the variable wasn't getting updated when each rule was fired
(i used salience to put priority) when given the URI for the resource in the
ESB. So I build the package with built in selector and created snapshots to
provide different URIs when this situation comes. It was working then.
- How can I put the rule flow in to it so that i dont want do this?
I was trying to upload .rf file but was unsuccessful. I read about the id
and rule flow group. But my upload rule flow is blank inside BRMS.
- what should i do to connect my rules to this flow?
Please help me.. thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Rules-database-and-flow-in-JBRMS-tp3642...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Concurrent rule fire
by Zhuo Li
Hi, folks,
My project will handle about 1.5 M transactions per hour using Drools and
the rules' fire are scheduled based on business operation cycle which might
happen a few times a day. Say if I need to fire the same rule set twice at
10:00 PM and midnight. What will happen if the first execution has not
completed till midnight? Will the 2nd execution be held up till the 1st is
completed? I would assume there might still be transactions inserted into
working memory between 10:00 PM and midnight although it is very few.
My understanding is Drools will enforce only one active thread is working
for the same "then" section for data consistency. Any thoughts?
Best
Abe
12 years, 10 months
Guvnor utility to update packages and models
by Dean Whisnant
We are using Drool and Guvnor 5.1.1 and have approximately 150 rule packages (different rules for different customers, ...). Has anyone written a utility or do you have a suggestion for updating POJO models within each of these that doesn't involve me going to each package within guvnor?
As an example, 50 of my packages might all use the same POJO, we'll call it transactionAv10.jar, and when I go to v11 I currently have to go back into each package in guvnor and archive v10 and then upload v11.
I'm looking for a way that I could do this outside of guvnor. Whether it be doing the updates at the webdav level, or even calling some guvnor functions that do these tasks. For reference, I am using Apache Tomcat to host Guvnor and am using the default database structure.
Any thoughts?
Thank you!
Dean Whisnant
basys, inc.
12 years, 10 months
i want to user drools/Guvnor
by Rule Guy
Hi
I am newbie in Drools, I got an assignment and I found Drools / Guvnor
could be the perfect match for this requirements.
I have a huge database in mySQL in a school (where it has data from kinder
garden kids to PhD students). Management hired a sport medical doctor to
check the health of existing students to prepare a good soccer team. The
teacher want to find these kind of students.
a) students who are within age of 18-21 years old (sample only), parents
allowed to play soccer (let say the targeted population)
b) Among these population he want to screen who has encounter with minor
diseases and visited hospital in last year.
c) in that medical visits he want:
1. student more than 2 visits with chest or leg pain
or
2. under medication with (drug1, drug3, drug7, drug 11).
or
3. student lab test result show nicotine level (smoking) >48
or
4. student lab test result show alcohol level >=1.8
or
5. any chest pain (while running) or leg fracture.
These are the criteria he decided to pull from another software but I can
get XML file, which is infact a rule. He want me to write a rule, where he
can apply same pattern but for another game in future i.e. volleyball
players (where hand fracture is major determinant). and return result in a
format which has been written in Java script.
after studying Drools, I decided Guvnor would be the best tools to apply.
Now my problem is:
a) How can I map xml criteria to Drools.
b) How can I access Guvnor UI (for rule writing by non IT guy) with
Existing school's Software.
c) How can I visualize the results in Java script (already written). so I
don't have to work hard for visualization.
Any suggestion / ideas / steps are welcome.
DG
12 years, 10 months