在 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 模式 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),反之亦然?
最佳答案
他们根本没有关系。他们只是碰巧共享一个名字,因为他们都与资源有关。
术语“资源”是 RDF 数据模型(毕竟它是资源描述框架)的核心。一般而言,RDF 中的资源是可以由 URI 标识的任何内容(关于空白节点和文字等内容如何归入该定义的技术细节有很多,但为了简单起见,我们将在此处忽略它)。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
是该主题的属性(用于将主题资源链接到值)。本例中的属性值也是一个资源( http://example.org/address1
),因此在 RDF/XML 语法中我们使用 rdf:resource
属性来链接它。如果您要以不同的语法编写相同的 RDF 模型(例如,Turtle),您将看不到 rdf:resource
完全出现:<http://example.org/Bob> foaf:address <http://example.org/address1> .
在 RDF 模式中,类
rdfs:Resource
是所有资源的类。它是一个概念,而不是特定于语法的机制。由于 RDF 中的几乎所有东西都是资源,因此它是“顶级”类的东西。所有事物都是资源,因此如果您引入一个新类,例如“Person”,它将(自动)成为 rdfs:Resource
的子类。 .<http://example.org/Bob> rdf:type <http://example.org/Person> .
<http://example.org/Bob> rdf:type rdfs:Resource .
请注意,第二个三元组是第一个三元组的逻辑结果。因此,在实践中,几乎从未在 RDF 模型中明确写下 bob 是 Resource 的事实——如果需要,它可以被推断出来。
关于rdf - rdf :resource and rdfs:Resource? 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56924338/