[redland-dev] SPARQL queries with filters cause Redland Python bindings to crash

Sarah (Sally) Wilsak swilsak at vmware.com
Wed Jan 18 18:22:10 EST 2012


Hi,

I'm trying to evaluate whether Redland (with the BDB backend) would be a 
good choice for one of our products. While I was testing some more 
realistic queries, I started getting some odd crashes at a much lower 
number of triples than we'd like to be able to support.

I have Redland/Redland Language Bindings 1.0.13.1, Raptor 2.0.0 and 
Rasqal 0.9.22 built on 32-bit Linux. If I run the following script with 
Python 2.6:

import RDF
storage = RDF.HashStorage("thing", options="hash-type='memory'")
model = RDF.Model(storage)
lubmNS = RDF.NS("http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#")
univNS = RDF.NS("http://www.universityName.edu/")
for x in xrange(0, 8000):
     prof = univNS["Professor%s" % x]
     ta = univNS["TeachingAssistant%s" % x]
     paper = univNS["Paper%s" % x]

     profType = lubmNS.Professor
     taType = lubmNS.TeachingAssistant
     paperType = lubmNS.Paper

     worksFor = lubmNS.WorksFor
     writtenBy = lubmNS.WrittenBy
     rdfType = 
RDF.Node(RDF.Uri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"))

     model.append(RDF.Statement(ta, worksFor, prof))
     model.append(RDF.Statement(paper, writtenBy, prof))
     model.append(RDF.Statement(prof, rdfType, profType))
     model.append(RDF.Statement(ta, rdfType, taType))
     model.append(RDF.Statement(paper, rdfType, paperType))

print "Initialized Model"

query = """
SELECT DISTINCT ?target ?type WHERE {
     { ?target a ?type ; ?reln ?obj .
       FILTER ( regex(str(?obj), "Professor", "i") )
     }
     FILTER ( ?type != 
<http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#TeachingAssistant> )
}"""

print "Querying..."
results = model.execute(RDF.SPARQLQuery(query))
print "Results: %s" % results

I get the following output:
$ python quick_test.py
Initialized Model
Querying...
librdf error - digest SHA1 already registered
librdf error - hash memory already registered
librdf error - model storage already registered
librdf error - storage hashes already registered
librdf error - storage trees already registered
librdf error - storage memory already registered
librdf error - storage file already registered
librdf error - storage uri already registered
librdf error - query language sparql11 already registered
librdf error - query language sparql11-query already registered
librdf error - query language sparql11-update already registered
librdf error - query language sparql already registered
Traceback (most recent call last):
   File "quick_test.py", line 38, in <module>
     results = model.execute(RDF.SPARQLQuery(query))
   File "/usr/lib/python2.6/dist-packages/RDF.py", line 1156, in execute
     results = Redland.librdf_model_query_execute(self._model,query._query)
RDF.RedlandError: 'digest MD5 already registered'

I've tried this with the hashed memory storage as above and with the BDB 
storage, with the same results. If anyone on this list has some idea of 
what's happening here, I would be very happy for the insight.

Thanks,
Sally



More information about the redland-dev mailing list