|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
JESS: JessML and metaphorsHi, I am looking for ways to have additional data in JessML to represent concepts such as decision tables. Looking at the Jess schema, the 'properties' seem to be a good place to add more data.
I also looked in Jess JSR 94. javax.rules.admin has a method to retrieve by a property by name.
Is what I did a reasonable approach?
Any help is appreciated. Son |
|
|
Re: JESS: JessML and metaphorsThe javax.rules properties and the JessML properties are completely
unrelated. Rule metadata may be added to Jess in the future, but right now there's no way to get Jess to carry arbitrary rule properties around -- sorry. You'll have to store this data separately. On Sep 1, 2009, at 2:13 PM, Nguyen, Son wrote: > > Hi, > > I am looking for ways to have additional data in JessML to represent > concepts such as decision tables. > > Looking at the Jess schema, the 'properties' seem to be a good place > to add more data. > The properties of the rule seem to fit the bill. However, I did not > see any api of the Defrule class that would let me get the properties. > > I also looked in Jess JSR 94. javax.rules.admin has a method to > retrieve by a property by name. > This sounds promising. But, after adding a few properties in the > rules (JessML), and a few line of Java using JSR 94, > Rule.getProperty("testProperty") returns null. I see the names of > the rules but there are no properties. > > Is what I did a reasonable approach? > Are there other ways to add medata to JessML without having to alter > the schema? > > Any help is appreciated. > > Son > --------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences Phone: (925) 294-2154 Sandia National Labs PO Box 969, MS 9012 ejfried@... Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
|
|
JESS: how to dumping rules ?Hi
I tried to dump the rules loaded at some point in time as follows but it did not work out... I do not know the names beforehand and have to figure out why they are not firing... Jess> (rules) For a total of 0 rules in module MAIN. Jess> (defrule x (f $? )=>) TRUE Jess> (rules) MAIN::x For a total of 1 rules in module MAIN. Jess> (bind ?rulelist (rules)) MAIN::x For a total of 1 rules in module MAIN. Jess> ( foreach ?v ?rulelist (ppdefrule ?v )) Jess reported an error in routine foreach while executing (foreach ?v ?rulelist (ppdefrule ?v)). Message: Argument must be ValueVector, Collection, or Iterator: nil. Program text: ( foreach ?v ?rulelist ( ppdefrule ?v ) ) at line 6. Jess> (printout t ?rulelist) nil Jess> Kind Regards, joe -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
|
|
Re: JESS: how to dumping rules ?(rules) just prints, returning nil.
(foreach ?v (explode$ (ppdefrule *)) (ppdefrule ?v)) -W On Wed, Sep 2, 2009 at 11:25 AM, jo <etaoinbe@...> wrote: Hi |
|
|
Re: JESS: how to dumping rules ?On Sep 2, 2009, at 5:25 AM, jo wrote: > Hi > > I tried to dump the rules loaded at some point in time as follows > but it did not work out... > I do not know the names beforehand and have to figure out why they > are not firing... > That's what "(ppdefrule *)" does. --------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
|
|
Re: JESS: how to dumping rules ?Looks like (ppdefrule *) is sufficient, Jess> (foreach ?v (explode$ (ppdefrule *)) (ppdefrule ?v)) Jess reported an error in routine call while executing (call (engine) findDefrule ?__rule) while executing (bind ?__defrule (call (engine) findDefrule ?__rule)) while executing (if (eq ?__rule *) then (bind ?sb (new StringBuffer)) (bind ?it (call (engine) listDefrules)) (while (call ?it hasNext) (call ?sb append (new jess.PrettyPrinter (call ?it next))) (call ?sb append " ")) (call ?sb toString) else (bind ?__defrule (call (engine) findDefrule ?__rule)) (if (neq ?__defrule nil) then (call (new jess.PrettyPrinter ?__defrule) toString) else (str-cat "No such rule: " ?__rule))) while executing deffunction ppdefrule while executing (ppdefrule ?v) while executing (foreach ?v (explode$ (ppdefrule *)) (ppdefrule ?v)). Message: No overloading of method 'findDefrule' in class jess.Rete I can call with these arguments: (call (engine) findDefrule ?__rule). Program text: ( foreach ?v ( explode$ ( ppdefrule * ) ) ( ppdefrule ?v ) ) at line 3. Je From: Wolfgang Laun <wolfgang.laun@...> To: jess-users@... Sent: Wednesday, September 2, 2009 1:55:47 PM Subject: Re: JESS: how to dumping rules ? (rules) just prints, returning nil. (foreach ?v (explode$ (ppdefrule *)) (ppdefrule ?v)) -W On Wed, Sep 2, 2009 at 11:25 AM, jo <etaoinbe@...> wrote: Hi |
|
|
|
|
|
Re: JESS: how to dumping rules ?Maybe that is what you want?
(bind ?it ((engine) listDefrules)) (while (?it hasNext) (printout t (ppdefrule ((?it next) getName)) crlf crlf) ) Regards, Florian > On Wed, Sep 2, 2009 at 11:25 AM, jo <etaoinbe@... > <mailto:etaoinbe@...>> wrote: > > Hi > > I tried to dump the rules loaded at some point in time as follows > but it did not work out... > I do not know the names beforehand and have to figure out why they > are not firing... > > Florian Fischer Hôpitaux Universitaires de Genève Service d'Informatique Médicale Rue Gabrielle-Perret-Gentil 4 CH-1211 Genève 14 Tél: +41 22 3728861 -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
|
|
Re: JESS: how to dumping rules ?Cool, works like a charm...
Thanks Joe ----- Original Message ---- From: Florian Fischer <florian.fischer@...> To: jess-users@... Sent: Wednesday, September 2, 2009 3:56:32 PM Subject: Re: JESS: how to dumping rules ? Maybe that is what you want? (bind ?it ((engine) listDefrules)) (while (?it hasNext) (printout t (ppdefrule ((?it next) getName)) crlf crlf) ) Regards, Florian > On Wed, Sep 2, 2009 at 11:25 AM, jo <etaoinbe@... <mailto:etaoinbe@...>> wrote: > > Hi > > I tried to dump the rules loaded at some point in time as follows > but it did not work out... > I do not know the names beforehand and have to figure out why they > are not firing... > > Florian Fischer Hôpitaux Universitaires de Genève Service d'Informatique Médicale Rue Gabrielle-Perret-Gentil 4 CH-1211 Genève 14 Tél: +41 22 3728861 -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
|
|
JESS: matching field item : in rule ?Hi,
I have a fact with a field containing the symbol : However I have not managed to match it with a rule. Is there a way to achieve this? Jess> (assert (f : )) <Fact-0> Jess> (defrule x (f : )=>) Jess reported an error in routine Jesp.parseFuncall. Message: Expected '(' at token ')'. Program text: ( defrule x ( f : ) at line 2. Jess> Jess reported an error in routine Jesp.parseExpression. Message: Expected a '(', constant, or global variable at token '='. Program text: = at line 2. Jess> > Jess> Jess reported an error in routine Jesp.parseExpression. Message: Expected a '(', constant, or global variable at token ')'. Program text: ) at line 2. Jess> (defrule x (f ":")=> (printout t aaa)) TRUE Jess> (run) 0 Jess> (watch all) TRUE Jess> (run) 0 Thanks Joe -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
|
|
Re: JESS: matching field item : in rule ?First, let me say that strictly, this isn't legal. The ":" character
is a special character in Jess and although the parser is letting you get away with asserting that fact, it really shouldn't. It should be an error right there. But given that you've already gotten into this situation, you could actually write something like (defrule foo (f ?x&:(eq ?x :)) => ) In recent versions of Jess, this will compile to the same exact network as the original direct match you tried -- i.e., the function call will be optimized away. On Sep 2, 2009, at 11:20 AM, jo wrote: > Hi, > > I have a fact with a field containing the symbol : > > However I have not managed to match it with a rule. Is there a way > to achieve this? > > Jess> (assert (f : )) > <Fact-0> > Jess> (defrule x (f : )=>) > Jess reported an error in routine Jesp.parseFuncall. > Message: Expected '(' at token ')'. > Program text: ( defrule x ( f : ) at line 2. > Jess> Jess reported an error in routine Jesp.parseExpression. > Message: Expected a '(', constant, or global variable at token '='. > Program text: = at line 2. > Jess> > > Jess> Jess reported an error in routine Jesp.parseExpression. > Message: Expected a '(', constant, or global variable at token ')'. > Program text: ) at line 2. > > Jess> (defrule x (f ":")=> (printout t aaa)) > TRUE > Jess> (run) > 0 > Jess> (watch all) > TRUE > Jess> (run) > 0 > > Thanks > Joe > > > > > > -------------------------------------------------------------------- > To unsubscribe, send the words 'unsubscribe jess-users > you@...' > in the BODY of a message to majordomo@..., NOT to the list > (use your own address!) List problems? Notify owner-jess-users@... > . > -------------------------------------------------------------------- --------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
| Free embeddable forum powered by Nabble | Forum Help |