Re: JESS: Help on the syntax of a rule.
I think ROSSEL, Olivier (CIMPA) wrote: > But such a syntax seems to fail: > > defrule doStuff "" > ?o <- (object (is-a FOO) (name ?name&~nil)) > (not (foo (bar (?name trim ... > Any comment? In Jess, just as in all computer languages, you have to use the proper syntax. An unadorned function call can't be a slot contraint -- that's just the way it is. You can use a return value constraint: defrule doStuff "" ?o <- (object (is-a FOO) (name ?name&~nil)) (not (foo (bar =(?name trim ... I've just added just one character. - Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
RE: JESS: Help on the syntax of a rule.
>> I am using Jess with Protege. I want to write a rule that says: run >> when you get an oject FOO with a non-empty slot called 'name' and >> where there is no fact foo with property bar equal to the slot >> value. I would intuitively wirte that this way: > > (defrule doStuff "" > ?o <- (object (is-a FOO) (name ?name&~nil)) > (not (foo (bar ?name))) > => > ... > ) Ok. But such a syntax seems to fail: defrule doStuff "" ?o <- (object (is-a FOO) (name ?name&~nil)) (not (foo (bar (?name trim => ... ) I changed that to: defrule doStuff "" ?o <- (object (is-a FOO) (name ?name&~nil)) (not (foo (bar ?name2&:(eq ?name (?name2 trim) => ... ) Any comment? This e-mail is intended only for the above addressee. It may contain privileged information. If you are not the addressee you must not copy, distribute, disclose or use any of the information in it. If you have received it in error please delete it and immediately notify the sender. Security Notice: all e-mail, sent to or from this address, may be accessed by someone other than the recipient, for system management and security reasons. This access is controlled under Regulation of Investigatory Powers Act 2000, Lawful Business Practises. To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
Re: JESS: Help on the syntax of a rule.
I think ROSSEL, Olivier (CIMPA) wrote: > I am using Jess with Protege. I want to write a rule that says: run > when you get an oject FOO with a non-empty slot called 'name' and > where there is no fact foo with property bar equal to the slot > value. I would intuitively wirte that this way: (defrule doStuff "" ?o <- (object (is-a FOO) (name ?name&~nil)) (not (foo (bar ?name))) => ... ) > Is it a correct syntax? There were some extra close-parentheses, which I've removed. I also added a "not nil" condition to meet the "non-empty" requirement, assuming that nil is the default value for that slot. Other than that's it's fine as far as I know -- whether it's actually correct or not depends on the "object" and "foo" templates. - Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]