Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTriples fails to parse URIs with only a scheme #920

Closed
chmod007 opened this issue Jun 17, 2019 · 2 comments
Closed

NTriples fails to parse URIs with only a scheme #920

chmod007 opened this issue Jun 17, 2019 · 2 comments
Assignees
Milestone

Comments

@chmod007
Copy link

from rdflib import Graph
g=Graph()
g.parse(data='<a:> <b:> <c:> .', format='nt') # nquads also fails

Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.7/site-packages/rdflib/graph.py", line 1039, in parse
parser.parse(source, self, **args)
File "/Library/Python/2.7/site-packages/rdflib/plugins/parsers/nt.py", line 26, in parse
parser.parse(f)
File "/Library/Python/2.7/site-packages/rdflib/plugins/parsers/ntriples.py", line 142, in parse
raise ParseError("Invalid line: %r" % self.line)
rdflib.plugins.parsers.ntriples.ParseError: Invalid line: u'<a:> <b:> <c:> .'

N3, by contrast, succeeds:

g.parse(data='<a:> <b:> <c:> .', format='n3')

Fix is to change:
uriref = r'<([^:]+:[^\s"<>]+)>'
to:
uriref = r'<([^:]+:[^\s"<>]*)>'
in ntriples.py.

@nicholascar nicholascar added this to the rdflib 5.0.0 milestone Mar 16, 2020
@nicholascar nicholascar self-assigned this Mar 16, 2020
@nicholascar nicholascar mentioned this issue Mar 16, 2020
@nicholascar
Copy link
Member

Fixed in PR #974

@white-gecko
Copy link
Member

Fixed via 107ffb6. (#974)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants