------_=_NextPart_001_01C7E342.3B902E80
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=iso-8859-1
Received: from sentry.sandia.gov (mm04snlnto.sandia.gov =
[132.175.109.21])
by mailgate2.sandia.gov (8.14.0/8.14.0) with ESMTP id l7KFr05e031859
for <[email protected]>; Mon, 20 Aug 2007 09:53:15 -0600
Received: from [132.175.109.14] (sentry-two.sandia.gov) by
sentry.sandia.gov with ESMTP (SMTP Relay 01 (Email Firewall v6.3.1));
Mon, 20 Aug 2007 09:53:06 -0600
X-Server-Uuid: 6CEB1540-FE13-491B-9872-FD67060ED864
X-WSS-ID: 0JN2XHY-08-6AA-01
Received: from nz-out-0506.google.com (nz-out-0506.google.com
[64.233.162.229]) by sentry-two.sandia.gov (Tumbleweed MailGate) with
ESMTP id 065E16105BC for <[email protected]>; Mon, 20 Aug 2007
09:53:57 -0600 (MDT)
Received: by nz-out-0506.google.com with SMTP id m22so436238nzf for
<[email protected]>; Mon, 20 Aug 2007 08:53:04 -0700 (PDT)
DKIM-Signature: a=3Drsa-sha1; c=3Drelaxed/relaxed; d=3Dgooglemail.com; =
s=3Dbeta;
=
h=3Ddomainkey-signature:received:received:message-id:date:from:to:subject=
:in-reply-to:mime-version:content-type:references;
=
b=3DE8vMWdkw92sogq2GLE5Ed2tROjVwqMBTmHUSKRxgBGSdNULrUDNh35YHrq0Osw2leP/v5=
iLdAINQObE3iN3/qrSIE81So/9zs+kNqJjzNSAL5ojVT6NsZ5PL+Ia3pk9teTgQLXGL7WF9ow=
WKJU3DZ96Pz0rspXNsYQfSYuifcZM=3D
DomainKey-Signature: a=3Drsa-sha1; c=3Dnofws; d=3Dgooglemail.com; =
s=3Dbeta;
=
h=3Dreceived:message-id:date:from:to:subject:in-reply-to:mime-version:con=
tent-type:references;
=
b=3DU0qWiGh7IRMdsOKadJRsyEFydOOm/SJUZ0IhWGXZtdq4EE9sKUgwJimAPeBymkJ1MDuJi=
bOWlglM+hglDcpJy8SaME32jiTd9pGm6m9ttsQmgMprPIguI3nkCwvy3JPSNYt1lIwDPuHmhk=
/Pdb6cJyDfpI5Eo2qrbWkUr93u+jM=3D
Received: by 10.115.76.1 with SMTP id d1mr2758881wal.1187625183345; Mon,
20 Aug 2007 08:53:03 -0700 (PDT)
Received: by 10.65.54.5 with HTTP; Mon, 20 Aug 2007 08:53:03 -0700 (PDT)
Message-ID: =
<[EMAIL PROTECTED]>
Date: Mon, 20 Aug 2007 17:53:03 +0200
From: "=3D?ISO-8859-1?Q?No=3DEBl_Huebers?=3D" =
<[EMAIL PROTECTED]>
To: [email protected]
Subject: Re: JESS: Java objects
In-Reply-To: <[EMAIL PROTECTED]>
MIME-Version: 1.0
References: =
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
X-TMWD-Spam-Summary: TS=3D20070820155307; SEV=3D2.2.2; =
DFV=3DB2007082012;
IFV=3D2.0.4,4.0-9; AIF=3DB2007082012; RPD=3D5.02.0125; ENG=3DIBF;
=
RPDID=3D7374723D303030312E30413031303230372E34364339423845332E303033322C7=
3733D312C6667733D30;
CAT=3DNONE; CON=3DNONE
X-MMS-Spam-Filter-ID: B2007082012_5.02.0125_4.0-9
X-WSS-ID: 6AD767551V84411817-05-01
Content-Type: multipart/alternative;
boundary=3D"----=3D_Part_50291_18026087.1187625183166"
X-PMX-Version: 5.3.3.310218, Antispam-Engine: 2.5.2.311128, =
Antispam-Data: 2007.8.20.82822
X-PerlMx-Spam: Gauge=3DIIIIIII, Probability=3D7%, Report=3D'HTML_NO_HTTP =
0.1, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, =
__CTYPE_MULTIPART_ALT 0, __HAS_MSGID 0, __MIME_HTML 0, __MIME_VERSION 0, =
__SANE_MSGID 0'
------=3D_Part_50291_18026087.1187625183166
Content-Type: text/plain;
charset=3Diso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Thanks for your answers! I wanted to use the counter template and rule =
to
count facts of the same kind, e.g. an event in my system.
First of all, I added a slot with a unique value in order to facts of =
the
same kind.
I solved the counting with a query and a function:
(defquery searchcontext
(declare (variables ?name ?task ?val))
(context
(username ?name)
(action "Bewertet")
(task ?task)
(value ?val)))
(deffunction checkformerattempts(?n ?t ?v)
(bind ?results (count-query-results searchcontext ?n ?t ?v))
(return ?results)
(close ?results))
Now I want to delete the some facts. How do I get a fact from the
queryresult '?result' ?
;(deffunction delformerattempts(?n ?t ?v)
; (bind ?results (run-query* searchcontext ?n ?t ?v))
; (while (?results next))
; (retract ?results get))
Best regards,
Noel H=3DFCbers
2007/8/20, Wolfgang Laun <[EMAIL PROTECTED]>:
>
> No=3DEBl Huebers wrote:
>
> >Hi,
> >
> >I'm new to the Jess language and have some questions.
> >
> >1. I work with Java object. I stored them in Jess with store and
> >assert/fetch commands.
> >But I could not call there member in the lhs of my rule. No function
> calls
> >allowed, right? So, for every object I made a rule to insert a Jess
> >template. This works fine, but is this way of mapping Java objects to
> Jess
> >facts and then discarding the object the best way to work with java
> objects?
> >
> >
> store and fetch are just a way of storing and retrieving arbitrary =
data.
> If you want to use Java objects in rules, look into the topic of =
shadow
> facts, see section 5.3. Shadow facts: reasoning about Java objects.
>
> >2. I am trying to implement a counter-logic for specific slot
> combinations.
> >First, everytime a fact is inserted I check if there is already a
> procounter
> >fact. If not I create one. This works fine. The next rule should
> recognize
> >when a fact (EContext) is inserted and the counter (procounter) =
already
> >exists. In this case, the count slot should only be modified. I try =
to
> >compare bounded vars ?s ?v ?t from EContext to procounter slots, but =
I
> think
> >Jess simply overwrites the binding. Can you help me with the correct
> syntax?
> >Is there a better logic to implement a counter?
> >
> If you have one fact (EContext (studentname "Max") (action
> "bewertet")(value "3")(task "Thesis")) it won't be possible to ever
> assert another fact just like this one. This might be the cause of
> modpro failing to fire. Consider adding another slot to EContext such =
as
> a date or time stamp, and then you might see an increase. Notice that
> the rule might benefit from adding the option (declare (no-loop =
TRUE)).
>
> >
> >Best regards,
> >
> >Noel Huebers
> >
> >***CODE***
> >
> >(defrule modpro ; counter erh=3DF6hen
> > (and
> > (EContext
> > (studentname ?s)
> > (action "bewertet")
> > (value ?v)
> > (task ?t))
> > ?pro <- (procounter
> > (name ?s)
> > (task ?t)
> > (val ?v)
> > (count ?x))
> > )
> >=3D3D>
> >(modify ?pro
> > (count (+ ?x 1))) ;increase counter
> >(printout t "Counter f=3DFCr " ?s ?t ?v " erh=3DF6hen!!!" crlf))
> >
> >
> >
>
>
> --------------------------------------------------------------------
> 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]
--------------------------------------------------------------------
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]
--------------------------------------------------------------------