Hi Jess Experts,

I am a JESS newbie and want to understand whether I am writing the below rule 
in JESS correctly:

We have a User Object and each user has a set of applications associated. Each 
application has a set of accounts and in turn each account has a set of 
profiles.

User Hierarchy:

User {username}
List of Applications {Application - {appName, userName}}
List of Accounts - { Account - {accountName, appName, username}}
List of Profiles - {Profile - {name, accountName, username}}

The rule we want to check is
If an user has a Profile (name = A) in account 1, Profile (name = B) in the 
same account (account 1)
and Profile (name = C) in account 2, Profile (name = D) in account 2
then fire the rule.


Jess Rule:

(defrule AFTS_RULE_01
(User (userName ?userName))
(Application (appName ?appName&:(eq ?appName "AFTS")) (userName ?userName))
(Account (accountName ?accountName1) (userName ?userName))
(Profile (name ?name1&:(eq ?name1 "A")) (accountName ?accountName1) (userName 
?userName))
(Profile (name ?name2&:(eq ?name2 "B")) (accountName ?accountName1) (userName 
?userName))
(Account (accountName ?accountName2&~accountName1) (userName ?userName))
(Profile (name ?name3&:(eq ?name3 "C")) (accountName ?accountName2) (userName 
?userName))
(Profile (name ?name4&:(eq ?name4 "D")) (accountName ?accountName2) (userName 
?userName))
=>
(printout t "ATFS Rule satisfied for " ?appName crlf)
)

Currently we have introduced a variable username in all the objects to maintain 
the relationship between the User object and the child objects.

Is the above rule representation correct or is there a better way to represent 
this rule in Jess?

Regards
Srinath

_______________________________________________

This message is for information purposes only, it is not a recommendation, 
advice, offer or solicitation to buy or sell a product or service nor an 
official confirmation of any transaction. It is directed at persons who are 
professionals and is not intended for retail customer use. Intended for 
recipient only. This message is subject to the terms at: 
www.barclays.com/emaildisclaimer.

For important disclosures, please see: 
www.barclays.com/salesandtradingdisclaimer regarding market commentary from 
Barclays Sales and/or Trading, who are active market participants; and in 
respect of Barclays Research, including disclosures relating to specific 
issuers, please see http://publicresearch.barclays.com.

_______________________________________________

Reply via email to