首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >dotNetRDF不解析LinkedMovie.nt (VDS.RDF.Parsing.RdfParseException)

dotNetRDF不解析LinkedMovie.nt (VDS.RDF.Parsing.RdfParseException)
EN

Stack Overflow用户
提问于 2020-09-12 18:12:21
回答 1查看 81关注 0票数 1

我已经在Java Apache Jena上测试过linkedmdb-18-05-2009-dump.nt,但是在dotNetRDF上抛出了一个异常

代码语言:javascript
复制
VDS.RDF.Parsing.RdfParseException
HResult=0x80131500
Message=Invalid URI encountered, see inner exception for details
Source=dotNetRDF
StackTrace:
  at VDS.RDF.Parsing.NTriplesParser.TryParseUri(TokenisingParserContext context, String uri)
  at VDS.RDF.Parsing.NTriplesParser.TryParseTriple(TokenisingParserContext context)
  at VDS.RDF.Parsing.NTriplesParser.Parse(TokenisingParserContext context)
  at VDS.RDF.Parsing.NTriplesParser.Load(IRdfHandler handler, TextReader input)
  at ConsoleApp2_RDFWALKTHROUGH.Program.Main(String[] args) in 

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
UriFormatException: Invalid URI: The hostname could not be parsed.

我的c#代码如下:

代码语言:javascript
复制
String inputFile = "D:/linkedmdb-18-05-2009-dump.nt";

IGraph g = new Graph();
NTriplesParser parser = new NTriplesParser(NTriplesSyntax.Original);

Console.WriteLine("RDF DS-1 Loading Started:");

parser.Load(g, new StreamReader(inputFile));

Console.WriteLine("RDF DS-1 Loading Finished:");

Console.WriteLine(new DateTime(loadingTime).ToShortTimeString());
Console.ReadLine();

请告诉我哪里错了,因为同样的文件在Java上是可以的,但在dotNetRDF上却不能解析,这是非常令人困惑的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-09-13 22:51:57

问题是转储包含无效的IRI。在我从https://www.cs.toronto.edu/~oktie/linkedmdb/下载的转储文件的第3104575行,有以下内容:

代码语言:javascript
复制
<http://data.linkedmdb.org/film/9995> <http://xmlns.com/foaf/0.1/page> <http://?> .

该行上的最后一个IRI会导致解析器卡住,因为?不是IRI中该位置的有效字符。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63859227

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档