W3C home > Mailing lists > Public > public-cwm-bugs@w3.org > December 2004

math:sum crashes on strings

From: Dan Connolly <connolly@w3.org>
Date: Sat, 18 Dec 2004 16:17:02 -0600
To: public-cwm-bugs@w3.org
Message-Id: <1103408222.3082.404.camel@dirk>

$ echo '@prefix m: <http://www.w3.org/2000/10/swap/math#>. { (1 "abc")
m:sum ?X } => { <> a <#PassingTest> }.' | python cwm.py --think
#Processed by Id: cwm.py,v 1.165 2004/11/19 01:58:39 syosi Exp
        #    using base file:/home/connolly/dm93c/2004/majo-data/
        Traceback (most recent call last):
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/cwm.py", line 650, in ?
    doCommand()
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/cwm.py", line 563, in
doCommand
    think(workingContext, mode=option_flags["think"])
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/query.py", line 60, in
think
    return InferenceTask(knowledgeBase, ruleFormula, mode=mode,
repeat=1).run()
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/query.py", line 220, in
run
    return self.runSmart()
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/query.py", line 208, in
runSmart
    total += cy.run()
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/query.py", line 338, in
run
    return rule.once()
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/query.py", line 441, in
once
    total = query.resolve()
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/query.py", line 585, in
resolve
    return self.unify(self.queue, self.variables, self.existentials)
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/query.py", line 750, in
unify
    nbs = item.tryBuiltin(queue, bindings, heavy=0, evidence=evidence)
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/query.py", line 1026, in
tryBuiltin
    result = pred.evalObj(subj, queue, bindings.copy(), proof,
self.query)
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/term.py", line 966, in
evalObj
    return self.store._fromPython(self.evaluateObject(subj.value()))
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/cwm_math.py", line 85, in
evaluateObject
    for x in subj_py: t += numeric(x)
  File "/home/connolly/w3ccvs/WWW/2000/10/swap/cwm_math.py", line 71, in
numeric    if s.find('.') < 0 and s.find('e') < 0 : return long(s)
ValueError: invalid literal for long(): abc


-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E
Received on Saturday, 18 December 2004 22:16:41 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:52:00 UTC