【发布时间】:2013-12-28 20:19:13
【问题描述】:
为什么下面的测试会产生错误? Redland 的海龟解析器是否坚持使用基本 URI,即使所有实际 URI 都是绝对的? (Apache Jena 显然没有。)我怎样才能找到更多关于实际问题的信息(即,什么 API 调用会返回错误描述或类似内容)?
librdf_world *world = librdf_new_world();
librdf_world_open(world);
librdf_storage *storage = librdf_new_storage(world, "memory", NULL, NULL);
librdf_model *model = librdf_new_model(world, storage, NULL);
librdf_parser* parser = librdf_new_parser(world, NULL, "text/turtle", NULL);
librdf_uri *baseUri = NULL;
const char *turtle = "<http://example.com/SomeSubject> <http://example.com/SomePredicate> <http://example.com/SomeObject> .";
int error = librdf_parser_parse_string_into_model(parser, (const unsigned char *)turtle, baseUri, model);
【问题讨论】:
-
Jena 将使用内部选择的默认基本 URI(如果所有其他方法都失败,则基于当前目录),如果没有提供。
-
您是否尝试过使用librdf_parser_set_error() 添加错误处理程序并查看错误消息的内容?
-
文档(链接到的地方)说:
Deprecated: Does nothing。 -
@AndyS thx,这有帮助。您是否知道某些规范是否坚持使用基本 URI(即使所有实际 URI 都是绝对的,例如在引用的示例中)?
标签: c rdf jena turtle-rdf redland