Re: JESS: [EXTERNAL] Second order JESS?
"David Scuse" <[email protected]> Mon, 16 Apr 2012 10:57:25 -0500
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <067938D7019A4B619A261EF59C1DE167@NIAGARA23> |
------=_NextPart_000_001E_01CD1BBF.B4E2FA50
Content-Type: text/plain;
charset=windows-1252
Content-Transfer-Encoding: quoted-printable
An alternative that would permit you to manipulate your facts=20
in a somewhat second-order manner is to define a predicate such as =
my-fact
and then use:
(assert (my-fact ?foo ?bar))
This way, ?foo is no longer a predicate but instead is a term within the =
fact my-fact.
----- Original Message -----=20
From: Friedman-Hill, Ernest=20
To: jess-users=20
Sent: Monday, April 16, 2012 10:27 AM
Subject: Re: JESS: [EXTERNAL] Second order JESS?
You can build the fact you want as a string and assert that =97 for =
example
(assert-string (str-cat "(" ?foo " " ?bar ")"))
From: Sam Sarjant <[email protected]>
Reply-To: <[email protected]>
Date: Sun, 15 Apr 2012 13:21:47 +1200
To: <[email protected]>
Subject: JESS: [EXTERNAL] Second order JESS?
Hello,=20
I'm looking to use JESS within an application where second-order =
logic is needed (or at least it makes things easier). Does JESS support =
second-order logic in any form?
For example, a rule such as:
(ruleDef (factPredicate ?foo) (factArgs ?bar))
=3D>
(assert (?foo ?bar)))
is an example of the structure I am looking for (where factPredicate =
is a String slot and factArgs is a multislot). The LHS of the rule =
compiles fine (with the appropriate ruleDef deftemplate), but the RHS =
throws an exception as it is expecting a template name after assert.
--=20
- Thanks, Sam Sarjant=20
www.samsarjant.com
------=_NextPart_000_001E_01CD1BBF.B4E2FA50
Content-Type: text/html;
charset=windows-1252
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3DWindows-1252" =
http-equiv=3DContent-Type>
<META name=3DGENERATOR content=3D"MSHTML 8.00.6001.19222">
<STYLE></STYLE>
</HEAD>
<BODY=20
style=3D"FONT-FAMILY: Calibri, sans-serif; WORD-WRAP: break-word; COLOR: =
rgb(0,0,0); FONT-SIZE: 14px; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space"=20
bgColor=3D#ffffff>
<DIV><FONT size=3D2 face=3DArial>An alternative that would permit you to =
manipulate=20
your facts </FONT></DIV>
<DIV><FONT size=3D2 face=3DArial>in a somewhat second-order manner is to =
define a=20
predicate such as my-fact</FONT></DIV>
<DIV><FONT size=3D2 face=3DArial>and then use:</FONT></DIV>
<DIV><FONT size=3D2 face=3DArial> (assert (my-fact =
?foo=20
?bar))</FONT></DIV>
<DIV><FONT size=3D2 face=3DArial></FONT> </DIV>
<DIV><FONT size=3D2 face=3DArial>This way, ?foo is no longer a predicate =
but instead=20
is a term within the fact my-fact.</FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; =
PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"=20
dir=3Dltr>
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV=20
style=3D"FONT: 10pt arial; BACKGROUND: #e4e4e4; font-color: =
black"><B>From:</B>=20
<A [email protected] =
href=3D"mailto:[email protected]">Friedman-Hill,=20
Ernest</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
[email protected]=20
href=3D"mailto:[email protected]">jess-users</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Monday, April 16, 2012 =
10:27=20
AM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: JESS: [EXTERNAL] =
Second=20
order JESS?</DIV>
<DIV><BR></DIV>
<DIV>You can build the fact you want as a string and assert that =97 =
for=20
example</DIV>
<DIV><BR></DIV>
<DIV>(assert-string (str-cat "(" ?foo " " ?bar ")"))</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV><SPAN id=3DOLK_SRC_BODY_SECTION>
<DIV=20
style=3D"BORDER-BOTTOM: medium none; TEXT-ALIGN: left; BORDER-LEFT: =
medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; =
FONT-FAMILY: Calibri; COLOR: black; FONT-SIZE: 11pt; BORDER-TOP: #b5c4df =
1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt"><SPAN=20
style=3D"FONT-WEIGHT: bold">From: </SPAN>Sam Sarjant <<A=20
=
href=3D"mailto:[email protected]">[email protected]</A>><BR><SPAN =
style=3D"FONT-WEIGHT: bold">Reply-To: </SPAN><<A=20
=
href=3D"mailto:[email protected]">[email protected]</A>><BR><S=
PAN=20
style=3D"FONT-WEIGHT: bold">Date: </SPAN>Sun, 15 Apr 2012 13:21:47=20
+1200<BR><SPAN style=3D"FONT-WEIGHT: bold">To: </SPAN><<A=20
=
href=3D"mailto:[email protected]">[email protected]</A>><BR><S=
PAN=20
style=3D"FONT-WEIGHT: bold">Subject: </SPAN>JESS: [EXTERNAL] Second =
order=20
JESS?<BR></DIV>
<DIV><BR></DIV>Hello,=20
<DIV> I'm looking to use JESS within an application where =
second-order=20
logic is needed (or at least it makes things easier). Does JESS =
support=20
second-order logic in any form?</DIV>
<DIV><BR></DIV>
<DIV>For example, a rule such as:</DIV>
<DIV><FONT face=3D"courier new,monospace">(ruleDef (factPredicate =
?foo)=20
(factArgs ?bar))</FONT></DIV>
<DIV><FONT face=3D"courier new,monospace">=3D></FONT></DIV>
<DIV><FONT face=3D"courier new,monospace">(assert (?foo =
?bar)))</FONT></DIV>
<DIV><BR></DIV>
<DIV>is an example of the structure I am looking for (where <FONT=20
face=3D"courier new,monospace">factPredicate </FONT>is a String slot =
and <FONT=20
face=3D"courier new,monospace">factArgs </FONT>is a multislot). The =
LHS of the=20
rule compiles fine (with the appropriate <FONT=20
face=3D"courier new,monospace">ruleDef</FONT> deftemplate), but the =
RHS throws=20
an exception as it is expecting a template name after assert.</DIV>
<DIV>
<DIV><BR></DIV>-- <BR>- Thanks, Sam Sarjant=20
<DIV><A href=3D"http://www.samsarjant.com"=20
=
target=3D_blank>www.samsarjant.com</A><BR></DIV><BR></DIV></BLOCKQUOTE></=
SPAN></BODY></HTML>
------=_NextPart_000_001E_01CD1BBF.B4E2FA50--