Re: N3 in JSON, euler.py

[...]
>> I'm trying to understand the Step() class and the prove()
>> function; I'm a little stuck. For example, why copy
>> the rule and the step here?
>>
>> 140            r = Step(copy.copy(c.parent.rule), c.parent.src, 
>> 141                  copy.copy(c.parent.parent), c.parent.env,
>> c.parent.ind) 
>>  -- http://homer.w3.org:8765/?f=4abf7397cdb2;file=euler.py
>
> 23:06:55 <JosD> DanC, then quickly: you are probably right that
> the 4 copy.copy's are not needed; all tests are still fine
>
> Thanks for finding that out and it is good to continuously
> refactor, just wished we had much more test cases..

Oops.. I was testing those cases using the wrong path and so
it was testing using the old version.. then I changed to
python euler.py in the test.sh and when I now do the tests
with the some copy.copy removed not all the tests are running
and so the copy.copy is needed (just can't justify right now..)

I am also testing the case
http://eulersharp.sourceforge.net/2005/11swap/grapht.n3
in which the variable arcs occur and is a similar hack
using 3-tuples

diff -r 3953c6e23904 euler.py
--- a/euler.py  Tue Dec 19 21:31:45 2006 -0600
+++ b/euler.py  Sat Dec 23 15:31:40 2006 +0100
@@ -416,6 +416,10 @@ def load(path, rules, goals, np):
             r = Rule(s.strip('.'))
             if not rules.get(r.head.arc): rules[r.head.arc] = []
             rules[r.head.arc].append(r)
+            if not r.head.arc == '.' and r.body == []:
+                r = Rule('('+s.strip('.')+')')
+                if not rules.get(r.head.arc): rules[r.head.arc] = []
+                rules[r.head.arc].append(r)
             triple = triple+1
     return triple

All the other cases still run
http://eulersharp.sourceforge.net/2005/11swap/test.sh
and have the same number of inference steps as before.

This is hg export 86 > patch


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

Received on Saturday, 23 December 2006 15:12:48 UTC