JessTab in Protege

75 Views Asked by At

I'm using Jess with Protege, I created a def template Person with the slots (name, age and adress), and I created another def template which extends the first one with the additional slot (sex), now I want to delete the first one and replace it by the new one, and I don't want to lose instances, I want the instances of the first one to be extended by the second, how can I do it ? thank you

i tried first to modify the structure of the def template with the function "replace$", but it doesn't work, then I tried the function "modify" but it just modifies the value of a slot

(deftemplate Person (slot name(type string)) (slot age(type integer)) (slot adress(type string)))

(deftemplate Personne (slot name(type string)) (slot age(type integer)) (slot adress(type string)) (slot sexe (type string) ))

(assert( Person (name "Bryan") (age "25") (adress "New York")))

(assert( Person (name "Omar") (age "35") (adress "Algeria")))

(assert( Person (name "Sara") (age "30") (adress "Moroco")))

When I tried to use the function "replace$" into a rule, I had no syntaxique error, the syntax is correct, but when I do (run) it does not work, no rule is executed.

1

There are 1 best solutions below

1
Ernest Friedman-Hill On

There’s no way to change the instances themselves during a single run of the program. But you could save them to a file, edit the file, and load them back in.