|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
JESS: Help using multislot form from-class templateHi Jess Users,
This is my first experience with Jess. I declared my own template as a Java class, every (single) slot works. But I wished also to add some multislots in my template, so I wrote: public void setMymultislot(Value v) { } public Value getMymultislot() { return null; } but Jess don't recognize it at all. It result with an error arguing my template has not a multislot with that name. Where is the problem? Many thanks in advance! Davide Zambon |
|
|
Re: JESS: Help using multislot form from-class templateMultislots come from properties of array type -- i.e.,
private int[] ia; public int[] getAges() { return ia; } public void setAges(int[] ages) { ia = ages; } Jess most definitely does *not* like working with methods that return or accept objects of type jess.Value or jess.ValueVector or their subclasses! On May 12, 2009, at 3:56 AM, Davide Zambon wrote: > Hi Jess Users, > > This is my first experience with Jess. > I declared my own template as a Java class, every (single) slot works. > But I wished also to add some multislots in my template, so I wrote: > > public void setMymultislot(Value v) > { > } > > public Value getMymultislot() > { > return null; > } > > but Jess don't recognize it at all. It result with an error arguing > my template has not a multislot with that name. > Where is the problem? > > Many thanks in advance! > > Davide Zambon --------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences Phone: (925) 294-2154 Sandia National Labs PO Box 969, MS 9012 ejfried@... Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
|
|
Re: JESS: Help using multislot form from-class templateThanks a lot for the quick and right answer! :-)
Unfortunately this seams not work properly when I try to use the multislot value like a list. Trying to read an element of the list, Jess gives me this error: Message: '<Java-Object:jess.aj>' is JAVA_OBJECT, not a list. isn't a Class-defined array still a multislot? My class is called Relation and its multislot is called multiplicityFrom, the following line (taken from a rule) is that one that generate the error: (Relation (name ?n) (multiplicityFrom ?a $?list)) many thanks again! Greetings Davide 2009/5/12 Ernest Friedman-Hill <ejfried@...> Multislots come from properties of array type -- i.e., |
|
|
Re: JESS: Help using multislot form from-class templateA Jess list is not a java.util.List, and vice versa. An actual array becomes a multislot (list) property; a java.util.List property becomes a plain old single slot containing the java.util.List object. You can call Java methods on that List object to retrieve its elements and make various assertions about it, but you can't use multifield matching. On May 12, 2009, at 3:06 PM, Davide Zambon wrote: > Thanks a lot for the quick and right answer! :-) > > Unfortunately this seams not work properly when I try to use the > multislot value like a list. > Trying to read an element of the list, Jess gives me this error: > > Message: '<Java-Object:jess.aj>' is JAVA_OBJECT, not a list. > > isn't a Class-defined array still a multislot? > > My class is called Relation and its multislot is called > multiplicityFrom, the following line (taken from a rule) is that one > that generate the error: > (Relation (name ?n) (multiplicityFrom ?a $?list)) > > many thanks again! > Greetings > > Davide > > > 2009/5/12 Ernest Friedman-Hill <ejfried@...> > Multislots come from properties of array type -- i.e., > > private int[] ia; > public int[] getAges() { return ia; } > public void setAges(int[] ages) { ia = ages; } > > Jess most definitely does *not* like working with methods that > return or accept objects of type jess.Value or jess.ValueVector or > their subclasses! > > > On May 12, 2009, at 3:56 AM, Davide Zambon wrote: > > Hi Jess Users, > > This is my first experience with Jess. > I declared my own template as a Java class, every (single) slot works. > But I wished also to add some multislots in my template, so I wrote: > > public void setMymultislot(Value v) > { > } > > public Value getMymultislot() > { > return null; > } > > but Jess don't recognize it at all. It result with an error arguing > my template has not a multislot with that name. > Where is the problem? > > Many thanks in advance! > > Davide Zambon > > --------------------------------------------------------- > Ernest Friedman-Hill > Informatics & Decision Sciences Phone: (925) 294-2154 > Sandia National Labs > PO Box 969, MS 9012 ejfried@... > Livermore, CA 94550 http://www.jessrules.com > > > > > > -------------------------------------------------------------------- > To unsubscribe, send the words 'unsubscribe jess-users > you@...' > in the BODY of a message to majordomo@..., NOT to the list > (use your own address!) List problems? Notify owner-jess-users@... > . > -------------------------------------------------------------------- > > --------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users you@...' in the BODY of a message to majordomo@..., NOT to the list (use your own address!) List problems? Notify owner-jess-users@.... -------------------------------------------------------------------- |
|
|
JESS: Help using IDSHere i’m going to explain to you my problem : I capture one packet on the network by java, and for the acceptation of this packet i used Jess (Java expert system shell) for putting filtring rules on this packet (analysis packet) The capturing code by java is : import java.net.InetAddress; import jpcap.packet.Packet; import jess.*; import jpcap.packet.*; public class Filter_TCP_Pkt { Packet packet; TCPPacket tcpPacket; Console console = new Console(); private String dataPacket; public void filter_tcp_pkt(){ Capture capture = new Capture(); try{ if (packet instanceof TCPPacket) { tcpPacket = (TCPPacket) packet; byte[] data = tcpPacket.data; dataPacket = new String(data, "ISO-8859-1"); console.print("\t Adr IP Source: "+ " (" + "<"+tcpPacket.src_ip+">" + ")Adr IP Distination:"+"<"+tcpPacket.dst_ip+">"+"\n" ); console.print("\t[Paquet TCP] - Port source : " + String.valueOf(tcpPacket.src_port) + " (" + //tcpPacket + ") Destination port : " + String.valueOf(tcpPacket.dst_port) + " (" + //tcpPacket.dst_ip + ")\n\tSequence Number : " + String.valueOf(tcpPacket.sequence) + "\n\tAcknowledgment Number : " + String.valueOf(tcpPacket.ack_num) + "\n\tHeader Length : " + String.valueOf(tcpPacket.header.length)); // Flags if (tcpPacket.urg) console.println("\n\tURG[0x" + Integer.toHexString(tcpPacket.urgent_pointer) + "]"); if (tcpPacket.ack) console.println("\n\tACK[0x" + Long.toHexString(tcpPacket.ack_num) + "]"); if (tcpPacket.psh) console.println("\n\tPSH"); if (tcpPacket.rst) console.println("\n\tRST"); if (tcpPacket.syn) console.println("\n\tSYN[0x" + Long.toHexString(tcpPacket.sec) + "]"); if (tcpPacket.fin) console.println("\n\tFIN"); console.println("\tData : " + dataPacket); } console.println(""); }catch (Exception e) { e.printStackTrace(); } } // l’execution du fichier jess qui contient les règles de filtrage try{ Rete rete = new Rete(); rete.store("tcpPacket",TcpPacket); rete.executeCommand("(batch C:/Users/Hacene/Desktop/Projet_Fin_Etu/Analyser_tcp_pkt.clp)"); rete.executeCommand("(reset)"); rete.executeCommand("(run)"); } catch(JessException jess){ jess.printStackTrace(); } } My question is , how to make those rules by Jess on the same packet captured by java (TCP, UDP ;ICMP,…..) So, the problem wich i found are : When i capte (intrcepte ) a packet on the port 80 or 21 java didn’t show me a message (found HTTP packet ) althought i tried by this code (deftemplate TcpPacket (declare (from-class jpcap.packet.TCPPacket) (include-variables TRUE))) (defrule is-port-80 (TcpPacket (dst_port 80)) => (printout t "Found an HTTP packet!" crlf)) but no way
And i have another problem that my Jess is Expired, Help me because i am in horribole situation Finally , thanks a lot for your help Vous voulez savoir ce que vous pouvez faire avec le nouveau Windows Live ? Lancez-vous ! |
|
|
Re: JESS: Help using IDSOne thing that is bound to cause a problem is the call to execute (reset) immediately before (run). (reset) removes all facts from working memory, so no rules will fire.
-W On Sun, May 17, 2009 at 5:34 PM, hacene rahmani <rahmani_hacene@...> wrote:
|
| Free embeddable forum powered by Nabble | Forum Help |