But same code is in your book sir. In Jess in action page 295. vsingh wrote: > > thanks...its working now...... > > > > > friedman_hill ernest j wrote: >> >> I hope the error message makes it clear that at the line where you're >> calling "assert", there is no variable named ?pn which is in >> scope. The only variable ?pn is defined inside a "not" CE, and >> variables defined inside a "not" are not available outside of that >> "not". Think about it: what this line says is that if there is not an >> order for some part number, and that part number (which doesn't exist) >> is not an ipod nano, then place such an order. But this matches not only >> the existing ipod nano product, but all possible ipod nano products -- >> i.e., any value for ?pn would satisfy this rule. Since there are an >> infinite number of possible values, this rule doesn't make >> sense. Instead, you need to move the ipod nano Product pattern up to >> the top of the rule, outside of the "not", so that the rule specifies >> that it's looking for the one concrete value of ?pn that makes sense. >> >> I think vsingh wrote: >> [Charset utf-8 unsupported, filtering to ASCII...] >>> >>> Pls help me debug this error... >>> >>> >>> Jess> (defrule recommendipodnano (object(is-a Customer)(customer-id >>> ?id)) >>> (not (and (object(is-a SalesOrder)(OrderNumber ?o)(customer-id ?id)) >>> >>> (object(is-a LineItem)(OrderNumber ?o)(partnumber ?pn)) >>> (object(is-a Product)(partnumber ?pn)(name ___ipod nano___)))) => >>> (assert >>> (object(is-a Recommend)(OrderNumber ?o)(partnumber ?pn))) >>> ) >>> TRUE >>> Jess> (run) >>> Jess reported an error in routine Context.getVariable >>> while executing (assert (MAIN::object (is-a Recommend) (is-a-name nil) >>> (OBJECT nil) (rdfs:label ) (owl:versionInfo ) (rdfs:comment ) >>> (rdfs:member ) >>> (:NAME ) (rdfs:isDefinedBy ) (rdfs:seeAlso ) (owl:differentFrom ) >>> (owl:sameAs ) (rdf:value ) (protege:inferredType ) (rdf:type ) (name ) >>> (category ) (partnumber ?pn) (price ) (requires ) (address ) >>> (customer-id ) >>> (OrderNumber ?o) (quantity ))) >>> while executing defrule MAIN::recommendipodnano >>> while executing (run). >>> Message: No such variable pn. >>> Program text: ( run ) at line 39. >>> at jess.Context.getVariable(Unknown Source) >>> at jess.Variable.resolveValue(Unknown Source) >>> at jess.Fact.a(Unknown Source) >>> at jess.bj.call(Unknown Source) >>> at jess.ep.a(Unknown Source) >>> at jess.Funcall.execute(Unknown Source) >>> at jess.Defrule.a(Unknown Source) >>> at jess.Activation.if(Unknown Source) >>> at jess.a8.a(Unknown Source) >>> at jess.a8.int(Unknown Source) >>> at jess.Rete.run(Unknown Source) >>> at jess.a0.call(Unknown Source) >>> at jess.ep.a(Unknown Source) >>> at jess.Funcall.execute(Unknown Source) >>> at jess.Jesp.a(Unknown Source) >>> at jess.Jesp.for(Unknown Source) >>> at jess.Jesp.parse(Unknown Source) >>> at jess.Jesp.parse(Unknown Source) >>> at jess.Main.execute(Unknown Source) >>> at JessTab.JessTabEngine.run(JessTabEngine.java:114) >>> at java.lang.Thread.run(Unknown Source) >>> .......Pls reply at earliest....thanks >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/No-such-Variable-error-tf2123743.html#a5858821 >>> Sent from the Jess forum at Nabble.com. >>> -------------------------------------------------------------------- >>> 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. >>> -------------------------------------------------------------------- >>> >> >> >> >> --------------------------------------------------------- >> Ernest Friedman-Hill >> Advanced Software Research Phone: (925) 294-2154 >> Sandia National Labs FAX: (925) 294-2234 >> PO Box 969, MS 9012 ejfr...@ca.sandia.gov >> Livermore, CA 94550 http://herzberg.ca.sandia.gov >> -------------------------------------------------------------------- >> 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. >> -------------------------------------------------------------------- >> >> >> > >
-- View this message in context: http://old.nabble.com/No-such-Variable-error-tp5858821p27869946.html Sent from the Jess mailing list archive at Nabble.com. -------------------------------------------------------------------- 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. --------------------------------------------------------------------