Re: [rules-users] Using GlobalArea in Guvnor
by John Peterson
>Message: 7
>Date: Fri, 10 Dec 2010 09:48:21 -0700
>From: "John Peterson" <john.peterson.gv3k(a)statefarm.com>
>Subject: [rules-users] Using GlobalArea in Guvnor
>To: <rules-users(a)lists.jboss.org>
>Message-ID:
>
<D3A6E68928C9104BB815C83F43A36BDF0EF4EA42(a)WPSCV6NH.OPR.STATEFARM.ORG>
>Content-Type: text/plain; charset="US-ASCII"
>
>Hi,
>
>I'm working with Guvnor 5.1.1 and I'm having an issue accessing
>Declarative Models defined in the Global Area in the Packages. Is it
>possible to create a shared model in the Global Area and then write
>rules against them in other packages? It would seem to me that the
>answer would be yes (why else have a "Global" area), but, for some
>reason, it doesn't seem to recognize them.
>
>Here's a scenario:
>
>I declare a DeclarativeModel in GlobalArea:
>
>GenericFact
> id: Integer
> valueOne: Integer
> label: String
>end
>
>I have a package called com.experiment. I'd like to write Business
Rule
>in it using that GenericFact. However, when I click the "+" sign to
add
>a Fact, I see a yellow background over "Note: No model has been
>defined." Is there something that needs to be done to make the
>GlobalArea stuff viewable from the individual packages?
Follow-up from last Friday: I have not been able to figure out this
situation.
It would appear that I am supposed to "import" my model from my Global
Area into my other packages for use, but whenever I create "New
declarative model" or "Upload POJO Model jar" and then select "Import
asset from global area", there's nothing in the drop down for "Asset to
import". I have 2 Model assets in the global area - one a POJO, the
other a Declarative model. Is there something that needs to be done to
make these "visible" to the other packages? I can't find anything in
the documentation about it.
13 years, 10 months
process-designer deserialization error
by AlfredoLatini
Hi,
i have a problem with oryx process-designer and drools guvnor. I have
created a process with process-designer and i saved it. Then i have opened
this file with eclipse and i uploaded this file in guvnor repository.
I have opened the process in drools guvnor and the following exception
occurred:
The server encountered an internal error () that prevented it from
fulfilling this request.</u></p><p>exception
<pre>javax.servlet.ServletException:
http://localhost:8080/designer/bpmn2_0deserialization
org.drools.guvnor.server.GuvnorAPIServlet.service(GuvnorAPIServlet.java:73)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
How can i fix this problem?
My jboss installation runs on port 8580 because 8080 is busy (oracleXE).
Thanks in advance
Alfredo.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/process-designer-dese...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Subject: Drools Planner - Design Suggestions
by Dave Wellman
All,
Maybe someone could offer some smart pointers on how to best setup a drools
planning project where I am trying to optimize ad display.
The project game plan is:
* At any one time there is only one ad in play across all 4K+ sites.
* Ads are scored and ranked by value and potential of generating a click. We
know what ad is the most valuable down to the least.
* Each of the 10,080 minutes in a week is scored by how much traffic is seen
at that minute. (the curve is a predictable 7 peak mountain. Each peak is
variable but around 2:00 PM EST with the biggest peak on Thursday and lowest
on Sunday. Valleys are around 3:00 am. A small hemigog around 10:00 and
12:00 weekdays.
* Each ad is "in play" from between 10 to 60 minutes. Meaning that one ad
is displayed across all properties for at least 10 minutes and a most 60.
* Once a add gets a certain number of clicks it is "100% sold" and then
removed from the queue. If an ad is sold before the 60 minutes is up it is
removed and the next ad in line take its place. If it is under 10 minutes
it will stay in play and continue to be "sold" until the first 10 minutes is
up.
Is drools scheduler the right tool for this job or could you suggest
something better?
Thank you for any insights you all have.
13 years, 10 months
Drools Flow within Stateless Session in Drools 5.1
by JeffMax
I am seeing some odd behavior where it seems that inference is not working
when trying to use a flow process within a stateless knowledge session. I
have tried to do the same thing in both stateful and stateless, and the
behavior is different. It appears that if one rule inserts a fact in its
right hand side that causes another rule in a different flow-group to become
activated, the rule-flow (which should progress to the next flow group) will
not allow that rule to fire if the session is stateless. It is possible I am
confused about how a rule-flow evaluates or the order in which it evaluates
with respect to inference, but it is working as I expected in a stateful
session.
An example:
I have a simple rule flow with two flow-groups, group1 and group2. They are
connected one after the other
in a file with id TestFlow
start->group1 -> group2 -> end
I then have a simple rules file:
declare Fact1
num: int
end
declare Fact2
num: int
end
rule "Rule1"
ruleflow-group "group1"
when
Fact1()
then
System.out.print("FIRING 1");
insert(new Fact2());
end
rule "Your Second Rule"
ruleflow-group "group2"
when
Fact2()
then
System.out.print("FIRING 2");
end
When used in a stateful session, both rules will fire and print their
respective output. In a stateless, the second rule will never fire. To
execute this test, I am using the same code against both a stateless and
stateful session:
FactType fact = kbase.getFactType("org.test", "Fact1");
Object one = fact.newInstance();
List cmds = new ArrayList();
cmds.add(CommandFactory.newInsert(one));
cmds.add(CommandFactory.newStartProcess("TestFlow"));
cmds.add(CommandFactory.newFireAllRules()); // Only need this in stateful
ksession.execute(CommandFactory.newBatchExecution(cmds));
Does anyone have any suggestions?
Thanks,
Jeff
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Flow-within-St...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 11 months
QA features in BRMS
by Benson Fung
Hi,
Can anyone know whether QA features can provide the rule conflict checks?
Thanks
13 years, 11 months
qualified identifiers in constraints: not commutative?
by Michael Whidden
I notice an unexpected behavior when creating a technical DRL in Guvnor.
If I have a fact with a sub-fact, then binary operators don't seem to be
commutative.
Eg.,
declare Broker
maxQ: Integer
declare Order
q: Integer
b: Broker
The rule
$o:Order($o.b.maxQ < $o.q)
validates fine, but
$o:Order($o.q > $o.b.maxQ)
returns an error "Unable to create restriction
'[QualifiedIndentifierRestr: > $o.broker.maxQ ]' for field '$o.q' in the
rule"
I'm new, so I want to make sure I'm not missing something obvious here...
13 years, 11 months
Facts with "from"
by Chris Selwyn
I am trying to understand the usage of "from".
Do I take it that facts that come from a "from" CE do not actually get
asserted into the WM?
I would like to be sure because the facts that I would like to fetch
with "from" are actually the same Java class as one of my WM facts but I
do not want the "from" facts to be treated the same as the ones that are
in WM... I do not want them to fire rules that the "normal" WM facts would.
Chris
13 years, 11 months
Integration of Drools with Hadoop
by Roger Smith
We are working on a project to integrate Drools with Apache Hadoop,
http://hadoop.apache.org/, and run into some road blocks. We would very much
appreciate any suggestions/help from this list.
We have an app where we call drools rule engine inside the reducer task of a
Hadoop map reduce job. It throws a NullPointerException when we the rule
package resource to the knowledge builder. The same code works fine when
run as part of a stand alone app.
Code:
private static Map<String, StatefulKnowledgeSession> sessions =
new HashMap<String, StatefulKnowledgeSession>();
private static final String RULE_PACK_DIR = "
file:///home/roger/Projects/gridx/ <file:///\\home\pranab\Projects\gridx\>";
private static final String RULE_PACK_EXT = ".drl";
public int process(String rulePackage, String dateTime, String type)
throws TException {
int rate = 0;
StatefulKnowledgeSession session = sessions.get(rulePackage);
if (null == session){
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
String rulePackPath = RULE_PACK_DIR + rulePackage +
RULE_PACK_EXT;
kbuilder.add( ResourceFactory.newFileResource(rulePackPath ),
ResourceType.DRL);
if ( kbuilder.hasErrors() ) {
System.err.println( kbuilder.getErrors().toString() );
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
session = kbase.newStatefulKnowledgeSession();
sessions.put(rulePackage, session);
}
ContractRule contractRule = new ContractRule();
contractRule.prepare(dateTime, type);;
FactHandle ruleHandle = session.insert(contractRule);
session.fireAllRules();
System.out.println("" + contractRule);
rate = contractRule.getRate();
session.retract(ruleHandle);
return rate;
}
This line throws the exception:
kbuilder.add( ResourceFactory.newFileResource(rulePackPath ),
ResourceType.DRL);
It works fine as a stand alone app, outside hadoop
Roger Smith
13 years, 11 months
working with aray list
by wasim.khan318
public static class Item
{
private String CustomerId;
private String Item;
}
public static class Data
{
public ArrayList<Item> items = new ArrayList<Item>();
public ArrayList<Item> GetData()
{Item item1 = new Item();
// some code
from database
item1.CustomerId=rs.getString("CustomerId");
item1.Price=rs.getString("item");
items.add(item);
return item1
}
1.how to write rule how to find customer of a perticular Item
2. what i have written
$D:Data();
$I:Item();
$R:Item(item =="I1" )from $D.GetData() ;
then
System.out.println("hello");
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/working-with-aray-lis...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 11 months