You are mixing technical issues with questions about fact representation. Technically, the internal structure of an ordered fact is *defined* to be close to that of an ordered fact and the slot name "__data" just happens to be the stand-in for the (from a user's point of view) anonymous single multislot. Explicitly declaring an ordered fact to have a single multislot called "__data" is superfluous; you should do that by (deftemplate opposite-of (declare (ordered TRUE))) and not worry about internals.
As for fact representation, I just wonder whether a proposition "White is the opposite of black" in addition (!) to "Black is the opposite of white" makes much sense. It may make sense if you associate some special meaning with the subject of the sentence, but otherwise it should be possible to write all rules with just a single fact asserting the contrasting things. If, however, there is a distinction to be made, using unordered facts should be considered; to use your example, a river's "left shore" would be the opposited of a "right shore" - but it would also have a special property, warranting a deftemplate such as (opposite-of (left shore-1) (right shore-2)) -W On 22 November 2010 06:36, <[email protected]> wrote: > > Hi Jess-users, > > > > Just trying to understand, how the following deffacts can represent in > deftemplate? > > > > (deffacts MAIN::opposites > > (opposite-of shore-1 shore-2) > > (opposite-of shore-2 shore-1)) > > > > Jess is creating a *implied* template for this as below. > > (deftemplate MAIN::opposite-of > > "(Implied)" > > (multislot __data)) > > > > Here the term *__data* is not very much clear, since if I keep this as > template explicitly as follows – > > (deftemplate MAIN::opposite-of > > (multislot __data)) > > > > The ruleset is running fine as expected, and JESS is not creating again the > *implied* template in this case. But, if I change it to some other name, say > *data* instead of *__data*, JESS engine throwing a exception (Jess reported > an error in routine Jesp.parseFact.)while parsing the above fact. > > > > Also, if I create the template as follows using *slot*. > > (deftemplate MAIN::opposite-of > > (slot shore-1) > > (slot shore-2)) > > > > But in this case, the deffacts needs to be defined as follows, which seems > not same as mentioned above, and the rule is not working as expected. > > > > (deffacts MAIN::opposites > > (opposite-of (shore-1 shore-2)) > > (opposite-of (shore-2 shore-1))) > > > > OR > > > > (deffacts MAIN::initial-opposite-of > > (opposite-of (shore-1 shore-2) > > (shore-2 shore-1))) > > > > So, if anyone can clarify this. > > > > > > Regards > > > > DEBASISH DALUI (122816) > ----------------------------------- > > BFS - Technology Solutions Group, > > Cognizant Technology Solutions, > > Cell: +91 9674069478 > > Office: +91-33-44306060; VNet: 336063 > > > > This e-mail and any files transmitted with it are for the sole use of the > intended recipient(s) and may contain confidential and privileged information. > If you are not the intended recipient, please contact the sender by reply > e-mail and destroy all copies of the original message. > Any unauthorised review, use, disclosure, dissemination, forwarding, printing > or copying of this email or any action taken in reliance on this e-mail is > strictly > prohibited and may be unlawful. -------------------------------------------------------------------- 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]. --------------------------------------------------------------------
