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)