I thought by mistake that de name of the variable bound to that fact is 
"object"( the solution of the getName method that is in fact the name of my 
fact).
The variable name is "person". I was making a mistake.
Thanks for your explanations.
 
Ana

--- On Mon, 2/23/09, Ernest Friedman-Hill <[email protected]> wrote:

From: Ernest Friedman-Hill <[email protected]>
Subject: Re: JESS: Mapping instances from Protege
To: "jess-users" <[email protected]>
Date: Monday, February 23, 2009, 6:14 PM

JessTab maps all Protege classes onto a single Jess template named
"object"; it then adds all the slots of all your Protege classes to
that one template.

In the rule below, "?person" is bound to the jess.Fact object holding
the matched fact. "(call ?person getName)" calls jess.Fact.getName(),
which returns the name of the fact's template, which is "object".

I don't understand why you're expecting a variable named
"object" to be defined; I don't see such a variable anywhere in
your code.

If you want the contents of the "name" slot of the matched fact, your
rule binds it to a variable named "?n" -- just use that variable!


On Feb 22, 2009, at 5:03 PM, ANA TANASESCU wrote:

> Hello everybody,
> 
> I have mapped a class defined in Protégé into Jess.
> The class is called Person and has two slots: name and age.
> My problem is that I don't know what name has the fact obtained after
mapping the instance from the Protégé.
> When I use the first printout function I obtained that the fact name is
MAIN::object
> (printout t "Fact is called " (call ?person getName) crlf),
> but when I question my self in the last printout function
> (printout t "Check the fact name " ((context) isVariableDefined
"object") crlf))
> if there is such a variable defined the result is FALSE, instead of TRUE.
Why?
> Which is the name of my fact?
> 
> I’m looking forward for your answer,
> Ana Tanasescu
> 
> P.S. The code:
> 
> (deftemplate person(slot name)(slot age))
> (defclass P(is-a :THING)(slot name(type string))(slot age(type integer)))
> (make-instance of P(name "John")(age 30))
> (mapclass P)
> 
> (defrule printfact-features
>      ?person<-(object(is-a P)(name ?n&"John")(age
?a&30))
> =>
>      (assert(person(name ?n)(age ?a)))
>      (printout t "Fact is called " (call ?person getName) crlf)
;the name of the fact
>      (printout t "Fact type is  " ((?person getClass) getName)
crlf) ;the type of the fact
>      (printout t "Numele clasei este corect "(eq ((?person
getClass) getName) "se.liu.ida.JessTab.DefaultMappedFact") crlf)
>      (printout t "Check the fact name " ((context)
isVariableDefined "object") crlf))
> 
> (reset)
> (run)
> 

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012                            [email protected]
Livermore, CA 94550                             http://www.jessrules.com





--------------------------------------------------------------------
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].
--------------------------------------------------------------------




      

Reply via email to