rdflib.exceptions.ParserError: Invalid line:

128 views
Skip to first unread message

Tom Tang

unread,
Dec 2, 2021, 2:45:56 AM12/2/21
to rdflib-dev
Dear rdflib manitainers, 
   I am a user of rdflib. When I use rdflib.Graph to parse one .nt file, the terminal output is
rdflib.exceptions.ParserError: Invalid line: <http://dbpedia.org/resource/2015_African_Rugby_Under-19_Cup_Division_"A"> .
While I remove the double quotations of ”A", i.e., "A" -> A,the program is OK. I want to know if there are other ways to parsing the .nt file rather than remove the double quotations of ”A".
Thanks a lot.
Yours Sincerely.

Appendix
Code{
from rdflib import Graph
g = Graph()
g.parse("./data/example.nt")
print(f"Graph g has {len(g)} statements.")
print(g.serialize(format="turtle"))
}

Graham Higgins

unread,
Dec 2, 2021, 11:35:05 AM12/2/21
to rdflib-dev
As posted on Gitter, included here for completeness:  Looks like a problematic URL for dbpedia. With, or without the double quotes, that dbpedia URL returns a “301 See other” and the relocate is https://dbpedia.org/resource/2015_African_Rugby_Under-19_Cup_Division_%22A%22 - which itself fails to resolve. OTOH, wikipedia returns a corresponding redirect https://en.wikipedia.org/wiki/2015_African_Rugby_Under-19_Cup_Division_%22A%22 which is found. The dbpedia page is essentially blank, it has none of the info for that entry on wikipedia.

Cheers,
Graham
Reply all
Reply to author
Forward
0 new messages