【发布时间】:2013-10-23 08:51:46
【问题描述】:
我想用这个简单的代码解析一个 Turtle 文件:
public void read(String path) throws IOException {
File sourceFile = new File(path);
Model model = ModelFactory.createDefaultModel();
InputStream in = new FileInputStream(sourceFile);
model.read(in, "", "TTL");
model.write(System.out);
}
有时它会抱怨一些 URI:
线程“main”com.hp.hpl.jena.shared.BadURIException 中的异常:RDF/XML 输出中只能包含格式正确的绝对 URIref:
<http://thetvdb.com/?tab=episode&seriesid={/tv/tv_series_episode/season.series[/authority/thetvdb/series]}&seasonid={/tv/tv_series_episode/season[/authority/thetvdb/season]}&id=337070>查询中的代码:0/ILLEGAL_CHARACTER:字符违反URI/IRI 的语法规则。
我怎样才能避免这种情况?显然有些 URI 违反了 URI 的语法规则,所以 我需要预处理我的输入数据,还是可以选择使用 Jena 进行配置?
【问题讨论】: