在RDFUnit中用RDFS验证RDF时,出现rdfs:域错误。

问题描述 投票:1回答:1

我试图在RDFUnit在线演示中用RDFS验证我的RDF (http:/rdfunit.aksw.orgdemo。). 验证的结果是。

失败 ERROR http:/example.orgcim#IdentifiedObject.mRID。 有rdfs:domain不同。http:/example.orgcim#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个回答
2
投票

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

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

你使用了一个前缀的名字来作为... rdf:resource 在这里,但这在RDFXML*中是不允许的。这个值需要是完整的URI。http://example.org/cim#IdentifiedObject. 目前的结果可能是RDFUnit没有识别出你的数据中使用的类和你的schema在domain语句中使用的类是同一个东西。

提示:不要使用RDFXML。比如,永远不要。这是个很糟糕的语法,必须手动编写ebug。换成像Turtle或者N-Triples这样的语言,更容易阅读和编辑。

* 这行不通的原因是 RDFXML 是 XML,嗯,它使用 XML 命名空间机制来表示前缀名--这只适用于元素和属性名,而不是属性名。价值观.

© www.soinside.com 2019 - 2024. All rights reserved.