rdf:resource 和 rdfs:Resource 有什么区别?
What is the difference between rdf:resource and rdfs:Resource?
在 RDF 1.1 中 XML 语法文档 rdf:resource
在定义 Empty Property Elements 时用作缩写形式:
When a predicate arc in an RDF graph points to an object node which has no further predicate arcs, which appears in RDF/XML as an empty node element (or ) this form can be shortened. This is done by using the IRI of the object node as the value of an XML attribute rdf:resource
on the containing property element and making the property element empty.
在 RDF Schema 1.1 中 rdfs:Resource
被定义为 class:
All things described by RDF are called resources, and are instances of the class rdfs:Resource
. This is the class of everything. All other classes are subclasses of this class. rdfs:Resource
is an instance of rdfs:Class
.
两者有什么关系? rdf:resource
值是否总是属于 rdfs:Resource
class 并且相反?
他们根本没有关系。他们只是碰巧共用一个名字,因为他们都某事与资源有关。
术语 "resource" 是 RDF 数据模型的核心(毕竟它是 Resource Description Framework)。 RDF 中的资源,一般来说,是任何可以由 URI 标识的东西(有大量关于空白节点和文字如何属于此定义的技术细节,但为了简单起见,我们将在这里忽略它)。 =21=]
rdf:resource
只是RDF/XML句法中的一个句法元素,即用来标识属性值资源的属性。例如,这是一个简单的 RDF 模型(1 个三元组),在 RDF/XML:
<rdf:Description rdf:about="http://example.org/Bob">
<foaf:address rdf:resource="http://example.org/address1"/>
</rdf:Description>
这里,http://example.org/Bob
是主题资源,foaf:address
是那个主题的一个属性(用来link主题资源给一个值)。本例中的 属性 值也是一个资源 (http://example.org/address1
),因此在 RDF/XML 语法中我们使用 rdf:resource
属性来 link 它。如果您要用不同的语法(例如 Turtle)编写相同的 RDF 模型,您将根本看不到 rdf:resource
:
<http://example.org/Bob> foaf:address <http://example.org/address1> .
在RDF Schema中,class rdfs:Resource
是所有资源的class。它是一个概念,而不是 syntax-specific 机制。由于 RDF 中的几乎所有内容都是资源,因此它是事物的 'top-level' class。所有的东西都是资源,所以如果你引入一个新的 class,例如 "Person",它将(自动)成为 rdfs:Resource
的子 class。
<http://example.org/Bob> rdf:type <http://example.org/Person> .
<http://example.org/Bob> rdf:type rdfs:Resource .
请注意,第二个三元组是第一个三元组的逻辑结果。因此,在实践中,几乎从未在 RDF 模型中显式地写下 bob 是资源这一事实——如果需要,可以推断出来。
在 RDF 1.1 中 XML 语法文档 rdf:resource
在定义 Empty Property Elements 时用作缩写形式:
When a predicate arc in an RDF graph points to an object node which has no further predicate arcs, which appears in RDF/XML as an empty node element (or ) this form can be shortened. This is done by using the IRI of the object node as the value of an XML attribute
rdf:resource
on the containing property element and making the property element empty.
在 RDF Schema 1.1 中 rdfs:Resource
被定义为 class:
All things described by RDF are called resources, and are instances of the class
rdfs:Resource
. This is the class of everything. All other classes are subclasses of this class.rdfs:Resource
is an instance ofrdfs:Class
.
两者有什么关系? rdf:resource
值是否总是属于 rdfs:Resource
class 并且相反?
他们根本没有关系。他们只是碰巧共用一个名字,因为他们都某事与资源有关。
术语 "resource" 是 RDF 数据模型的核心(毕竟它是 Resource Description Framework)。 RDF 中的资源,一般来说,是任何可以由 URI 标识的东西(有大量关于空白节点和文字如何属于此定义的技术细节,但为了简单起见,我们将在这里忽略它)。 =21=]
rdf:resource
只是RDF/XML句法中的一个句法元素,即用来标识属性值资源的属性。例如,这是一个简单的 RDF 模型(1 个三元组),在 RDF/XML:
<rdf:Description rdf:about="http://example.org/Bob">
<foaf:address rdf:resource="http://example.org/address1"/>
</rdf:Description>
这里,http://example.org/Bob
是主题资源,foaf:address
是那个主题的一个属性(用来link主题资源给一个值)。本例中的 属性 值也是一个资源 (http://example.org/address1
),因此在 RDF/XML 语法中我们使用 rdf:resource
属性来 link 它。如果您要用不同的语法(例如 Turtle)编写相同的 RDF 模型,您将根本看不到 rdf:resource
:
<http://example.org/Bob> foaf:address <http://example.org/address1> .
在RDF Schema中,class rdfs:Resource
是所有资源的class。它是一个概念,而不是 syntax-specific 机制。由于 RDF 中的几乎所有内容都是资源,因此它是事物的 'top-level' class。所有的东西都是资源,所以如果你引入一个新的 class,例如 "Person",它将(自动)成为 rdfs:Resource
的子 class。
<http://example.org/Bob> rdf:type <http://example.org/Person> .
<http://example.org/Bob> rdf:type rdfs:Resource .
请注意,第二个三元组是第一个三元组的逻辑结果。因此,在实践中,几乎从未在 RDF 模型中显式地写下 bob 是资源这一事实——如果需要,可以推断出来。