RDFLib/rdflib — Issue #28: N3 parser returns error if a namespace prefix contains a hyphen.
Author: gjhiggins
Created: 2012-02-20 08:30:49+00:00
State: closed

gjhigg...@gmail.com, 2008-08-11T14:01:55.000Z

What steps will reproduce the problem?

$ echo "@prefix foo-bar: ." > /tmp/test.n3

>>> from rdflib.Graph import Graph
>>> g=Graph();
>>> g.parse('/tmp/test.n3',format='n3');

What is the expected output?

The usual RDF Graph id:

)>

What do you see instead?

ValueError: Token: ': ]*>

module body	in untitled at line 5
function parse	in Graph.py at line 730
function parse	in N3Parser.py at line 32
function parse	in n3proc.py at line 119
function parse	in n3p.py at line 110

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

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

Please provide any additional information below.

Problem may be avoided by changing the hyphen to an underscore.

Comment 1 by gjhigg...@gmail.com
Adding a hyphen to the qname regex in n3meta appears to solve. However, this needs checking by someone
who is more fluent in regex than I.

Comment 2 by eik...@gmail.com

Comment 3 by gromgull

Comment 4 by eik...@gmail.com

Comment 5 by gromgull
Fixed in r1755, test-case in test_n3.py