gjhiggins/rdfextras — Issue #2: "querying a tiny Sleepycat db takes 30 seconds"
Author: gjhiggins
Created: 2011-10-19 02:57:53+00:00
State: open
Labels: Type-Defect

Originally filed by gjhigg...@gmail.com on 2010-06-09T10:42:42

Migrated from 'wontfix' rdflib issue :

#!/usr/bin/env python

from rdflib.graph import ConjunctiveGraph

# Test basic SPARQL aggregation of the RDFa data
# see also http://identi.ca/notice/17728953 http://identi.ca/notice/17729227

g = ConjunctiveGraph("Sleepycat")
g.open("store", create=True)
g.parse("http://inkdroid.org/journal/network", format='rdfa', lax=True)
g.parse("http://danbri.org/words/network", format='rdfa', lax=True)

q1="""PREFIX foaf:
SELECT ?src1 ?src2 ?x
WHERE {
GRAPH ?src1 { ?gr1 foaf:member [ foaf:openid ?x ] }
GRAPH ?src2 { ?gr2 foaf:member [ foaf:openid ?x ] }
FILTER ( ?src1 != ?src2 )
}"""

for src1, src2, x in g.query(q1):
print src1, src2, x

++ I wonder if other sparql enabled triplestores optimize that query any better.

FWIW, I used the example as a test target for my informal activity of checking the functionality of the no-longer-distributed persistences under rdflib 3.0.0.

Given the resource http://www.w3.org/2000/10/swap/pim/contact.rdf, all the stores listed below can consistently parse, store, read back and count the resource content.

The figures shown are for the test of basic SPARQL aggregation of RDFa data listed above.

SQLite - Parsing: 0.63s, Query: 24.73s
SleepyCat - Parsing: 0.61s, Query: 40.24s
BerkeleyDB - Parsing: 44.57s, Query: 45.70s
PostgreSQL - Parsing: 0.72s, Query: 47.68s
ZODB - Parsing: 0.67s, Query: 80.38s

MySQL - IntegrityError: 1062, Duplicate entry '350685713572143753-9684815388278768738-10362892297732962585-1036' for key 'kb_08683e75be_relations_poscIndex'

Many of the stores made available via the Redland plugin can perform the simple parse/write/read test of contact.rdf and can also parse+store the two graphs in the SPARQL test but I haven't yet figured out how to get a SPARQL query to return anything other than an empty SPARQLResults graph for these stores (or the SQLObject-mediated stores, for that matter).