rdf:Bag、rdf:Seq 和 rdf:Alt 在使用时有何不同? [英] How rdf:Bag, rdf:Seq and rdf:Alt is different while using them?

查看:69
本文介绍了rdf:Bag、rdf:Seq 和 rdf:Alt 在使用时有何不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读 RDF Schema 1.1 建议,其中包括以下(强调):

I'm reading the RDF Schema 1.1 recommendation, which includes the following (emphasis added):

rdf:Bag 类是 RDF 'Bag' 容器的类.它是一个rdfs 的子类:容器.虽然在形式上与rdf:Seq 或 rdf:Alt,rdf:Bag 类通常用于向人类读者表明容器旨在无序.

5.1.2 rdf:Bag

The rdf:Bag class is the class of RDF 'Bag' containers. It is a subclass of rdfs:Container. Whilst formally it is no different from an rdf:Seq or an rdf:Alt, the rdf:Bag class is used conventionally to indicate to a human reader that the container is intended to be unordered.

rdf:Seq 类是 RDF 'Sequence' 容器的类.它是一个rdfs 的子类:容器.虽然在形式上与rdf:Bag 或 rdf:Alt,rdf:Seq 类通常用于向人类读者表明容器的容器成员属性旨在很重要.

The rdf:Seq class is the class of RDF 'Sequence' containers. It is a subclass of rdfs:Container. Whilst formally it is no different from an rdf:Bag or an rdf:Alt, the rdf:Seq class is used conventionally to indicate to a human reader that the numerical ordering of the container membership properties of the container is intended to be significant.

rdf:Alt 类是 RDF替代"容器的类.这是rdfs:Container 的一个子类.虽然形式上没有什么不同从 rdf:Seq 或 rdf:Bag,使用 rdf:Alt 类通常向人类读者表明典型的处理将选择容器的成员之一.首先容器的成员,即 rdf:_1 属性的值,是默认选择.

The rdf:Alt class is the class of RDF 'Alternative' containers. It is a subclass of rdfs:Container. Whilst formally it is no different from an rdf:Seq or an rdf:Bag, the rdf:Alt class is used conventionally to indicate to a human reader that typical processing will be to select one of the members of the container. The first member of the container, i.e. the value of the rdf:_1 property, is the default choice.

我试着理解他们每个人的最后一行(以粗体显示).还用谷歌搜索很好地理解它.但不知道他们想如何在人/逻辑层面上区分所有 3 个容器.以及如何在 rdf:Seq 中维护顺序.

I tried understanding last line of each of them (Shown in BOLD). Also googled to understand it well. But couldn't get how they want to differentiate all 3 Containers on human/logical level. Also how the order is maintained in rdf:Seq.

为了理解排序,我还尝试使用 rdf 文件中的 rdf 解析器读取它们,如下所示:

For understanding Ordering I also tried reading them using rdf parser from rdf file like below:

<rdf:Alt rdf:about="http://eresources.nlb.gov.sg/ID/NLBDM/entity/XYZContainer">
     <rdf:li>http://eresources.nlb.gov.sg/ID/NLBDM/resource/c85a5e82-b357-4168-a31e-1c8fd7f46101</rdf:li>
     <rdf:li>http://eresources.nlb.gov.sg/ID/NLBDM/vocab/tqS1cM1h</rdf:li>
     <rdf:li>http://eresources.nlb.gov.sg/ID/NLBDM/vocab/rQhlIgDw</rdf:li>
     <rdf:li>http://eresources.nlb.gov.sg/ID/NLBDM/vocab/AaNRoEP6</rdf:li>
</rdf:Alt>

使用 rdf:Bag 或 rdf:Seq 或 rdf:Alt,都为 rdf:li 提供了相同的有序 Uris

Using either rdf:Bag or rdf:Seq or rdf:Alt, all are giving same ordered Uris for rdf:li

例如.www.w3.org/1999/02/22-rdf-syntax-ns#_1,www.w3.org/1999/02/22-rdf-syntax-ns#_2,www.w3.org/1999/02/22-rdf-syntax-ns#_3 等等...

eg. www.w3.org/1999/02/22-rdf-syntax-ns#_1,www.w3.org/1999/02/22-rdf-syntax-ns#_2,www.w3.org/1999/02/22-rdf-syntax-ns#_3 and so on...

我想通过一个清晰的例子来理解如何在不同的场景下不同地使用这些Containers,以及维护rdf:Seq的顺序有什么特别之处.

I want to understand it with clear example that how to use these Containers differently in different scenarios, and what is special to maintain order for rdf:Seq.

推荐答案

规范也这样说:

容器词汇没有特殊的语义条件:RDF 假定其容器具有的唯一结构是什么可以从这个词汇表的使用和一般的 RDF 推断出来语义条件.这相当于知道容器的类型,并对容器中的项目进行部分枚举.这预期的使用模式是 rdf:Bag 类型的东西被认为是无序但允许重复;rdf:Seq 类型的东西是被认为是有序的,并且 rdf:Alt 类型的东西被认为是代表一组备选方案,可能带有偏好订购.如果容器是有序类型,则排序容器中的物品旨在用数字表示容器成员属性的排序,假设为是单值的.然而,这些非正式的条件并未反映出来在任何正式的 RDF 蕴涵中.

D.2 RDF containers

There are no special semantic conditions on the container vocabulary: the only structure which RDF presumes its containers to have is what can be inferred from the use of this vocabulary and the general RDF semantic conditions. This amounts to knowing the type of a container, and having a partial enumeration of the items in the container. The intended mode of use is that things of type rdf:Bag are considered to be unordered but to allow duplicates; things of type rdf:Seq are considered to be ordered, and things of type rdf:Alt are considered to represent a collection of alternatives, possibly with a preference ordering. If the container is of an ordered type, then the ordering of items in the container is intended to be indicated by the numerical ordering of the container membership properties, which are assumed to be single-valued. However, these informal conditions are not reflected in any formal RDF entailments.

使用 rdf:Bag 或 rdf:Seq 或 rdf:Alt,都给出相同的结果rdf:li 的有序 Uris

例如.www.w3.org/1999/02/22-rdf-syntax-ns#_1,www.w3.org/1999/02/22-rdf-syntax-ns#_2,www.w3.org/1999/02/22-rdf-syntax-ns#_3等等……

是的,这些容器之间没有正式区别.请注意,rdf:li 不是 RDF 属性.这是在 RDF/XML 序列化中使用的特殊 URI,当从 RDF/XML 文档中提取三元组时,它们实际上使用 rdf:_n 属性,这些属性 RDF 属性.您将获得相同的 rdf:_n 属性序列,因为这是它们在 RDF/XML 文档中出现的顺序.

Yes, there's no formal difference between these containers. Note that rdf:li is not an RDF property. It's a special URI that gets used in the RDF/XML serialization, and when the triples are extracted from the RDF/XML document, they actually use the rdf:_n properties, which are RDF properties. You get the same sequence of rdf:_n properties because that's the order that they appeared in the RDF/XML document.

对于 Bag,顺序无关紧要的事实意味着您忽略 rdf:_i 中 i 的特定值,而将它们全部视为成员.对于 Seq,顺序很重要,因此您应该注意 rdf:_i 中 i 的值.顺序可能在 Alt 中很重要;这将取决于应用程序.

With Bag, the fact that order doesn't matter means that you ignore the particular values of i in rdf:_i, and just treat them all as members. With Seq, the order does matter, and so you should pay attention to the value of i in rdf:_i. Order might matter in Alt; it would depend on the application.

我想用清晰的例子来理解它如何使用这些不同场景下的容器不同,有什么特别之处维护 rdf:Seq 的顺序.

区别在于消费者打算对数据做什么.实际数据并没有真正改变,但意图是:

The difference is in what the consumer is intended to do with the data. The actual data doesn't really change, but the intent is that:

  • 如果你看到一个包,那么你会把它当作一个数学集合.它有一堆元素,没有特殊的顺序.当然,当它被写入 RDF/XML 文件时,元素必须按某种顺序写入,但这只是偶然的.
  • 如果您看到一个 Alt,则其意图是它是一组项目,但您实际上只需要其中一个,并且可能有也可能没有排序.例如,如果有人喜欢红色和蓝色,但不喜欢黄色或橙色,并且您需要知道为他们买什么颜色的衬衫,您可以从只包含红色和蓝色的 alt 中选择任意颜色.
  • 如果您看到一个 seq,那么顺序很重要.
  • if you see a Bag, then you treat it like a mathematical set. It has a bunch of elements, and no special order. Of course, when it's written down in a RDF/XML file, the elements have to be written in some order, but it's just incidental.
  • If you see an Alt, then the intent is that it's a collection of items, but you only really need one of them, and there may or may not be an ordering. For instance, if someone is likes the colors red and blue, but doesn't like yellow or orange, and you need to know what color shirt to get for them, you could pick an arbitrary color out of an alt containing just red and blue.
  • If you see a seq, then the ordering is important.

现在假设我们使用的不是 RDF,而是一种带有数组的编程语言.我可以使用一个数组来表示所有这些结构.区别在于消费者 对数组做了什么.不过,在形式上,它们都只是数组.

Now imagine that we're not using RDF, but a programming language with arrays. I can use an array to represent all of these structures. The difference is in what the consumer does with the array. Formally, though, they're all just arrays.

话虽如此,人们似乎并没有真正使用这些集合.它们没有明确的语义,因此它们没有真正明确的用例.如果你需要它们,你可以使用它们,但工具通常不会对它们做任何特别的事情;您可能需要考虑其他替代方案.

All that said, people don't really seem to use these collections all that much. They don't have a definite semantics, and so there's not really a definite use case for them. If you need them, you can use them, but tools won't usually do anything special with them; you might want to consider other alternatives.

这些不是重复的问题,但它们是相关的,可能是有用或有趣的阅读:

These aren't duplicate questions, but they're related and may be useful or interesting reading:

D.2 RDF容器D.3 RDF 集合RDF Semantics W3C Recommendation 中的 a> 也是很好的资源.

The sections D.2 RDF containers and D.3 RDF collections of the RDF Semantics W3C Recommendation are also good resources.

这篇关于rdf:Bag、rdf:Seq 和 rdf:Alt 在使用时有何不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆