Hi,
Thanks for the ealier response.
;create templates
(deftemplate Property (slot path) (slot name) (slot datatype))
(deftemplate PropertyGroup (slot path) (slot name) (multislot Properties) )
(deftemplate BusinessObject (slot name) (multislot parentPaths)
(multislot Properties) (multislot PropertyGroups))
(assert
(BusinessObject (name Account)
(Properties
(assert (Property (path \Account) (name firstName) (datatype
STRING)))
(assert (Property (path \Account) (name lastName) (datatype
STRING))))
(PropertyGroups
(assert (PropertyGroup (path \Account) (name AccountAddress)
(Properties
(assert (Property (path \Account\\AccountAddress) (name
city) (datatype STRING)))
(assert (Property (path \Account\\AccountAddress) (name
state) (datatype STRING))))
)))))
(defrule CreateAccountRule "AccountCreationRule"
?fact <- (BusinessObject (name ?name) (Properties $?properties)
(PropertyGroups $?propertyGroups))
=>
(printout t "id=" ?fact crlf)
(printout t "name=" ?name crlf)
(printout t "Properties=" $?properties crlf)
(printout t "PropertyGroups=" $?propertyGroups crlf)
)
(clear)
(batch jessrules.clp)
(watch all)
(facts)
(run)
If run a batch file, below i get the output...
Jess> (batch cmd.clp)
f-0 (MAIN::Property (path \Account) (name firstName) (datatype STRING))
f-1 (MAIN::Property (path \Account) (name lastName) (datatype STRING))
f-2 (MAIN::Property (path \Account\AccountAddress) (name city) (datatype STRIN
G))
f-3 (MAIN::Property (path \Account\AccountAddress) (name state) (datatype STRI
NG))
f-4 (MAIN::PropertyGroup (path \Account) (name AccountAddress) (Properties <Fa
ct-2> <Fact-3>))
f-5 (MAIN::BusinessObject (name Account) (parentPaths ) (Properties <Fact-0> <
Fact-1>) (PropertyGroups <Fact-4>))
For a total of 6 facts.
FIRE 1 MAIN::CreateAccountRule f-5
id=<Fact-5>
name=Account
Properties=(<Fact-0> <Fact-1>)
PropertyGroups=(<Fact-4>)
1
Now my question is how read the slots and multislots of $?properties
(name, dataType etc) and $?propertyGroups (name, dataType,
Properties). The property groups itself another multislot Properties,
so again I need to retrive the slots of these properties.
Thanks in adavance!!
Srini
--------------------------------------------------------------------
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]
--------------------------------------------------------------------