RDF集合:first, rest, nil

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/LucyGill/article/details/80421735

一直没太弄清楚rdf或owl语言中经常出现的first, rest 和nil是什么意思,在网上也没找到合适的中文资料。好在还能参考一下英文,为自己解惑。

概述

简而言之,first, rest, nil三个词在rdf中是共存亡的。它们共同表示一个集合。

详细说明

本文以下部分转自W3C,作者不详。原文介绍了rdf中的若干术语,值得参考。


链接如下:https://www.w3.org/TR/rdf-schema/#ch_collectionvocab

5.2 RDF Collections

This section is non-normative.

RDF containers are open in the sense that the core RDF specifications define no mechanism to state that there are no more members. The RDF Collection vocabulary of classes and properties can describe a closed collection, i.e. one that can have no more members.

翻译:RDF容器是开放的,因为RDF的核心规范没有限定不能继续添加成员的机制。RDF的类词汇和属性词汇集合可以限定是否关闭,即是否还能添加成员。

A collection is represented as a list of items, a representation that will be familiar to those with experience of Lisp and similar programming languages. There is a shorthand notation in the Turtle syntax specification for representing collections.

翻译:一个集合被表示为一个术语列表,这对于那些具有Lisp和类似编程语言经验的人来说将是熟悉的。 Turtle语法规范中有一个用于表示集合的简写符号。

NOTE

RDFS does not require that there be only one first element of a list-like structure, or even that a list-like structure have a first element.

5.2.1 rdf:List

rdf:List is an instance of rdfs:Class that can be used to build descriptions of lists and other list-like structures.

5.2.2 rdf:first

rdf:first is an instance of rdf:Property that can be used to build descriptions of lists and other list-like structures.

A triple of the form:

L rdf:first O

states that there is a first-element relationship between L and O.

The rdfs:domain of rdf:first is rdf:List. The rdfs:range of rdf:first is rdfs:Resource.

5.2.3 rdf:rest

rdf:rest is an instance of rdf:Property that can be used to build descriptions of lists and other list-like structures.

A triple of the form:

L rdf:rest O

states that there is a rest-of-list relationship between L and O.

The rdfs:domain of rdf:rest is rdf:List. The rdfs:range of rdf:rest is rdf:List.

5.2.4 rdf:nil

The resource rdf:nil is an instance of rdf:List that can be used to represent an empty list or other list-like structure.

A triple of the form:

L rdf:rest rdf:nil

states that L is an instance of rdf:List that has one item; that item can be indicated using the rdf:first property.



猜你喜欢

转载自blog.csdn.net/LucyGill/article/details/80421735