Module | DS::Tijdelijk |
In: |
AS.dat.rb
|
Yield all arguments for Term, one at a time.
# File AS.dat.rb, line 73 73: def argument(needed=0.0, party=pro, n=0, ruleref=nil) 74: return if needed > 1.0 75: rr = ruleref ? " #{ruleref.linenr.html_linenr}" : '' 76: nd = needed>0 ? " (need #{needed.html})" : '' 77: n.l "#{party}: searching arguments for literal #{html}#{nd}#{rr}." 78: 79: unless $argument_cache[ argument_tag ].empty? then # FIXME: refactor this 80: $argument_cache[ argument_tag ].each { |x| 81: n.l "#{party}: reusing old #{x.name} (line #{x.linenr.html}) for #{self.html}" 82: yield x 83: } 84: return 85: end 86: 87: $kb.rules[rule_tag].each { |arity, rules| 88: n.l "#{party}: found one or more #{arity.zero? ? 'facts or beliefs' : 'rules' } for literal #{html}." 89: rules.each { |rule| 90: foundrtxt = arity.zero? ? 91: rule.strength<1.0 ? 'belief' : 'fact' : 92: rule.is_transp ? 'transposition' : 'rule' 93: args_yielded = 0 94: rule.linenr = n.l "#{party}: found #{foundrtxt} #{rule.html}." 95: rule.argument(self, needed, party, n) { |x| 96: $argument_cache[ argument_tag ] << x if needed.zero? 97: x.linenr = n.l "#{party}: found #{x.name}: #{x.html(n)}" 98: yield x 99: args_yielded += 1 100: } 101: } 102: } 103: end