- From: James Michael DuPont <mdupont777@yahoo.com>
- Date: Sun, 2 Jan 2005 02:46:27 -0800 (PST)
- To: public-cwm-bugs@w3.org
Hi all,
I just wanted to report a small problem with a deep recursion, and
another one about self referential bnodes that might be interesting.
First the simple one,
"""
_:a1 <#:next> _:a1; <#:val> "foo".
_:a2 <#:next> _:a3; <#:val> "foo".
"""
produces """
@prefix : <#> .
[ ::next [ ]; ::val "foo" ].
"""
that would be better if it produced :
"""
@prefix : <#> .
_:a1 <#:next> _:a1; <#:val> "foo".
[ ::next [ ]; ::val "foo" ].
"""
The second bug is a bunch of statements like this :
perl -e 'print "\@prefix : <file:/tmp/foo>.\n";for(1...10000){my
$n=$_;$n1=$n+1;print "_:a$n <:next> _:a$n1.\n"}' > test.n3
that produces the crash
File
"/mnt/hdb2/experiments/cwm/infomesh.net/2001/cwm/cwm1.82/llyn.py", line
1269, in dumpStatement
self.dumpStatement(sink, t.triple)
File
"/mnt/hdb2/experiments/cwm/infomesh.net/2001/cwm/cwm1.82/llyn.py", line
1269, in dumpStatement
self.dumpStatement(sink, t.triple)
File
"/mnt/hdb2/experiments/cwm/infomesh.net/2001/cwm/cwm1.82/llyn.py", line
1269, in dumpStatement
self.dumpStatement(sink, t.triple)
File
"/mnt/hdb2/experiments/cwm/infomesh.net/2001/cwm/cwm1.82/llyn.py", line
1269, in dumpStatement
self.dumpStatement(sink, t.triple)
File
"/mnt/hdb2/experiments/cwm/infomesh.net/2001/cwm/cwm1.82/llyn.py", line
1265, in dumpStatement
sink.startAnonymous(self.extern(triple), li)
File
"/mnt/hdb2/experiments/cwm/infomesh.net/2001/cwm/cwm1.82/notation3.py",
line 1266, in startAnonymous
self._makeSubjPred(triple[CONTEXT], triple[SUBJ], triple[PRED])
File
"/mnt/hdb2/experiments/cwm/infomesh.net/2001/cwm/cwm1.82/notation3.py",
line 1402, in _makeSubjPred
self._write( " %s " % self.representationOf(context, pred))
File
"/mnt/hdb2/experiments/cwm/infomesh.net/2001/cwm/cwm1.82/notation3.py",
line 1464, in representationOf
return "<" + relativeURI(self.base, value) + ">" # Everything
else
File
"/mnt/hdb2/experiments/cwm/infomesh.net/2001/cwm/cwm1.82/notation3.py",
line 961, in relativeURI
if string.find(base, "//", i-2)>0 \
RuntimeError: maximum recursion depth exceeded
which produces :
[ <:next> [
<:next> [
<:next> [
<:next> [
<:next> [
<:next> [
<:next> [
<:next> [
<:next> [
<:next> [
] ] ] ] ] ] ] ] ] ] ].
I would suggest to have cwm to just break off the list when the stack
gets to large. Let assume that we have a max depth variable that is
checked before recursion.
Introducing a _:genidNNN in between. So lets say in this example, the
max depth was 5.
[ <:next> [
<:next> [
<:next> [
<:next> [
<:next> _:genid123
]
]
]
]
].
_:genid123 <:next> [
<:next> [
<:next> [
<:next> [
]
]
]
].
mike
=====
James Michael DuPont
http://introspector.sourceforge.net/
__________________________________
Do you Yahoo!?
Send a seasonal email greeting and help others. Do good.
http://celebrity.mail.yahoo.com
Received on Sunday, 2 January 2005 10:46:59 UTC