[redland-dev] Perl Redland::Query returns strange results

larry price laprice at gmail.com
Fri Aug 13 09:50:07 BST 2004


On Fri, 13 Aug 2004 05:02:30 +0200, René Puls <kianga at gmail.com> wrote:
> Hi,
> 
> the subject isn't very specific, but it's the best I can describe it. :-)
> 
> Here is an example script:
I recoded it in python to see if I would get the same result
__cut_here__
#!/usr/bin/env python

import RDF


s = RDF.FileStorage('first.rdf')


mod = RDF.Model(s)
paris = RDF.NTriplesParser()

inputstring = """
<http://foo/1> <http://rdf#type> <http://example.com/someType> .
<http://foo/2> <http://rdf#type> <http://example.com/someType> .
<http://foo/3> <http://rdf#type> <http://example.com/someType> .
<http://foo/4> <http://rdf#type> <http://example.com/someType> .
"""

yuri = RDF.Uri("http://foo/")

paris.parse_string_into_model(mod,inputstring,yuri)

que = """
SELECT ?x
WHERE (?x,<http://rdf#type>,<http://example.com/someType>)
"""

q = RDF.Query(que)

result = mod.execute(q)

for x in result:
    print x['x']

__cut_here__

> 
> .... and this is the output:
> 
> results, count=1
> x => [http://foo/4]
> results, count=2
> x => [http://foo/3]
> Use of uninitialized value in concatenation (.) or string at query.pl line 33.
> Can't call method "as_string" on an undefined value at query.pl line 33.
> 
> (How can the bindings count be 2 when I have only one variable in the query?)
> 
I got the expected result

[http://foo/1]
[http://foo/2]
[http://foo/3]
[http://foo/4]

when I ran the script inside emacs,
when I run it from the commandline I get

Traceback (most recent call last):
  File "first.py", line 10, in ?
    paris = RDF.NTriplesParser()
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/RDF.py",
line 1624, in __init__
    return Parser.__init__(self, name = "ntriples",
mime_type="text/plain", uri=uri)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/RDF.py",
line 158, in message_handler
    raise RedlandError(message)
RDF.RedlandError: 'Use of deprecated SAXv1 function endDocument\n'

I suspect libxml,
investigating

-- 
http://Zoneverte.org -- information explained
Do you know what your IT infrastructure does?



More information about the redland-dev mailing list