gjhiggins/rdflib — Issue #62: graph.serialize() generates incorrect SQL when format kwarg is omitted or bound to "xml"
Author: gjhiggins
Created: 2011-10-19 01:09:16+00:00
State: open

Originally filed by gjhigg...@gmail.com on 2009-05-20T17:42:57

What steps will reproduce the problem?
1. This simple-minded read/write test:

import rdflib
from rdflib.graph import ConjunctiveGraph as Graph
from rdflib import plugin
from rdflib.store import Store
from rdflib.namespace import Namespace
from rdflib.term import Literal, URIRef
default_graph_uri = "http://rdflib.net/rdfstore"
configString = "host=localhost,user=foo,password=foo,db=rdflib"
store = plugin.get('PostgreSQL', Store)('rdfstore')
store.destroy(configString)
store.open(configString,create=True)
graph = Graph(store, identifier = URIRef(default_graph_uri))
print "Triples in graph before add: ", len(graph)
rdflibNS = Namespace('http://rdflib.net/test/')
graph.add((rdflibNS['pic:1'], rdflibNS['name'], Literal('Jane & Bob')))
graph.add((rdflibNS['pic:2'], rdflibNS['name'], Literal('Squirrel in Tree')))
graph.commit()
print "Triples in graph after add: ", len(graph)
print graph.serialize()

What is the expected output?

The graph serialized as RDF/XML

What do you see instead?

ProgrammingError: argument of WHERE must be type boolean, not type integer

module body	in foo.py at line 21
function serialize	in graph.py at line 685
function serialize	in XMLSerializer.py at line 50
function __bindings	in XMLSerializer.py at line 26
function compute_qname	in NamespaceManager.py at line 65
function namespaces	in MySQL.py at line 1406
function executeSQL	in MySQL.py at line 682

(see attached file for debug=True trace)

Error not seen when format='nt'.