JESS: [EXTERNAL] Usage of abstract classes in rules
"Tom De Costere" <[email protected]> Tue, 21 May 2013 12:24:03 +0200
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <[email protected]> |
------=_NextPart_000_006F_01CE561E.1495C3D0
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
Hello,
I currently have some abstract classes which are then implemented in =
various other classes extending those abstract classes. Now I=E2=80=99ve =
been trying to get Jess to work with both the abstract class as the =
implementation class, but somehow Jess cannot reach to the =
fields/methods specified in the abstract classes?
Is this normal functionality of Jess or must I make such a conversion =
object that contains both the fields from the abstract class as the =
fields from the implementation class?
Example:
My abstract class AbstractApplicationEvent contains following protected =
fields:
- eventID
- eventName
- eventTimestamp
My subclass ConnectionMadeEvent extending the abstract class above no =
extra fields, but can be extended in the future.
Rule:
(defrule connection_established
(declare (salience 50))
?f1 <- (ConnectionMadeEvent (eventID ?id) (eventTimestamp =
?eventTimestamp))
=3D>
(assert (Notification (icon "ICON_CONNECTION_ACTIVE") =
(generationTime ?eventTimestamp) (event ?f1)))
)
Error message:
SEVERE: Error loading Ruleset from: rules/global_rules.clp
Jess reported an error in routine Jesp.parsePattern.
Message: No such slot eventTimestamp in template =
MAIN::ConnectionMadeEvent at token 'eventTimestamp'.
Program text: ( defrule connection_established ( declare ( salience 50 =
) ) ?f1 <- ( ConnectionMadeEvent ( eventID ?id ) ( eventTimestamp at =
line 110 in file rules/global_rules.clp.
..
Thanks in advance!
Tom DC
------=_NextPart_000_006F_01CE561E.1495C3D0
Content-Type: text/html;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
<HTML><HEAD></HEAD>
<BODY dir=3Dltr>
<DIV dir=3Dltr>
<DIV style=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV>Hello,</DIV>
<DIV> </DIV>
<DIV>I currently have some abstract classes which are then implemented =
in=20
various other classes extending those abstract classes. Now I=E2=80=99ve =
been trying to=20
get Jess to work with both the abstract class as the implementation =
class, but=20
somehow Jess cannot reach to the fields/methods specified in the =
abstract=20
classes?</DIV>
<DIV> </DIV>
<DIV>Is this normal functionality of Jess or must I make such a =
conversion=20
object that contains both the fields from the abstract class as the =
fields from=20
the implementation class?</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><U><STRONG>Example:</STRONG></U></DIV>
<DIV> </DIV>
<DIV>My abstract class AbstractApplicationEvent contains following=20
<EM><STRONG>protected</STRONG> </EM>fields:</DIV>
<DIV>- eventID</DIV>
<DIV>- eventName</DIV>
<DIV>- eventTimestamp</DIV>
<DIV> </DIV>
<DIV>My subclass ConnectionMadeEvent extending the abstract class above =
no extra=20
fields, but can be extended in the future.</DIV>
<DIV> </DIV>
<DIV><STRONG>Rule:</STRONG></DIV>
<DIV> </DIV>
<DIV>(defrule connection_established</DIV>
<DIV> (declare (salience 50))</DIV>
<DIV> ?f1 <- (ConnectionMadeEvent (eventID ?id)=20
(eventTimestamp ?eventTimestamp))</DIV>
<DIV> =3D></DIV>
<DIV> (assert (Notification (icon =
"ICON_CONNECTION_ACTIVE")=20
(generationTime ?eventTimestamp) (event ?f1)))</DIV>
<DIV>)</DIV>
<DIV> </DIV>
<DIV><U><STRONG>Error message:</STRONG></U></DIV>
<DIV> </DIV>
<DIV>SEVERE: Error loading Ruleset from: rules/global_rules.clp</DIV>
<DIV>Jess reported an error in routine Jesp.parsePattern.</DIV>
<DIV> Message: No such slot eventTimestamp in template=20
MAIN::ConnectionMadeEvent at token 'eventTimestamp'.</DIV>
<DIV> Program text: ( defrule connection_established ( declare ( =
salience=20
50 ) ) ?f1 <- ( ConnectionMadeEvent ( eventID ?id ) ( =
eventTimestamp at=20
line 110 in file rules/global_rules.clp.</DIV>
<DIV>...</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Thanks in advance!</DIV>
<DIV> </DIV>
<DIV>Tom DC=20
<DIV=20
style=3D"FONT-SIZE: small; FONT-FAMILY: 'Calibri'; FONT-WEIGHT: normal; =
COLOR: #000000; FONT-STYLE: normal; TEXT-DECORATION: none; DISPLAY: =
inline"></DIV> </DIV></DIV></DIV></BODY></HTML>
------=_NextPart_000_006F_01CE561E.1495C3D0--