JESS: [EXTERNAL] Matching facts based on a slot, but not the fact's type
"Aurelien Mazurie" <[email protected]> Fri, 26 Jul 2013 14:42:42 -0600
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <CAHO3+_osXV8hmGOe2F81UG7sdn2Ahi6wA6tSn4vdTJRW5NGrOA@mail.gmail.com> |
--047d7b6d970c6449d304e2703035 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=iso-8859-1 Dear Jess users, I am still learning the ropes, and cannot find an answer to the following question either online or in the 'Jess in action' book. Is there a way to match facts in a LHS based on the presence of a slot? For example, I have two templates: (deftemplate A (slot score)) (deftemplate B (slot score)) I would like my rule to be triggered if any fact (either from template A, B, or others) have a 'score' slot with a specific value. For now I can do it by manually adding references to A and B in the LHS, but this will not scale well. I'm looking for a solution that can just work on any fact, regardless of the template they are defined from. Best, Aurelien --047d7b6d970c6449d304e2703035 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><span style=3D"color:rgb(0,0,0);font-family:Verdana,Geneva= ,Helvetica,Arial,sans-serif;font-size:13px">Dear Jess users,=A0</span><br s= tyle=3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-se= rif;font-size:13px"> <span style=3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,= sans-serif;font-size:13px">I am still learning the ropes, and cannot find a= n answer to the following question either online or in the 'Jess in act= ion' book. Is there a way to match facts in a LHS based on the presence= of a slot?=A0</span><br style=3D"color:rgb(0,0,0);font-family:Verdana,Gene= va,Helvetica,Arial,sans-serif;font-size:13px"> <br style=3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sa= ns-serif;font-size:13px"><span style=3D"color:rgb(0,0,0);font-family:Verdan= a,Geneva,Helvetica,Arial,sans-serif;font-size:13px">For example, I have two= templates:=A0</span><br style=3D"color:rgb(0,0,0);font-family:Verdana,Gene= va,Helvetica,Arial,sans-serif;font-size:13px"> <br style=3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sa= ns-serif;font-size:13px"><span style=3D"color:rgb(0,0,0);font-family:Verdan= a,Geneva,Helvetica,Arial,sans-serif;font-size:13px">(deftemplate A (slot sc= ore))=A0</span><br style=3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Hel= vetica,Arial,sans-serif;font-size:13px"> <span style=3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,= sans-serif;font-size:13px">(deftemplate B (slot score))=A0</span><br style= =3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;= font-size:13px"> <br style=3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sa= ns-serif;font-size:13px"><span style=3D"color:rgb(0,0,0);font-family:Verdan= a,Geneva,Helvetica,Arial,sans-serif;font-size:13px">I would like my rule to= be triggered if any fact (either from template A, B, or others) have a = 9;score' slot with a specific value. For now I can do it by manually ad= ding references to A and B in the LHS, but this will not scale well. I'= m looking for a solution that can just work on any fact, regardless of the = template they are defined from.=A0</span><br style=3D"color:rgb(0,0,0);font= -family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"> <br style=3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sa= ns-serif;font-size:13px"><span style=3D"color:rgb(0,0,0);font-family:Verdan= a,Geneva,Helvetica,Arial,sans-serif;font-size:13px">Best,=A0</span><br styl= e=3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif= ;font-size:13px"> <span style=3D"color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,= sans-serif;font-size:13px">Aurelien=A0</span><br></div> --047d7b6d970c6449d304e2703035--