Dear Sir,
I am new to Jess and I am not sure how Jess indexes tuples.
It seems that it indexes on all arguments and not only the first
argument (like many prolog systems). I just want to check if this is
correct.
For instance, I have the program below that finds all hyponyms of all
words in english in WordNet.
The find_testAllHyponyms rule, uses the template
(hyp (first ?synset_id2) (second ?synset_id1))
where the second argument is bound, where the first one is bound.
I get the same time if I compute all the hyponyms (first argument
bound) or all the hypernyms (second argument bound), which brought me
to the conclusion that Jess indexes on both arguments.
Regards,
Paul Fodor
; define templates
(deftemplate s (slot first) (slot second))
(deftemplate hyp (slot first) (slot second))
(deftemplate testAllHyponyms (slot first) (slot second))
(defrule find_testAllHyponyms
(s (first ?synset_id1) (second ?word1))
(hyp (first ?synset_id2) (second ?synset_id1))
(s (first ?synset_id2) (second ?word2))
=>
(assert (testAllHyponyms (first ?word1) (second ?word2)))
)
(defquery query-testAllHyponyms
(testAllHyponyms (first ?first) (second ?second))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(printout t crlf "wn_s.clp" crlf)
(reset)
(load-facts "wn_s.clp")
;(facts)
(printout t crlf "wn_hyp.clp" crlf)
(load-facts "wn_hyp.clp")
;(facts)
(bind ?tmx (call java.lang.management.ManagementFactory getThreadMXBean))
(deffunction cputime () (return (* (?tmx getCurrentThreadCpuTime) 1E-9)))
; get times
(bind ?starttime_wall (time))
(bind ?starttime_cpu (cputime))
(run)
(bind ?testAllHyponyms_result (run-query* query-testAllHyponyms))
(bind ?count 0)
(while (?testAllHyponyms_result next)
(printout t "")
(++ ?count)
)
(printout t "the number of answers = " ?count crlf)
(bind ?endtime_cpu (cputime))
(bind ?endtime_wall (time))
(bind ?walltime (- ?endtime_wall ?starttime_wall))
(bind ?cputime (- ?endtime_cpu ?starttime_cpu))
(printout t "Cpu time = " ?cputime crlf)
(printout t "Wall time= " ?walltime crlf crlf)
;(facts)
--------------------------------------------------------------------
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]
--------------------------------------------------------------------