[redland-dev] Rasqal Query parsing bug

Dave Beckett dave.beckett at bristol.ac.uk
Mon Jan 10 00:23:07 PST 2005


On Sun, 9 Jan 2005 21:07:34 -0500
Christopher Schmidt <crschmidt at crschmidt.net> wrote:

> The following query causes python to use 100% CPU. When run in gdb, 
> killing via ctrl-c seems to end the program in rdql_lexer_lex.
> 
> import RDF
> m = RDF.Model()
> q = RDF.Query("""select ?title where (?uri rdf:type foo:Channel)
> (?item
>                 rdf:type foo:item) (?item foo:title ?title) and ?item
>                 =~ ?uri
>                                 using foo for
>                                 <http://purl.org/rss/1.0/>""")
> q.execute(m)
> 
> Reproduced at http://librdf.org/query .

It's a bug in the error recovery after a syntax error in a  regex.  You
cannot use a variable as a regex string in RDQL (or SPARQL at present). 
The error is at ?item =~ ?uri

Fixed in CVS or apply patch below (sparql lexer also needs a similar
change) which needs flex 2.5.31 to generate the correct C.

Dave

--- rdql_lexer.l.orig	Mon Jan  3 21:58:57 2005
+++ rdql_lexer.l	Mon Jan 10 08:18:45 2005
@@ -197,6 +197,8 @@
                BEGIN(INITIAL);
                return PATTERN_LITERAL;
              }
+             BEGIN(INITIAL);
+             return ERROR_TOKEN;
          };
 
 


More information about the redland-dev mailing list