【问题标题】:rdfs:domain error when validating RDF with RDFS in RDFUnitrdfs:在 RDFUnit 中使用 RDFS 验证 RDF 时出现域错误
【发布时间】:2020-05-16 16:19:54
【问题描述】:

我尝试在 RDFUnit 在线演示 (http://rdfunit.aksw.org/demo/) 中使用 RDFS 验证我的 RDF。验证结果为:

Fail ERROR http://example.org/cim#IdentifiedObject.mRID 有 rdfs:domain 不同于:http://example.org/cim#IdentifiedObject

RDF:

<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:cim="http://example.org/cim#" >
  <rdf:Description  rdf:about="1">
    <rdf:type rdf:resource="cim:IdentifiedObject" />
    <cim:IdentifiedObject.mRID>1</cim:IdentifiedObject.mRID>
  </rdf:Description>
</rdf:RDF>

RDFS:

<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://example.org/cim#" >
  <rdfs:Class rdf:ID="IdentifiedObject" />
  <rdf:Property rdf:ID="IdentifiedObject.mRID">
    <rdfs:domain rdf:resource="#IdentifiedObject" />
  </rdf:Property>
</rdf:RDF>

在 rdf:Propery 中声明域的正确方法是什么?

【问题讨论】:

    标签: rdf semantic-web rdfs


    【解决方案1】:

    这个错误有点神秘,但猜测问题出在你数据中的这一行:

    <rdf:type rdf:resource="cim:IdentifiedObject" />
    

    您在此处使用前缀名称作为 rdf:resource 的值,但在 RDF/XML* 中不允许这样做。该值必须是完整的 URI:http://example.org/cim#IdentifiedObject。当前情况的结果很可能是RDFUnit没有识别出你的数据中使用的类和你的模式在域语句中使用的类是同一个东西。

    Protip:不要使用 RDF/XML。就像,永远。必须手动编写/调试是一种糟糕的语法。切换到 Turtle 或 N-Triples 之类的东西,更易于阅读和编辑。

    * 这不起作用的原因是,RDF/XML 是 XML,它使用 XML 命名空间机制来表示前缀名称 - 仅用于元素和属性名称,不适用于属性

    【讨论】:

    • 谢谢。确实类型声明是一个问题。将其更改为完整的 URI 或将类声明缩短为 &lt;cim:IdentifiedObject rdf:about="1"&gt; 使其通过验证。
    猜你喜欢
    • 1970-01-01
    • 2016-09-27
    • 2016-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多