[EMAIL PROTECTED] wrote:

...
Jess has "defqueries" which let you select instances in a procedural
way like this. Charlemagne (Jess 7, or whatever it ends up being called) will
have something like "do-for-all-instances" implemented using queries,
but it can be implemented now with a minimum of trouble.
...
Secondly, since I am using the JessTab, I use an intrinsic JessTab function (called mapclass) to convert all class instances to facts in the knowledge base. Is there a way to access these class instances so I can append them onto a multifield? Should I define a rule that performs this LOOK-AT-INSTANCES then APPEND-TO-MULTIFIELD operation and then run it separately before my rules for the main app get defined? Or is there a better way to do this?


I don't know enough about Protege to know what "class instances" are
in this context; someone else probably does.


I happen to have the Jess code for doing something similar to what Saumil is trying to do

;; define query to get instances of ClassDescription (A Protege class that has been mapped to Jess through JessTab) whose slot "classname" has the value ?classname.

(defquery getClassObj
  (declare (variables ?classname))
  (object (is-a ClassDescription) (classname ?classname)(OBJECT ?obj)))

;; utility functin to get slot value
(deffunction get-jess-fact-slot-value (?token ?slot)
  (return (fact-slot-value (call ?token fact 1) ?slot))
)

;;
(deffunction DoIt (?className)
  (bind ?it (run-query getClassObj ?className))
  (while (?it hasNext)
     (bind ?token (call ?it next))
    (bind ?classObj (get-jess-fact-slot-value ?token OBJECT))
     ;; Now ?classObj is a Protege instance that satisfies the query
        ...
   )
)

--
Samson Tu                       email: [EMAIL PROTECTED]
Stanford Medical Informatics    phone: 1-650-725-3391
Stanford University             fax: 1-650-725-7944

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