RDF 文件中的属性顺序
RDF/XML 文件中属性的顺序重要吗?换句话说,下面两个是一样的吗?
<rdf:Description rdf:about="http://example.org/1">
<ex:prop>1</ex:prop>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/2">
<ex:prop>2</ex:prop>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/2">
<ex:prop>2</ex:prop>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/1">
<ex:prop>1</ex:prop>
</rdf:Description>
Is the order which have properties in an RDF/XML file significant? In other words, are the following two the same?
<rdf:Description rdf:about="http://example.org/1">
<ex:prop>1</ex:prop>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/2">
<ex:prop>2</ex:prop>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/2">
<ex:prop>2</ex:prop>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/1">
<ex:prop>1</ex:prop>
</rdf:Description>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,RDF 在数学上被定义为一组三元组,因此这些三元组在您使用的 RDF 序列化中出现的顺序完全无关。
话虽如此,在某些序列化中,排序会影响生成的三元组,例如使用集合语法的 Turtle 片段:
会从以下位置生成不同的三元组:
Yes, RDF is mathematically defined as a set of triples so the order that those triples appear in whichever serialization of RDF you are using is entirely irrelevant.
That being said there are some serializations where the ordering would affect the triples produced e.g. a Turtle snippet using collection syntax:
Would produce different triples from: