RE: JESS: [EXTERNAL] Creating an eLearning system following TekMart example
"Friedman-Hill, Ernest" <[email protected]> Wed, 26 Jun 2013 13:52:26 +0000
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <[email protected]> |
--_000_7F2CAF6713AFDD4392FC4DAA05671E072C7E771DEXMB10srnsandia_
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Don't try to get the Token - hiding that sort of ugliness is the whole reas=
on run-query* exists. Use a pattern binding instead:
(defquery my-query
(declare (variables ?n))
?f <- (room (number ?n)))
(bind ?r (run-query* my-query 100))
(while (?r next)
(bind ?fact (?r getObject f))
;; ... now do something with your fact
From: [email protected] [mailto:[email protected]] On B=
ehalf Of Rejaul Barbhuiya
Sent: Wednesday, June 26, 2013 6:22 AM
To: jess-users
Subject: Re: JESS: [EXTERNAL] Creating an eLearning system following TekMar=
t example
Thanks Ernest.
In my program, I was using runQuery(arg0, arg1) and storing the result in a=
Iterator as shown below. Then I am storing the result in token and from to=
ken to fact.
Iterator sno =3D engine.runQuery("session-number",new ValueVect=
or().add(sidValue));
if (sno.hasNext()) {
Token token =3D (Token) sno.next();
Fact fact =3D token.fact(1);
Now, I want to use runQueryStar(). But I don't know how to read the Query R=
esult.
QueryResult sno =3D engine.runQueryStar("session-number",new ValueVector().=
add(sidValue));
if (sno.next()) {
Token token =3D (Token) sno.????; what function should I use here?
Fact fact =3D token.fact(1);
On Mon, Jun 24, 2013 at 11:06 PM, Friedman-Hill, Ernest <[email protected]=
<mailto:[email protected]>> wrote:
You can use a query to easily find your facts; see http://www.jessrules.com=
/jess/docs/71/queries.html and in particular,
http://www.jessrules.com/jess/docs/71/queries.html#in_java
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]<mail=
to:[email protected]>'
in the BODY of a message to [email protected]<mailto:[email protected]=
v>, NOT to the list
(use your own address!) List problems? Notify [email protected]<m=
ailto:[email protected]>.
--------------------------------------------------------------------
--
Rejaul Karim Barbhuiya
Senior Research Fellow
Department of Computer Science
Jamia Millia Islamia
New Delhi, India
Phone: +91-9891430568
--_000_7F2CAF6713AFDD4392FC4DAA05671E072C7E771DEXMB10srnsandia_
Content-Type: text/html;
charset=us-ascii
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Georgia;
panose-1:2 4 5 2 5 4 5 2 3 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">Don’t try to get th=
e Token – hiding that sort of ugliness is the whole reason run-query*=
exists. Use a pattern binding instead:<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">(defquery my-query<o:p></=
o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"> (decla=
re (variables ?n))<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"> ?f <=
;- (room (number ?n)))<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">(bind ?r (run-query* my-q=
uery 100))<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">(while (?r next)<o:p></o:=
p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"> (bind =
?fact (?r getObject f))<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"> ;; … n=
ow do something with your fact
<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:"=
;Tahoma","sans-serif"">From:</span></b><span style=3D"font-s=
ize:10.0pt;font-family:"Tahoma","sans-serif""> owner-je=
[email protected] [mailto:[email protected]]
<b>On Behalf Of </b>Rejaul Barbhuiya<br>
<b>Sent:</b> Wednesday, June 26, 2013 6:22 AM<br>
<b>To:</b> jess-users<br>
<b>Subject:</b> Re: JESS: [EXTERNAL] Creating an eLearning system following=
TekMart example<o:p></o:p></span></p>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<div>
<p class=3D"MsoNormal">Thanks Ernest.<o:p></o:p></p>
<div>
<p class=3D"MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class=3D"MsoNormal">In my program, I was using runQuery(arg0, arg1) and =
storing the result in a Iterator as shown below. Then I am storing the resu=
lt in token and from token to fact.<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class=3D"MsoNormal"> Iterator s=
no =3D engine.runQuery("session-number",new ValueVector().add(sid=
Value));<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal"> if (sno.ha=
sNext()) {<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal"> Token toke=
n =3D (Token) sno.next();<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal"> Fact fact =
=3D token.fact(1);<o:p></o:p></p>
</div>
</div>
<div>
<p class=3D"MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class=3D"MsoNormal">Now, I want to use runQueryStar(). But I don't know =
how to read the Query Result.<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class=3D"MsoNormal">QueryResult sno =3D engine.runQueryStar("sessio=
n-number",new ValueVector().add(sidValue));<o:p></o:p></p>
</div>
<div>
<div>
<p class=3D"MsoNormal">if (sno.next()) {<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal">Token token =3D (Token) sno.<b><span style=3D"color:=
#CC0000">??<span style=3D"background:white">??</span></span></b>; <b>=
<span style=3D"color:fuchsia">what function should I use here?</span></b><o=
:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal">Fact fact =3D token.fact(1);<o:p></o:p></p>
</div>
</div>
<div>
<p class=3D"MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class=3D"MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class=3D"MsoNormal">On Mon, Jun 24, 2013 at 11:06 PM, Friedman-Hill, Ern=
est <<a href=3D"mailto:[email protected]" target=3D"_blank">ejfried@san=
dia.gov</a>> wrote:<o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt">You can use a query t=
o easily find your facts; see
<a href=3D"http://www.jessrules.com/jess/docs/71/queries.html" target=3D"_b=
lank">http://www.jessrules.com/jess/docs/71/queries.html</a> and in particu=
lar,<br>
<a href=3D"http://www.jessrules.com/jess/docs/71/queries.html#in_java" targ=
et=3D"_blank">http://www.jessrules.com/jess/docs/71/queries.html#in_java</a=
><br>
<br>
<br>
<br>
<br>
--------------------------------------------------------------------<br>
To unsubscribe, send the words 'unsubscribe jess-users <a href=3D"mailto:yo=
[email protected]">
[email protected]</a>'<br>
in the BODY of a message to <a href=3D"mailto:[email protected]">majordo=
[email protected]</a>, NOT to the list<br>
(use your own address!) List problems? Notify <a href=3D"mailto:owner-jess-=
[email protected]">
[email protected]</a>.<br>
--------------------------------------------------------------------<o:p></=
o:p></p>
</div>
<p class=3D"MsoNormal"><br>
<br clear=3D"all">
<o:p></o:p></p>
<div>
<p class=3D"MsoNormal"><o:p> </o:p></p>
</div>
<p class=3D"MsoNormal">-- <br>
<b><span style=3D"font-family:"Georgia","serif";color:#=
CC66CC">Rejaul Karim Barbhuiya</span></b><span style=3D"color:#CC33CC"><br>
</span><span style=3D"font-size:7.5pt;font-family:"Georgia","=
;serif";color:#009900">Senior Research Fellow<br>
</span><span style=3D"font-size:7.5pt;font-family:"Georgia","=
;serif";color:#990000"><br>
Department of Computer Science<br>
Jamia Millia Islamia<br>
New Delhi, India<br>
Phone: +91-9891430568</span><o:p></o:p></p>
</div>
</div>
</body>
</html>
--_000_7F2CAF6713AFDD4392FC4DAA05671E072C7E771DEXMB10srnsandia_--