Re: math:sum crashes on strings

with

### testC.n3
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix q: <http://www.w3.org/2004/ql#>.

[] q:select {<> a <#PassingTest>};
   q:where {(1 "abc") math:sum ?X}.
###

python /w3ccvs/WWW/2000/10/swap/cwm.py --think --query=testC.n3
here gives

#Processed by Id: cwm.py,v 1.165 2004/11/19 01:58:39 syosi Exp 
        #    using base file:/temp/testP.n3
 
#  Notation3 generation by
#       notation3.py,v 1.169 2004/12/07 20:43:49 syosi Exp

#   Base was: file:/temp/testP.n3
 
#ENDS

which is what I would expect

-- 
Jos De Roo, AGFA http://www.agfa.com/w3c/jdroo/




Dan Connolly <connolly@w3.org>
Sent by: public-cwm-bugs-request@w3.org
18/12/2004 23:17

 
        To:     public-cwm-bugs@w3.org
        cc:     (bcc: Jos De_Roo/AMDUS/MOR/Agfa-NV/BE/BAYER)
        Subject:        math:sum crashes on strings



$ 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 Sunday, 19 December 2004 00:13:19 UTC