Re: JESS: [EXTERNAL] Creating an eLearning system following TekMart example

2013-06-27 Thread Rejaul Barbhuiya
I have four *deftemplate*s - Subject, where each subject can have multiple
modules and each module can have multiple topics.
Now I want to create a table of contents (or a tree structure) so that all
topics belonging to same Module can be listed together, while those of
other module will be listed under that module. same will for listing of
Modules.

So my question basically is how should I write the queries and how should I
retrieve them. I have tried following:
(defquery sub-name
(subject (sub-name ?subname)))

(defquery module-name
(subject (sub-name ?subname))
(module (parent-subject ?subname) (mod-name ?modname)))

(defquery topic-name
(module (mod-name ?subname))
(topic (parent-module ?modname) (topic-name ?topicname)))

I am triggering the queries as:
QueryResult subject = engine.runQueryStar("sub-name", new ValueVector());
QueryResult module = engine.runQueryStar("module-name", new ValueVector());
QueryResult topic = engine.runQueryStar("topic-name", new ValueVector());
QueryResult concept = engine.runQueryStar("concept-name", new
ValueVector());

and want to display the tree in for example in Java as :

while(subject.next())
{
   print (subject name here)
while(module.next())
{
  print (Module name here)
while(topic.next())
   {
 print (Topic name here)
   }
}
}

So kindly suggest me how to control the queries.

Many thanks again,



On Wed, Jun 26, 2013 at 7:22 PM, Friedman-Hill, Ernest
wrote:

>  Don’t try to get the Token – hiding that sort of ugliness is the whole
> reason 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:* owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] *On
> Behalf Of *Rejaul Barbhuiya
> *Sent:* Wednesday, June 26, 2013 6:22 AM
> *To:* jess-users
> *Subject:* Re: JESS: [EXTERNAL] Creating an eLearning system following
> TekMart 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
> token to fact.
>
> ** **
>
> Iterator sno = engine.runQuery("session-number",new
> ValueVector().add(sidValue));
>
> if (sno.hasNext()) {
>
> Token token = (Token) sno.next();
>
> Fact fact = token.fact(1);
>
> ** **
>
> Now, I want to use runQueryStar(). But I don't know how to read the Query
> Result.
>
> ** **
>
> QueryResult sno = engine.runQueryStar("session-number",new
> ValueVector().add(sidValue));
>
> if (sno.next()) {
>
> Token token = (Token) sno.**;  *what function should I use here?*
>
> Fact fact = token.fact(1);
>
> ** **
>
> ** **
>
> ** **
>
> On Mon, Jun 24, 2013 at 11:06 PM, Friedman-Hill, Ernest <
> ejfr...@sandia.gov> 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 y...@address.com'
> in the BODY of a message to majord...@sandia.gov, NOT to the list
> (use your own address!) List problems? Notify owner-jess-us...@sandia.gov

Re: JESS: [EXTERNAL] Creating an eLearning system following TekMart example

2013-06-27 Thread Rejaul Barbhuiya
Thanks,

runQueryStar() needs at least 2 args - query name and a variable of
valuevector type.
I don't want to pass any variable as shown in TekMark example in  "Jess in
Action"

Iterator result = engine.runQuery("all-products", new ValueVector());

When I pass the same blank valuevector(), it doesn't work.

QueryResult result =
engine.runQueryStar("list-courses", new ValueVector());


My query is as follows:

(defquery list-courses
(subject (sub-name ?subname))
(module (parent-subject ?subname) (mod-name ?modname))
(topic (parent-module ?modname) (topic-name ?topicname))
(concept (parent-topic ?topicname) (concept-name ?conceptname))
(learning-object (parent-concept ?conceptname) (lo-name ?LOname))
)



On Wed, Jun 26, 2013 at 7:22 PM, Friedman-Hill, Ernest
wrote:

>  Don’t try to get the Token – hiding that sort of ugliness is the whole
> reason 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:* owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] *On
> Behalf Of *Rejaul Barbhuiya
> *Sent:* Wednesday, June 26, 2013 6:22 AM
> *To:* jess-users
> *Subject:* Re: JESS: [EXTERNAL] Creating an eLearning system following
> TekMart 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
> token to fact.
>
> ** **
>
> Iterator sno = engine.runQuery("session-number",new
> ValueVector().add(sidValue));
>
> if (sno.hasNext()) {
>
> Token token = (Token) sno.next();
>
> Fact fact = token.fact(1);
>
> ** **
>
> Now, I want to use runQueryStar(). But I don't know how to read the Query
> Result.
>
> ** **
>
> QueryResult sno = engine.runQueryStar("session-number",new
> ValueVector().add(sidValue));
>
> if (sno.next()) {
>
> Token token = (Token) sno.**;  *what function should I use here?*
>
> Fact fact = token.fact(1);
>
> ** **
>
> ** **
>
> ** **
>
> On Mon, Jun 24, 2013 at 11:06 PM, Friedman-Hill, Ernest <
> ejfr...@sandia.gov> 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 y...@address.com'
> in the BODY of a message to majord...@sandia.gov, NOT to the list
> (use your own address!) List problems? Notify owner-jess-us...@sandia.gov

RE: JESS: [EXTERNAL] Creating an eLearning system following TekMart example

2013-06-26 Thread Friedman-Hill, Ernest
Don't try to get the Token - hiding that sort of ugliness is the whole reason 
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: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On 
Behalf Of Rejaul Barbhuiya
Sent: Wednesday, June 26, 2013 6:22 AM
To: jess-users
Subject: Re: JESS: [EXTERNAL] Creating an eLearning system following TekMart 
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 token 
to fact.

Iterator sno = engine.runQuery("session-number",new 
ValueVector().add(sidValue));
if (sno.hasNext()) {
Token token = (Token) sno.next();
Fact fact = token.fact(1);

Now, I want to use runQueryStar(). But I don't know how to read the Query 
Result.

QueryResult sno = engine.runQueryStar("session-number",new 
ValueVector().add(sidValue));
if (sno.next()) {
Token token = (Token) sno.;  what function should I use here?
Fact fact = token.fact(1);



On Mon, Jun 24, 2013 at 11:06 PM, Friedman-Hill, Ernest 
mailto:ejfr...@sandia.gov>> 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 
y...@address.com<mailto:y...@address.com>'
in the BODY of a message to majord...@sandia.gov<mailto:majord...@sandia.gov>, 
NOT to the list
(use your own address!) List problems? Notify 
owner-jess-us...@sandia.gov<mailto:owner-jess-us...@sandia.gov>.




--
Rejaul Karim Barbhuiya
Senior Research Fellow

Department of Computer Science
Jamia Millia Islamia
New Delhi, India
Phone: +91-9891430568


Re: JESS: [EXTERNAL] Creating an eLearning system following TekMart example

2013-06-26 Thread Rejaul Barbhuiya
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
token to fact.

Iterator sno = engine.runQuery("session-number",new
ValueVector().add(sidValue));
if (sno.hasNext()) {
Token token = (Token) sno.next();
Fact fact = token.fact(1);

Now, I want to use runQueryStar(). But I don't know how to read the Query
Result.

QueryResult sno = engine.runQueryStar("session-number",new
ValueVector().add(sidValue));
if (sno.next()) {
Token token = (Token) sno.**;  *what function should I use here?*
Fact fact = token.fact(1);




On Mon, Jun 24, 2013 at 11:06 PM, Friedman-Hill, Ernest
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 y...@address.com'
> in the BODY of a message to majord...@sandia.gov, NOT to the list
> (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
> 
>
>


-- 
*Rejaul Karim Barbhuiya*
Senior Research Fellow

Department of Computer Science
Jamia Millia Islamia
New Delhi, India
Phone: +91-9891430568


RE: JESS: [EXTERNAL] Creating an eLearning system following TekMart example

2013-06-24 Thread Friedman-Hill, Ernest
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 y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.




JESS: [EXTERNAL] Creating an eLearning system following TekMart example

2013-06-24 Thread Rejaul Barbhuiya
Kindly bear with me as I explain my query...

I am developing an Intelligent Tutoring System using Jess + Servlet + Jsp.
It will perform following actions (implemented as rules):

1. if student has completed a given task within specified time then give
him next task. else jess rules will decide a suitable feedback message for
the student (e.g., hurry up!).

2. a student while solving a multiple choice question (maintained as a
question fact) can attempt more than once till answers correctly. Here
number of attempts will be passes from a JSP page to a servlet page. The
servlet will modify the attempt_count SLOT in jess fact and the engine will
run and decide next suitable action.

a question fact initially is:

(deffacts question_objects
(question (object-name "eaxmple1.html") (type question) (lo-id 10302)
(reqd-time 25) (prev-lo-id 10301) (next-lo-id 10303) (diff-level medium)
(attempt-count (default 0)))

(theory (object-name "theory1.html") (type theory) (lo-id 103) (reqd-time
45) (prev-lo-id 102) (next-lo-id 104) (diff-level easy) (status incomplete))
)

Now, dynamically, i want to update the first fact's attempt-count slot
value.

But I have no clue how to get hold of that particular fact to call modify()
from Java?

Please let me know if I should be more detailed.

Thanking you,
-- 
*Rejaul Karim Barbhuiya*
Senior Research Fellow

Department of Computer Science
Jamia Millia Islamia
New Delhi, India
Phone: +91-9891430568