- From: Mr. Mel L. O'Cat <m3ll0cat@yahoo.com>
- Date: Sun, 13 Jun 2004 18:24:41 -0700 (PDT)
- To: public-cwm-bugs@w3.org
Error msg=File
"c:\Python23\Lib\site-packages\cwm\term.py", line 708,
in value
raise ValueError("Attempt to run built-in on
unknown datatype %s of value %s
."
Occurs with use of rules (see below) when input uses
XML Schema datatypes ("xsd;string") Repeated test,
removing
property rdf:range statements and "^^xsd;string" from
instance data, and the rules functioned properly.
Rule Used (same as tutorial involving strings):
===============================================
this log:forAll :x, :k, :s .
{ :x exp:memo :k .
( :x!exp:typCd " " :x!exp:category " transaction\n"
)
string:concatenation :s .
} => {
:k log:outputString :s .
} .
Original (bad) N3 file
======================
:exp1 a exp:Expenditure;
exp:id "1"^^xsd:long;
exp:dt "2004-06-12"^^xsd:date;
exp:fromAcctId "CASH"^^xsd:string;
exp:toAcctId "STORE"^^xsd:string;
exp:typCd "BUY"^^xsd:string;
exp:category "FOOD"^^xsd:string;
exp:subCategory "FOOD"^^xsd:string;
exp:netExpAmt "21.38"^^xsd:decimal;
exp:memo "Test exp1"^^xsd:string .
Modified (good) N3 file of instance data:
=========================================
:exp1 a exp:Expenditure;
exp:id "1";
exp:dt "2004-06-12";
exp:fromAcctId "CASH";
exp:toAcctId "STORE";
exp:typCd "BUY";
exp:category "FOOD";
exp:subCategory "FOOD";
exp:netExpAmt "21.38";
exp:memo "Test exp1" .
NOTE: Am using
PyXML-0.8.3.win32-py2.3.exe
Python-2.3.3.exe
cwm.py,v 1.148 2004/03/21 04:24:32 timbl
P.S. This is just a test of something similar to
a database row without additional OWL class typing.
=========================================================================
Output of "Bad" Test (with XSD datatypes)
=========================================================================
C:\my\cwm>python
c:/Python23/Lib/site-packages/cwm/cwm.py --mode=u
--rdf t
ut\MyExpenditures.xml --n3 tut\MyExp01.n3
tut\MyExpRules.n3 --think --strings 1
>tut\MyExp01OUT.txt
Traceback (most recent call last):
File "c:/Python23/Lib/site-packages/cwm/cwm.py",
line 646, in ?
doCommand()
File "c:/Python23/Lib/site-packages/cwm/cwm.py",
line 517, in doCommand
think(workingContext, mode=option_flags["think"])
File "c:\Python23\Lib\site-packages\cwm\query.py",
line 58, in think
return InferenceTask(knowledgeBase, ruleFormula,
mode=mode, repeat=1).run()
File "c:\Python23\Lib\site-packages\cwm\query.py",
line 207, in run
return self.runSmart()
File "c:\Python23\Lib\site-packages\cwm\query.py",
line 195, in runSmart
total += cy.run()
File "c:\Python23\Lib\site-packages\cwm\query.py",
line 303, in run
return rule.once()
File "c:\Python23\Lib\site-packages\cwm\query.py",
line 404, in once
total = query.resolve()
File "c:\Python23\Lib\site-packages\cwm\query.py",
line 545, in resolve
return self.unify(self.queue, self.variables,
self.existentials)
File "c:\Python23\Lib\site-packages\cwm\query.py",
line 781, in unify
bindings.copy(), nb, evidence = evidence +
[reason])
File "c:\Python23\Lib\site-packages\cwm\query.py",
line 781, in unify
bindings.copy(), nb, evidence = evidence +
[reason])
File "c:\Python23\Lib\site-packages\cwm\query.py",
line 712, in unify
nbs = item.tryBuiltin(queue, bindings, heavy=0,
evidence=evidence)
File "c:\Python23\Lib\site-packages\cwm\query.py",
line 984, in tryBuiltin
result = pred.evalObj(subj, queue,
bindings.copy(), proof, self.query)
File "c:\Python23\Lib\site-packages\cwm\term.py",
line 836, in evalObj
return
self.store._fromPython(self.evaluateObject(subj.value()))
File "c:\Python23\Lib\site-packages\cwm\term.py",
line 450, in value
res.append(x.value())
File "c:\Python23\Lib\site-packages\cwm\term.py",
line 708, in value
raise ValueError("Attempt to run built-in on
unknown datatype %s of value %s
."
NameError: global name 'x' is not defined
=========================================================================
Output of "Good" Test (with XSD datatypes)
=========================================================================
C:\my\cwm>M2Exp01
C:\my\cwm>cd c:\my\cwm
C:\my\cwm>python
c:/Python23/Lib/site-packages/cwm/cwm.py --rdf
tut\M2Expe
nditures.xml --n3 tut\M2Exp01.n3 --rdf
1>tut\M2Exp01.rdf
C:\my\cwm>python
c:/Python23/Lib/site-packages/cwm/cwm.py --rdf
tut\M2Expe
nditures.xml --n3 tut\M2Exp01.n3 tut\M2ExpRules.n3
--think --strings 1>tut\M2Ex
p01OUT.txt
C:\my\cwm>
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
Received on Sunday, 13 June 2004 21:25:17 UTC