Hi,
There seems to be a problem with the way the MySQL store plugin handles
% signs in strings. At some point in accessing a MySQL triple store,
python attempts to interpret the % sign as a string formatting code, and
throws an exception when no matching variable is found. The same
operation works fine when using a memory store.
Please find a short test script attached which demonstrates this behaviour.
I'm using :
rdflib 2.4.0
python 2.4
MySQL Ver 14.12 Distrib 5.0.27
MySQL-python-1.2.2
Please let me know if I can provide any further information.
Many thanks,
Chris Sutton
#!/usr/bin/python
import rdflib; from rdflib import URIRef, Literal, ConjunctiveGraph
# Works fine for a memory store :
x = ConjunctiveGraph()
print list(x.quads((None,None,Literal("I'm 100%"))))
# output : []
# Doesn't for a MySQL store :
cfgstr = "db=newtriplestore,user=root,password=rootpassword,host=localhost"
dbstore = rdflib.plugin.get('MySQL', rdflib.store.Store)("db")
dbstore.open(cfgstr, True)
y = ConjunctiveGraph(dbstore)
print list(y.quads((None,None,Literal("I'm 100%"))))
# output :
# Traceback (most recent call last):
# File "testcase.py", line 20, in ?
# print list(y.quads((None,None,Literal("I'm 100%"))))
# File "build/bdist.macosx-10.3-fat/egg/rdflib/Graph.py", line 783, in quads
# File "build/bdist.macosx-10.3-fat/egg/rdflib/store/MySQL.py", line 354, in
triples
# File
"build/bdist.macosx-10.3-fat/egg/rdflib/store/FOPLRelationalModel/BinaryRelationPartition.py",
line 633, in PatternResolution
# File "build/bdist.macosx-10.3-fat/egg/MySQLdb/cursors.py", line 151, in
execute
# TypeError: not enough arguments for format string
_______________________________________________
Dev mailing list
Dev@rdflib.net
http://rdflib.net/mailman/listinfo/dev