RE: [rules-users] Rules syntax question using hashmap
by Zevenbergen, Alex
Hi,
I get the following error: Unable to resolve ObjectType 'details'
I've tried different variations (getDetails etc) but 'details is my
attribute name and doesn't seem to be picked up!
alex
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Greg Barton
Sent: 26 February 2009 17:04
To: Rules Users List
Subject: Re: [rules-users] Rules syntax question using hashmap
Can you provide any info on why the third option doesn't work?
--- On Thu, 2/26/09, Zevenbergen, Alex <azevenbergen(a)paddypower.com>
wrote:
> From: Zevenbergen, Alex <azevenbergen(a)paddypower.com>
> Subject: [rules-users] Rules syntax question using hashmap
> To: rules-users(a)lists.jboss.org
> Date: Thursday, February 26, 2009, 10:45 AM
> Hi all,
>
>
>
> Im using an object called 'Fact' this object has
> one attribute that is a
> hashmap 'details'
>
>
>
> I know there are several ways to access the parameters in
> the hashmap
>
>
>
> $f : Fact()
>
> eval ($f.getDetails().get("END_MATCH").toString()
> == "true" &&
> $f.getDetails().get("WINNER").toString() ==
> "HOME")
>
>
>
> $f : Fact(details.END_MATCH == true,details.WINNER ==
> "AWAY")
>
>
>
> $f : Fact()
>
> details(fact == $f, name == "END_MATCH", value ==
> true)
>
>
>
>
>
> I was told the third option works but it doesn't for
> me!
>
>
>
> Anyway my question is: Is there anyway for these sort of
> rules to not
> through an exception if any of the named parameters
> aren't on the
> hashmap 'details'?
>
>
>
> Ideally the rule would simply not fire if it looked for a
> key that
> wasn't there!
>
>
>
> Any info much appreciated
>
>
>
> Alex
>
>
>
>
>
________________________________________________________________________
> Privileged, confidential and/or copyright information may
> be contained in this communication. This e-mail and any
> files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they
> are addressed. If you are not the intended addressee, you
> may not copy, forward, disclose or otherwise use this e-mail
> or any part of it in any way whatsoever. To do so is
> prohibited and may be unlawful. If you have received this
> email in error
> please notify the sender immediately.
>
> Paddy Power PLC may monitor the content of e-mail sent and
> received for the purpose of ensuring compliance with its
> policies and procedures.
>
> Paddy Power plc, Airton House, Airton Road, Tallaght,
> Dublin 24 Registered in Ireland: 16956
>
________________________________________________________________________
_______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
________________________________________________________________________
Privileged, confidential and/or copyright information may be contained in this communication. This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended addressee, you may not copy, forward, disclose or otherwise use this e-mail or any part of it in any way whatsoever. To do so is prohibited and may be unlawful. If you have received this email in error
please notify the sender immediately.
Paddy Power PLC may monitor the content of e-mail sent and received for the purpose of ensuring compliance with its policies and procedures.
Paddy Power plc, Airton House, Airton Road, Tallaght, Dublin 24 Registered in Ireland: 16956
________________________________________________________________________
15 years, 9 months
Rules syntax question using hashmap
by Zevenbergen, Alex
Hi all,
Im using an object called 'Fact' this object has one attribute that is a
hashmap 'details'
I know there are several ways to access the parameters in the hashmap
$f : Fact()
eval ($f.getDetails().get("END_MATCH").toString() == "true" &&
$f.getDetails().get("WINNER").toString() == "HOME")
$f : Fact(details.END_MATCH == true,details.WINNER == "AWAY")
$f : Fact()
details(fact == $f, name == "END_MATCH", value == true)
I was told the third option works but it doesn't for me!
Anyway my question is: Is there anyway for these sort of rules to not
through an exception if any of the named parameters aren't on the
hashmap 'details'?
Ideally the rule would simply not fire if it looked for a key that
wasn't there!
Any info much appreciated
Alex
________________________________________________________________________
Privileged, confidential and/or copyright information may be contained in this communication. This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended addressee, you may not copy, forward, disclose or otherwise use this e-mail or any part of it in any way whatsoever. To do so is prohibited and may be unlawful. If you have received this email in error
please notify the sender immediately.
Paddy Power PLC may monitor the content of e-mail sent and received for the purpose of ensuring compliance with its policies and procedures.
Paddy Power plc, Airton House, Airton Road, Tallaght, Dublin 24 Registered in Ireland: 16956
________________________________________________________________________
15 years, 9 months
EulerGUI released - IDE for semantic Web with Drools engine and Drools export
by Jean-Marc Vanel
Hi
As some of you know, I'm using Drools as an engine for N3 logic (
http://www.w3.org/2000/10/swap/doc/Rules) .
N3 is a language equivalent to Semantic Web's RDF language, but much easier
to read and write by hand.
Moreover, N3 has, on top of RDF, an extension for rules, e.g. :
{ ?x parent ?y } => { ?y child ?x }.
Among many other vocabularies searchable on search site Swoogle (
http://swoogle.umbc.edu/), there is OWL, (OWL Web Ontology Language) that
allows to express in RDF, and thus in N3, rich models with classes,
properties, inheritance and constraints.
So in summary, N3 is a user-friendly language allowing to express facts,
class and properties, and rules.
So what does that bring for Drools users ?
One use case :
- open any number of RDF / OWL / N3 documents
- test and debug the rules using 3 rule engines (Drools, Euler, CWM)
- export all that project as a set of Drools packages, plus the facts in
XMLEncoder format ( by clicking on File / "Export as Drools" )
You can also use standard Semantic Web tools such as Protégé and Swoop to
edit and visualize RDF and OWL files.
Moreover, there are, as part of the Euler project, a library of N3 rules
that implement the logic of OWL and RDF Schema (transitive property,
inheritance, etc), and other goodies, see:
http://eulersharp.svn.sourceforge.net/viewvc/eulersharp/trunk/2003/03swap...
I translate N3 logic into Drools language, using just two classes
corresponding to Triple (statement) ( explanations here :
http://eulergui.svn.sourceforge.net/viewvc/eulergui/trunk/eulergui/html/d...).
Download from
https://sourceforge.net/projects/eulergui
Manual here:
http://eulergui.svn.sourceforge.net/viewvc/eulergui/trunk/eulergui/html/d...
Enjoy !
I've been working on this for several months, so it's beginning to
stabilize. But the rich set of built-in functions for other N3 engines is
still missing, with a few exceptions.
I'm using this framework currently to generate GUI's from domain models (
rules are here : http://deductions.svn.sourceforge.net/viewvc/deductions/n3/).
You will be glad to read that it runs around 2 seconds including
compilation, compared to the other engine (in Prolog) I use, which need
hundreds of seconds (actually a high complexity). A forward chaining engine
seems to make sense for such a constructive task.
I also wrote a How To about what I do currently with EulerGUI :
Deduction project - Java Swing application generator from OWL model and N3
logic rules
http://deductions.svn.sourceforge.net/viewvc/deductions/html/GUIgenerator...
Deduction project is work in progress.
--
Jean-Marc Vanel
http://jmvanel.free.fr/
15 years, 9 months
Help with using Agenda filter and firelimit with Web Guided decision tables
by guyt1122@aim.com
Hi,
I'm using Drools 5.0M5 and Web Guided decision tables. What I want to be able to do is to create several decision tables under one package and then using an Agenda filter and firelimit option to fire one rule from a single decision table that I'm filtering.
What I did to try and accomplish this is the following.? I notice that each row in the decision table has a rule name that matches the following format: "Row 1 DecisionTableName", "Row 2 DecisionTableName" ... "Row N DecisionTableName", so I create a RuleNameEndsWithAgendaFilter agenda filter to only accept rules that ends with "DecisionTableName". Then I call on the StatefulSession.fireAllRules(AgendaFilter, fireLimit) with my agenda filter and a firelimit of 1.
What I'm noticing is some inconsistent behavior were the logic would work sometimes and not other times.? It seems to always works if there is a single decision table under the package.? After debuging the StatefuleSession.fireAllRules(AgendaFilter, firelimit), I tracked down the issue to the way the firelimit count updated in the "DefaultAgenda.fireAllRules(AgendaFilter, fireLimit)" and with the "DefaultAgenda.fireNextItem(AgendaFilter)".
I may have misunderstood what the firelimit meant but it seems like the while loop in the fireAllRules always decrements the firelimit count regardless if the DefaultAgenda.fireNextItem(AgendaFilter) calls the fireActivation method or the fireActivationCancelled method.? I would perfer the firelimit count to only get decremented if the fireNextItem results in a fireActivation method call and I think the logic will work for my scenario.? Looking at the documenation, it look like the logic is geared towards focusing agenda groups, but I do not want to have maintain a agenda group column on my decision tables.? I want each decision table to be an agenda group automagically.
I have included the following code showing the firelimit is always updated in the while loop below:
??? public int fireAllRules(AgendaFilter agendaFilter,
??????????????????????????? int fireLimit) {
??????? this.halt.set( false );
??????? int fireCount = 0;
??????? while ( continueFiring( fireLimit ) && fireNextItem( agendaFilter ) ) {
??????????? fireCount++;
??????????? fireLimit = updateFireLimit( fireLimit );
??????????? this.workingMemory.executeQueuedActions();
??????? }
??????? if ( this.focusStack.size() == 1 && getMainAgendaGroup().isEmpty() ) {
??????????? // the root MAIN agenda group is empty, reset active to false, so it can receive more activations.
??????????? getMainAgendaGroup().setActive( false );
??????? }
??????? return fireCount;
??? }
Thanks,
Guy
15 years, 9 months
Problem with viewing the Business Rule Assets under the Rules Package in Drools Guvnor
by guyt1122@aim.com
Hello,
I have noticed a strange behavior with the Drools Guvnor where I can
not see any of my web guided decision table from the Rules Package
"Business Rule Asset" view.? I can navigate to this decision table
using the "Assets View" and when I click on the "more info" button the addition information on the left hand
side of the decision table
clearly shows that the asset belongs to the expected package that I can
not see it from.? I have tried to archive the decision table and it
does not show up in the archives.? I have tried changing the package
name on the asset and then I tried to navigate to the asset from the
other package, I still can not see it.? Note, the package somehow gets disconnects from the package after a restart the app server. The other strange behavior is that I can make changes to the decision table and then rebuild the packages and the changes show in the package source.? I just can not see the decision table by from the package...
Note, I have configured JackRabbit to store the repository in a database along with a journal node for clustering.
Environment Details:
+ App Server - JBoss 4.0.3.sp1
+ Drools 5.0M5
+ Database - Microsoft Sql Server
+ JackRabbit Repo - Configured to use a Jndi data source configured in JBoss.
Any advise would be appreciated.
Thanks,
-GuyT1122
15 years, 9 months
Error creating field accessors ... in Guvnor
by J Michael Dean
Started new model in Guvnor and declared two fact types. Nothing else
involved. Source code that is provided from Guvnor is shown below.
But when I try to build the package, or create a scenario, I get error
[package configuration problem] Error creating field accessors for
"Hemodynamics" for type "Hemodynamics" and similar error for the other
object. Here is the source that is available after buildling the
snapshot (even though it refused to build):
package vasoactive.decision
declare Hemodynamics
SystolicBP: Integer
DiastolicBP: Integer
CentralVenousPressure: Integer
CurrentDopamineDosePerKg: java.math.BigDecimal
end
declare HemodynamicDecisionState
DetectedHypotension: Boolean
DetectedLowCVP: Boolean
DetectedNormotension: Boolean
DetectedHypertension: Boolean
RecommendedStartDopamine: Boolean
RecommendedDecreaseDopamine: Boolean
RecommendedIncreaseDopamine: Boolean
end
Any assistance greatly appreciated.
15 years, 9 months
Querying persistence rules flow data
by CK
Hi all,
Before I ask my question, just wanted to know if others have noticed
that the Hudson docs for Drools 5 is not available online. Or maybe
it's just me?
I'm a little bit of a beginner in this particular area on the Drools
flow and its persistence mechanism. I have a couple questions that
maybe someone can answer for me.
Say that I have a long-running workflow process. When it reaches a
human task (ie. take out trash), the workflow gets saved/persisted to
the DB. Once the trash is taken out, the user updates this status.
The workflow continues and finishes.
My questions are fairly simple:
1) How would I query for a list of human tasks that have not yet been
completed? I believe the answer for this one is simply in the demo/
test/example codes, but somehow I can't seem to find it. I see mostly
codes that sends complete/fail methods to indicate that the process is
completed. Is there an API for this that I can look at?
2) Is there an API that allows me to query completed items, failed
items, etc? It'd be great if someone can point to the right class.
3) What happens to old long-running processes currently still waiting
to be finished (and stored in the DB) when I decide to change the
workflow process (either manually or in Guvnor)? What would be a good
way in dealing with a situation with changing workflow processes?
Create a new workflow (with a new workflow id) and have all new
requests go through the new workflow? If that's the case, then how
would one "upgrade" the old workflow processes? I believe jBPM also
has an issue with this, along with all other workflow engines with
long-running processes. Is there a recommended way?
4) Is it a good idea to just have Drools store the workflow status
data (ie. task start and completion date) and use that to query and
calculate performance or is it better to create an additional workflow
step that updates my own database table containing these data? Is
there also a recommended way for this procedure?
I appreciate any insights and recommendations that you have.
Thanks,
Chris
15 years, 9 months
Re: [rules-dev] How to get Fact's type from rule package?
by David Sinclair
This should probably be in the users list, not dev. All of that information
is available in the PackageDesc object. For example,
DrlParser parser = new DrlParser();
InputStreamReader reader = new InputStreamReader(
this.getClass().getResourceAsStream( "Misc3.drl" ) );
PackageDescr pkg = parser .parse( reader );
pkg.getGlobals();
pkg.getRules();
etc.
On Mon, Feb 23, 2009 at 9:44 PM, nopea joki <nopea.joki(a)gmail.com> wrote:
> Hi,
> I would like to get all the classes used for Facts in the rules from
> Package like getting global variable information from package.
> Is it possible to have such information?
>
> Regards,
> nj
>
> _______________________________________________
> rules-dev mailing list
> rules-dev(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
15 years, 9 months