RDFLib/rdflib — Issue #161: rdflib Turtle output defines illegal _9 prefix
Author: gjhiggins
Created: 2012-02-20 08:34:08+00:00
State: open

felik...@gmail.com, 2011-07-11T10:44:42.000Z

What steps will reproduce the problem?

I used rdfpipe to convert an n3 file to turtle format, resulting in the following:

@prefix _9: .
@prefix rdfs: .

a
;
rdfs:label "Cecil B. DeMille (Director)";
_9:director_name "Cecil B. DeMille" .

However, _9 is not a valid prefix according to the standard:
See http://www.w3.org/TeamSubmission/turtle/#sec-grammar

[26] nodeID ::= '_:' name
[27] qname ::= prefixName? ':' name?
[33] prefixName ::= ( nameStartChar - '_' ) nameChar*

so _9: is illegal

Either
_:BNode
or
abc_def:local
but not a leading _ for a prefix name.

What version of the product are you using? On what operating system?
$ rdfpipe --version
rdfpipe (using rdflib 3.0.0)

any feedback can be sent to feliksik AT gmail DOT com

Comment 1 by gromgull
Just to clarify, the problem here is that the namespace prefixes we generate ourselves are all ns1,ns2,etc. This problem occurs when the parsed file already contains prefixes like _9 - and they are not checked when producing turtle.

I imagine similar bugs may exist for all serialisations that allow prefixes.