rdf - Sesame 2.7 无法识别 RDF Literal

标签 rdf semantic-web sesame rdfs rdfstore

我在使用 Sesame 2.7 时遇到了一些问题。假设我有以下 RDF 文档:

<rdf:RDF xmlns:arq="http://example.com/vocab.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">

<arq:Photo rdf:about="http://example.com/photo_2230.rdf">
    <arq:photoName rdf:datatype="http://www.w3.org/2000/01/rdf-schema#Literal">Testing</arq:photoName>
    <!-- More properties -->
    ...
</arq:Photo>

当我将其提交给 Sesame 时,出现以下错误:

'Testing' was not recognised, and could not be verified, with datatype http://www.w3.org/2000/01/rdf-schema#Literal

它与之前的 Sesame 版本(版本 2.6.9)运行良好。但现在,更新后,芝麻2.7无法识别它,我也没有找到原因。有人能猜到发生了什么吗?

谢谢!

最佳答案

在旧版本的 Sesame 中,解析器仅在遇到无法识别的数据类型时发出警告。在 Sesame 2.7 中,默认情况下,解析器实际上会因错误而停止(尽管我们正在考虑在下一次更新中再次放宽这一点)。因此,即使在旧版本的 Sesame 中,也无法识别这一点,并且当您尝试加载此数据时,您会在日志中看到警告。

这是无法识别的数据类型的原因是“http://www.w3.org/2000/01/rdf-schema#Literal”根本不是数据类型标识符。相反,它是文字类的标识符(因此完全不同)。您应该从 RDF 中删除此数据类型,因为它是数据类型机制的错误使用。

要拼写出来,请更改此行:

<arq:photoName rdf:datatype="http://www.w3.org/2000/01/rdf-schema#Literal">Testing</arq:photoName>

至:

<arq:photoName>Testing</arq:photoName>

除了修复数据之外,您当然还可以将 Sesame 的解析器配置为不会立即因无效数据类型而失败。通过编程,可以通过调整连接解析器中使用的 ParserConfig 轻松完成此操作。

 RepositoryConnection conn;  // your repository connection

 // set the parser used in the connection to report datatype 
 // verification errors but not fail on them.
 conn.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);

关于rdf - Sesame 2.7 无法识别 RDF Literal,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16534327/

相关文章:

postgresql - 如何将大型 nt/rdf 转储加载到 Jena/PostgreSQL 模型(TDB/RDB?)

php - 在 jpeg 中写入 XMP 元数据(使用 PHP)- 使用单个或多个 rdf :Description blocks

database - 如何将关系数据库中的数据公开给语义 Web?

sparql - 使用 SPARQL 提取 dbpedia 实体的层次结构

rdf - 使用 SPARQL 计数 : how to get results in one row?

json - 将大型RDF/XML文件转换或转换为JSON-LD格式-如何?

semantic-web - RDFa与微数据

rdf - SPARQL 通过变量而不是行数来限制查询结果

ontology - Sesame SeRQL 不提供更新/插入选项?

rdf - 根据本体验证 RDF 三元组以检查正确的结构