我正在尝试在W3C RDF上验证一个foaf代码,下面的代码块导致了问题。在这里,我试图展示Randy和Adil之间的关系,请纠正我为什么不能在这里使用"rel“标签,或者为什么它会造成问题?
<foaf:knows>
<foaf:Person>
<foaf:name>Randy</foaf:name>
<foaf:mbox_sha1sum>0525a7bfaf263d404e751bb12b89e4acc1ce68a7</foaf:mbox_sha1sum>
<rdfs:workplaceHomepage rdf:resource="randy.html" />
<rel:friendOf rdf:resource="adil.html"/>
</foaf:Person>
</foaf:knows>错误:
FatalError: The prefix "rel" for element "rel:friendOf" is not bound.[Line = 39, Column = 46]发布于 2011-05-06 21:57:48
您应该将FOAF内容包装在一个RDF元素中,该元素声明了适当的名称空间:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rel="http://www.perceive.net/schemas/relationship/">发布于 2011-05-06 21:55:18
声明名称空间rel的方式必须与在RDF/XML文档顶部指定foaf的方式相同。
这个例子应该适用于你……
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rel="http://some.namespace.for.rel.com/ns/"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>
<foaf:Person>
<foaf:name>Peter Parker</foaf:name>
<foaf:mbox rdf:resource="mailto:peter.parker@dailybugle.com"/>
<foaf:knows>
<foaf:Person>
<foaf:name>Randy</foaf:name>
<foaf:mbox_sha1sum>0525a7bfaf263d404e751bb12b89e4acc1ce68a7</foaf:mbox_sha1sum>
<rdfs:workplaceHomepage rdf:resource="randy.html" />
<rel:friendOf rdf:resource="adil.html"/>
</foaf:Person>
</foaf:knows>
</foaf:Person>
</rdf:RDF>无论如何,你对rdfs:workplaceHomepage的使用是错误的,你应该使用foaf:workplaceHomepage,而且rel:friendOf也没有多大意义。你也可以在这里使用foaf:knows。
https://stackoverflow.com/questions/5912381
复制相似问题