RDFLib/rdflibissueplayground — Issue #14: TypeError in SPARQLEvaluate when using FILTER regex( '', '', 'i')
Author: gjhiggins
Created: 2012-02-20 05:28:30+00:00
State: open
Labels: closed

gjhigg...@gmail.com, 2010-09-14T21:25:36.000Z
What steps will reproduce the problem?
1. python test/test_sparql/sparl_regex.py

I was trying to follow along with one of the examples in Programming the
Semantic Web, and got an exception in sparql queries that had a FILTER
regex() statement.

line 235, in mapToOperator
expr.arg3 and ',"'+expr.arg3 + '"' or '',
TypeError: cannot concatenate 'str' and
'ParsedConditionalAndExpressionList' objects

Changing expr.arg3 to expr.arg3.reduce() in mapToOperator in
SPARQLEvaluate.py seems to have fixed the crash, and also seems to produce
a believable argument.

2010-09-14 the test continues to fail but for a different reason:

testRegex (test_ccfsparql.sparql_regex.TestRegex) ... FAIL

======================================================================
FAIL: testRegex (test_ccfsparql.sparql_regex.TestRegex)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/.../rdfextras-working/test/test_ccfsparql/sparql_regex.py", line 32, in testRegex
self.failUnless(len([a for a in results if 'a' in a[0] or 'A' in a[0]]) == 3)
AssertionError:
-------------------- >> begin captured stdout << ---------------------
REGEX(name,ai)

sparql-p operator(s):
sparqlOperators.regex("?name",rdflib.term.Literal(u'a'),"i")

## Full SPARQL Algebra expression ##
Filter(.. a filter ..,BGP(?x,foaf:name,?name))
###################################