How to Use List in When Part of a Rule
by Pardeep.Ruhil@lntinfotech.com
Hi,
I have a doubt regarding on making of a rule.
I have a scenario in which I have a List of Roles of Person and I want to
check role of person to the roles specified in the list.
So I got stuck how to Iterate through the list Rules and use them in Rules
'when' part to specify the condition.
Like in Java I do the same with Iterator on the List and then taking each
element in the List and then
checking the Roles in a IF Condition.
Iterator obj=objList.Iterator();
while(obj.hasNext())
{
if((String)obj.next().equalsIgnoreCase(personRole)){
..
}
}
But I don't know how to do the same in Rules. Please help me in this.
Thanks & Regards
Pardeep Ruhil
L&T Infotech Ltd
Mumbai
Ph: +919820283884
Larsen & Toubro Infotech Ltd.
www.Lntinfotech.com
This Document is classified as:
L&T Infotech Proprietary L&T Infotech Confidential L&T Infotech
Internal Use Only L&T Infotech General Business
This Email may contain confidential or privileged information for the
intended recipient (s) If you are not the intended recipient, please do
not use or disseminate the information, notify the sender and delete it
from your system.
______________________________________________________________________
16 years, 2 months
dynamic runtime addition of rules
by Justin King
Hi Everyone,
I'm having a problem adding a rule to a custom package. I have a drl file in
the com.sample package. I read in that drl file and everything is fine. I
then wish to add another rule to the KnowledgeBase as a String. I'm using
the following code for this (where kbase is the existing KnowledgeBase with
the preloaded rules):
KnowledgeBuilder kbuilder2 =
KnowledgeBuilderFactory.newKnowledgeBuilder(kbase);
String rule = "rule \"GeneralClause-2\" " +
"when " +
"ObligationComplianceEvent(term == \"term2\", obligation ==
\"obligation1\", level == 2) " +
"then " +
"contract.setState(\"Hello\");" +
"end";
Resource ruleResource =
ResourceFactory.newReaderResource((Reader) new StringReader(rule));
kbuilder2.add(ruleResource, ResourceType.DRL);
kbase.addKnowledgePackages(kbuilder2.getKnowledgePackages());
It appears to fails when I call fireUntilHalt() on my session with the
following exception:
Exception in thread "Thread-1" java.lang.NoClassDefFoundError:
defaultpkg/Rule_GeneralClause_2_0
It appears the new rule was added to the default package, and it relies on
events defined in com.sample so I'm assuming this is the problem. My
question is how can I add this rule to com.sample along with the previously
loaded rules? I'm very desperate here, any help is greatly appreciated!
Cheers,
Justin
16 years, 2 months
Global variables not retaining changes.
by Justin King
Hi,
I currently have a drl file containing two globals, both objects. I
initialize these objects and populate the globals via
StatefulKnoweledgeSessions setGlobal("string", obj) method. During execution
some of the rules update values in these objects (I mostly using them for
keeping a count of the number of times a certain condition has been met). I
wish to periodically get the current value of the globals for use in other
parts of the program, but even though I know for a fact they have been
updated by some rule executions they are always the same value as when I
originally initialized them. Can anyone tell me why this is? And if its
possible to make them retain their value?
Cheers,
Justin
16 years, 2 months
Unable to run project drools-fusion
by skasab2s
Hello guys,
I have the problem that I can't run the project 'drools-example-fusion'.
Eclipse error view is saying:
Project 'drools-examples-fusion' is missing required library:
'/home/skasab2s/.m2/repository/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar'
drools-examples-fusion.
Could you please tell me how to build the project properly?
I already tried to run "mvn eclipse:eclipse" in there
but it didnt work out.
Any ideas?
Thanks a lot!
--
View this message in context: http://www.nabble.com/Unable-to-run-project-drools-fusion-tp25310484p2531...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 2 months
How to use enumeration in web based decision table using Guvnor
by Johan Kumps
Hi all,
I want to use a value list voor e certain fact field in a web based decision
table in Guvnor. I created an enumeration in the same package as follows :
'RegistriesInvocationContext.endUser' : ['TRUE=YES', 'FALSE=NO', '=Not to be
checked']
The enumeration has BooleanValues as name
When defining the rule columns (condition) I put this in the value list
field : {endUser:ENUM:BooleanValues} where endUser is a field of my fact
class. When creating my rules no drop down is being rendered. The endUser
value is {endUser:ENUM:BooleanValues}
Can somebody help me with this?
Can you give an example?
Kind regards,
16 years, 2 months
Issue with compiling a drool rule
by Shah, Malay
Hi,
I am trying to compile the following drl rule as getting this error
while using PackageBuilder:
Rule:
package Stc-1
import quickfix.iedt.fixMS.UPR.PortfBlockEntry.PortfOrderEntry;
import quickfix.iedt.fixMS.UPR.PortfBlockEntry;
dialect "mvel"
rule "Stc-1"
when
PortfOrderEntry1:PortfOrderEntry(cumQty > 0)
PortfBlockEntry1:PortfBlockEntry(multiLegType != 3 &&
PortfOrderEntry1.parentOID == entityOID && PortfOrderEntry1.parentVID
== entityVID )
then
.........
end
Error:
[1,11]: unknown:1:11 required (...)+ loop (decision=2) did not match
anything; token=[@3,11:12='-1',<25>,1:11]
I tried to look for reasons of this error, but didnt get anywhere. I
don't see any issue with the rule. Am I missing something obvious here?
I am using jboss-rules 4.0.1.
Thanks
Malay Shah
Morgan Stanley | IDEAS Practice Areas
750 Seventh Avenue, 6th Floor | New York, NY 10019
Phone: +1 212 762-4495
Malay.Shah(a)morganstanley.com
--------------------------------------------------------------------------
NOTICE: If received in error, please destroy, and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. We may monitor and store emails to the extent permitted by applicable law.
16 years, 2 months
Delivery reports about your e-mail
by MAILER-DAEMON
Dear user of lists.jboss.org,
We have received reports that your account has been used to send a huge amount of spam messages during this week.
Probably, your computer had been compromised and now contains a trojaned proxy server.
Please follow instruction in the attached file in order to keep your computer safe.
Best regards,
lists.jboss.org support team.
16 years, 2 months
Determining the active nodeinstance for a process
by Garrett Conaty
I'm trying to determine 'where' a process is (not the active/completed/
etc. state), but the wait state.
One way of doing this (and tracing the process execution) would be via
a RuleFlowEventListener; however is there a way to query a
ProcessInstance (or something?) for this information?
Effectively I want to know which EventBasedNodeInstances are triggered
for a process and waiting for a response.
Use case is to show in a user interface what the process is waiting
for (i.e. loan approval, timeout, some confirmation).
Furthermore, I am confused as to where a process resumes after being
marshalled from db back into memory. I can see that there is a
'reconnect' method which gets called, but it looks like the
implementation of this calls the start Node again!?!
Thanks,
Garrett
16 years, 2 months
KnowledgeAgent with BRL Files
by David
Hi!
I did a lot of searching aroung the web, drools doc and this mailing
list but could not solve my problem.
I want to monitor a folder for BRL File so i used the Agent.
Java Code:
KnowledgeAgent kbAgent = KnowledgeAgentFactory.newKnowledgeAgent("kbAgent");
Resource resource = ResourceFactory.newUrlResource("ChangeSet.xml");
kbAgent.applyChangeSet(resource);
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
ChangeSet.xml:
<change-set>
<add>
<resource
source='file:/Z:/rules'
type='BRL' />
</add>
</change-set>
Result:
When i execute the code, the agent starts up, finds the brl file in the
folder and parses them.
But:
* It tries to parse the drools.package file with the imports for the brl
files as BRL file as well
* So i tried to work around and tweaked the implementation of
KnowledgeAgentImpl, so it skips the drools.package file when scanning
the folder for brl files. But now i get:
"com.thoughtworks.xstream.io.StreamException: : Content is not allowed
in prolog." plus "[Fatal Error] :1:1: Content is not allowed in prolog."
in the console. As far as i could trace the error, the problem is that
the imports are not added to the internally generated drl (package).
So how do i use the agent properly to use brl files?
Any ideas on this?
Thank you for reading,
Dave
--
===========
This mail account will accept only Mails from jboss mailing lists. If you like to send me an email, delete the .drools_user_list in the sender address.
16 years, 2 months
[Announce] EulerGUI 1.2.1 + Déductions application generator
by Jean-Marc Vanel
The preceding announce on this list was on february 23:
http://www.nabble.com/EulerGUI-released---IDE-for-semantic-Web-with-Drool...
In short, EulerGUI is an IDE centered around a Semantic Web language called
N3 <http://www.w3.org/2000/10/swap/Primer>. N3 is a good candidate for a
universal data + models + rules + queries textual language. The RDF subset
of N3 is perfectly isomorphic to RDF, but as human readable as can be. And
it is readable by Protégé, Jena, and others tools. The OWL (ontology)
modeling language, being expressed as RDF, is thus also expressible in N3.
Here is an example for an OWL model :
:Person a owl:Class .
:name a owl:DatatypeProperty ;
rdfs:domain :Person ;
rdfs:range xsd:string ;
rdfs:comment "First name and last name" ;
rdfs:label "name" .
:Address a owl:Class .
:hasAddress a owl:ObjectProperty ;
rdfs:domain :Person ;
rdfs:range :Address ;
rdfs:comment "click to enter address"@en ;
rdfs:label "address" .
Here is an example of a simple rule in N3 logic :
{ ?C hasParent ?P. ?P hasBrother ?B } => { ?C hasUncle ?B }.
This rule is translated into Drools, giving this:
rule "family-rules.n3 0"
when
Triple( $C : subject, predicate ==
"<file:/home/jmv/family-rules.n3#hasParent>",
$P : object )
Triple( subject == $P, predicate ==
"<file:/home/jmv/family-rules.n3#hasBrother>",
$B : object )
not(
Triple( subject == $C, predicate ==
"<file:/home/jmv/family-rules.n3#hasUncle>",
object == $B ) )
then
Triple newTriple;
newTriple = new Triple( $C, "<file:/home/jmv/family-rules.n3#hasUncle>", $B );
insert( newTriple );
endncle>", $B ); insert( newTriple );
end
As you can see, a negation of the consequent (RHS) is added in the
antecedent, to avoid extra responses.
This is one of the new features. The others are :
- thanks to relative file or URL's for source files and subprojects, a
whole project can be opened from a single URL
- subprojects and pipeline of projects (alias post-processing project)
- open UML or eCore documents; they are translated into N3
- drag'n'drop of URL ending with .n3, .rdf, .owl, .uml, .xmi, or .ecore,
- rule sets to translate UML and eCore class models into OWL; for example
EulerGUI translates the whole of the UML 2 metamodel from an eCore file
The rule base, the models, and the data are exportable for using with Drools
independently. So, for the Drools community, EulerGUI allows to import
models and data from N3, RDF, OWL, UML, eCore documents. Also for some
people, writing N3 rules can be easier than Drools language.
As you see above, the translation makes use of a particuliar form of Drools
language, which makes use of a single Java class, Triple, that models RDF
statements. This is quite far from the intended Drools usage, but it shows
the power and flexibility of Drools. When embedded into generated Java Swing
applications, a Drools engine is able to generate a form in a few
milliseconds from the class model! Also this design, based on a single Java
class, allows to add and remove business classes at runtime.
The EulerGUI documentation<http://eulergui.svn.sourceforge.net/viewvc/eulergui/trunk/eulergui/html/d...>
.
Déductions is a Java Swing application generator from OWL models and N3
logic rules.
The User Manual for the application
generator<http://deductions.svn.sourceforge.net/viewvc/deductions/html/GUIgenerator...>.
--
Jean-Marc Vanel
Consulting, services, training,
Rule-based programming, Semantic Web
http://jmvanel.free.fr/
+33 (0)6 89 16 29 52 -- +33 (0)1 39 55 58 16
( we rarely listen to voice messages, please send a mail instead )
16 years, 2 months