RDFLib/rdflib — Issue #81: SPARQL query with "OPTIONAL" triggers error in mysql backend
Author: gjhiggins
Created: 2012-02-20 08:32:13+00:00
State: closed

cuu...@gmail.com, 2009-10-14T14:54:56.000Z

What steps will reproduce the problem?
1. Initialize mysql backend
2. Insert triple that has Literal as value
3. Execute SPARQL query "SELECT ?s ?p ?o WHERE { ?s ?p ?o . OPTIONAL { ?o
?op ?ov } }"

A python script that demonstrates this problem is attached.

What is the expected output? What do you see instead?

I would expect query to work and return some or no results.

Instead I get traceback that ends with:

/usr/local/lib/python2.6/dist-packages/rdflib-2.4.2-py2.6-linux-i686.egg/rdflib/store/MySQL.pyc
in determine_initial_subset(self, store)
216 if isinstance(self.subject, Literal):
217 raise ValueError(
--> 218 'A subject cannot be a literal.')
219
220 if isinstance(self.predicate, URIRef):

ValueError: A subject cannot be a literal.

What version of the product are you using? On what operating system?

rdflib 2.4.2, Ubuntu 9.04

Please provide any additional information below.

It seems that the error gets triggered by "OPTIONAL" keyword.

Comment 1 by eik...@gmail.com

Comment 2 by eik...@gmail.com

Comment 3 by eik...@gmail.com
These issues involve bits that have been moved out of rdflib proper for now. We will re-open them
or move them to rdfextas as appropriate.