什么是 RDF 三元组?

发布于 2024-07-08 17:46:16 字数 24 浏览 6 评论 0原文

通俗地说,什么是 RDF 三元组?

In layman's terms, what's a RDF triple?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

烂柯人 2024-07-15 17:46:17

RDF Triple 是将一个对象与另一个对象相关联的语句。 例如:

"gcc" "Compiles" "c" .
"gcc" "compiles" "Java" . 
"gcc" "compiles" "fortran" .
"gcc" "has a website at" <http://gcc.gnu.org/> .
"gcc" "has a mailing list at" <mailto:[email protected]> .
"c" "is a" "programming language" .
"c" "is documented in" <http://www.amazon.com/Programming-Language-Prentice-Hall-Software/dp/0131103628/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1226085111&sr=8-1> .

An RDF Triple is a statement which relates one object to another. For Example:

"gcc" "Compiles" "c" .
"gcc" "compiles" "Java" . 
"gcc" "compiles" "fortran" .
"gcc" "has a website at" <http://gcc.gnu.org/> .
"gcc" "has a mailing list at" <mailto:[email protected]> .
"c" "is a" "programming language" .
"c" "is documented in" <http://www.amazon.com/Programming-Language-Prentice-Hall-Software/dp/0131103628/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1226085111&sr=8-1> .
甜`诱少女 2024-07-15 17:46:17

RDF 文件应该解析为
三元组列表。

三元组由一个主语、一个
谓词和宾语。 但做什么
这些实际上意味着什么?

主题就是主题。 它
识别三元组是什么对象
描述。

谓词定义了
我们给出的对象中的数据
值。

该对象是实际值。

来自:http://www.robertprice.co.uk/robblog /archive/2004/10/What_Is_An_RDF_Triple_.shtml

An RDF file should parse down to a
list of triples.

A triple consists of a subject, a
predicate, and an object. But what do
these actually mean?

The subject is, well, the subject. It
identifies what object the triple is
describing.

The predicate defines the piece of
data in the object we are giving a
value to.

The object is the actual value.

From: http://www.robertprice.co.uk/robblog/archive/2004/10/What_Is_An_RDF_Triple_.shtml

高速公鹿 2024-07-15 17:46:17

关于 Adam N 的回答。我相信 OP 之前问过一个有关社交网络数据的问题,因此尽管答案非常好,但我将仅就“原始原始”问题进行澄清。 (因为我觉得有责任)。

    John | Is a Friend of | James
    James | Is a friend of | Jill
    Jill | Likes | Snowboarding
    Snowboarding | Is a | Sport

使用这样的三元组,您可以拥有非常灵活的数据结构。

看看朋友的朋友(FOAF)也许是一个更好的例子。

Regarding the answer by Adam N. I believe the O.P. asked a previous question regarding data for a social network, so although the answer is excellent, I will just clarify in relation to the "original original" question. (As I feel responsible).

    John | Is a Friend of | James
    James | Is a friend of | Jill
    Jill | Likes | Snowboarding
    Snowboarding | Is a | Sport

Using triples like this you can have a really flexible data structure.

Look at the Friend of a friend (FOAF) perhaps for a better example.

奢华的一滴泪 2024-07-15 17:46:17

RDF 是一种语言,即用于编码和解码信息(某些上下文中的数据)的符号、语法和语义的系统。

在RDF中,一个观察单元(数据)由一个句子表示,该句子由三部分组成:主语、谓语、宾语。 基本上,这是自然语言语音的基本结构。

用于表示参与由 RDF 表示的实体关系的实体(事物)的符号是 IRI(其中包括 HTTP URI)。 RDF 句子的每个主语和谓语(以及可选的宾语)组件都由 IRI 表示。

语法(语法)是抽象的(意味着它可以使用各种符号来表示),以主语、谓语和宾语排列顺序的形式存在。

语义(最常被忽视的部分)是关于 RDF 语句中主语、谓语和宾语角色的含义。

当您使用 HTTP URI 来表示 RDF 语句主语、谓词和(可选)对象时,您最终会得到形成网络的结构化数据(实体关系类型的集合),就像您今天在万维网上所看到的那样。

当 RDF 语句中的谓词(特别是)语义既是机器又是人类可以理解的时,您就拥有了一个实体关系类型网络,它提供了强大的信息编码,这是知识(推理和推理)的基础。

以下是简单 RDF 语句的示例:

{
    <#this>             a  schema:WebPage                          .
    <#this>  schema:about  dbpedia:Resource_Description_Framework  .
    <#this>  skos:related  <https://stackoverflow.com/questions/30742747/convert-a-statement-with-adjective-in-rdf-triple/30836089#30836089>   . 
}

我使用大括号将示例括起来,以便这篇文章变成基于 RDF 的链接数据演示,由相对 HTTP URI 和基于 # 的片段标识符提供(索引)。

本文中嵌入的 RDF 语句的结果,由 nanotation 提供(在接受文本的地方嵌入 RDF 语句):

  1. 基本实体描述页面 -- 每个语句都由解析为其描述的超链接标识(主语、谓语、宾语部分) )
  2. 更深入的分面浏览页面 - 另一种视图,有助于通过以下方式进行更深入的探索和发现 -你的鼻子通过构成数据网或链接数据网的超链接。
  3. 嵌入语句的描述 -- 关于特定的 RDF 语句。

这是从本文中嵌入的三元组生成的可视化(使用我们的结构化数据嗅探器浏览器扩展,使用 RDF-Turtle符号:
输入图片此处描述

RDF is a Language, i.e., a system of signs, syntax, and semantics for encoding and decoding information (data in some context).

In RDF, a unit of observation (Data) is represented by a sentence that consists of three parts: subject, predicate, object. Basically, this is the fundamental structure of natural language speech.

The sign used to denote entities (things) participating in entity relationships represented by RDF is an IRI (which includes HTTP URIs). Each subject and predicate (and optionally, object) component of an RDF sentence is denoted by an IRI.

The syntax (grammar) is abstract (meaning it can be represented using a variety of notations) in the form of subject, predicate, and object arrangement order.

The semantics (the part overlooked most often) is all about the meaning of the subject, predicate, and object roles in an RDF statement.

When you use HTTP URIs to denote RDF statement subject, predicates, and (optionally) objects, you end up with structured data (collections of entity relationship types) that form a web -- just as you have today on the World Wide Web.

When the semantics of a predicate (in particular) in an RDF statement are both machine and human comprehensible you have a web of entity relationship types that provide powerful encoding of information that is a foundation for knowledge (inference and reasoning).

Here are examples of simple RDF statements:

{
    <#this>             a  schema:WebPage                          .
    <#this>  schema:about  dbpedia:Resource_Description_Framework  .
    <#this>  skos:related  <https://stackoverflow.com/questions/30742747/convert-a-statement-with-adjective-in-rdf-triple/30836089#30836089>   . 
}

I've used braces to enclose the examples so that this post turns into a live RDF-based Linked Data demonstration, courtesy of relative HTTP URIs and the # based fragment identifier (indexical).

Results of the RDF statements embedded in this post, courtesy of nanotation (embedding RDF statements wherever text is accepted):

  1. Basic Entity Description Page -- Each Statement is identified by a hyperlink that resolves to its description (subject, predicate, object parts)
  2. Deeper Faceted Browsing Page -- Alternative view that lends itself to deeper exploration and discovery by following-your-nose through the hyperlinks that constitute the data web or web of linked data.
  3. Description of an embedded statement -- About a specific RDF statement.

Here's the visualization generated from the triples embedded in this post (using our Structured Data Sniffer Browser Extension, using RDF-Turtle Notation:
enter image description here

深海夜未眠 2024-07-15 17:46:17

请注意,它可能会变得更复杂一些。 RDF 三元组也可以被视为主语或宾语,因此您可以拥有如下内容:
巴特-> 说-> (三元组 -> 可以是 -> 对象)

Note, that it can get a bit more complicated. RDF triples can also be considered Subjects or Objects, so you can have something like:
Bart -> said -> ( triples -> can be -> objects)

蝶舞 2024-07-15 17:46:17

我不得不部分同意 A Pa 的观点,尽管他被否决了。

背景:我是一名语言学家,拥有该学科的博士学位,从事计算语言学工作。

“……一个句子由三部分组成:主语、谓语、宾语。基本上,这是自然语言语音的基本结构”(A Pa 引用 Kingsley Uyi Idehen 的回答)的说法是完全错误的。 这不仅是 Kingsley 这么说的,我还从许多 RDF 三元组的拥护者那里听到过这样的说法。

它的错误有很多原因,例如:谓词(在英语中,可以说,在许多其他自然语言中)由动词(或类似动词的东西)+宾语(也许还有其他补语)组成。 英语的句法结构绝对不是Subj-Pred-Obj。

此外,并非所有英语自然语言句子都有宾语; 特别是,根据定义,不及物动词不带宾语。 天气动词(除其他外)甚至不带“真正的”主语(“it rains”的“it”没有任何参考)。 另一方面,像“give”这样的双及物动词既可以直接宾语也可以间接宾语。 还有一些动词,比如“put”,除了直接宾语之外还带有方位格,或者“tell”带有宾语和从句。 更不用说辅助词了,比如时间状语和方式状语。

是的,当然,您可以将嵌入子句表示为嵌入三元组(只要您可以将任何语句表示为三元组,我希望您已经明确表示,您不能),但我认为您不能在 RDF 中要做的事情(至少我从未见过它完成,而且看起来需要四倍)是同时拥有一个对象和一个嵌入子句。 同样,直接宾语和间接宾语或附属物。

因此,无论 RDF 三元组的动机是什么,我希望倡导者不要再假装存在语言动机,或者三元组在任何方面都类似于自然语言语法。 因为他们不这样做。

I'm going to have to agree with A Pa in part, even though he was down-voted.

Background: I'm a linguist, with a PhD in that subject, and I work in computational linguistics.

The statement that "...a sentence that consists of three parts: subject, predicate, object. Basically, this is the fundamental structure of natural language speech" (which A Pa quotes from Kingsley Uyi Idehen's answer) is simply wrong. And it's not just that Kingsley says this, I've heard it from many advocates of RDF triples.

It's wrong for many reasons, for example: Predicates (in English, arguably, and in many other natural languages) consist of a verb (or a verb-like thing) + the object (and perhaps other complements). It is definitely NOT the case that the syntactic structure of English is Subj-Pred-Obj.

Furthermore, not all natural language sentences in English have an object; intransitive verbs, in particular, by definition do not take objects. And weather verbs (among other things) don't even take a "real" subject (the "it" of "it rains" has no reference). And on the other hand, ditransitive verbs like "give" take both a direct and an indirect object. Then there are verbs like "put" that take a locative in addition to the direct object, or "tell" that take an object and a clause. Not to mention adjuncts, like time and manner adverbials.

Yes, of course you can represent embedded clauses as embedded triples (to the extent that you can represent any statement as triples, which as I hope you've made clear, you can't), but what I don't think you can do in RDF (at least I've never seen it done, and it seems like it would take a quadruple) is to have both an object and an embedded clause. Likewise both a direct and an indirect object, or adjuncts.

So whatever the motivation for RDF triples, I wish the advocates would stop pretending that there's a linguistic motivation, or that the triples in any way resemble natural language syntax. Because they don't.

蘸点软妹酱 2024-07-15 17:46:17

自从我使用 RDF 以来已经有一段时间了,但是现在是这样:D

三元组是主语、谓语和宾语。

主题是唯一标识某事物的 URI。 例如,您的 openid 是您的唯一标识。

客体定义了主体和客体如何相关。

谓语是主语的某些属性。 例如一个名字。

鉴于此,三元组形成图S→P。 给定更多的三元组,图表就会增长。 例如,您可以将同一个人标识为一堆三元组的主语,然后可以通过该唯一的主语连接所有谓词。

It has been awhile since I worked with RDF, but here it goes :D

A triple is a subject, predicate and object.

The subject is a URI which uniquely identifies something. For example, your openid uniquely identifies you.

The object defines how the subject and object are related.

The predicate is some attribute of the subject. For example a name.

Given that, the triples form a graph S->P. Given more triplets, the graph grows. For example, you can have the same person identified as the subject of a bunch of triples, you can then connect all of the predicates through that unique subject.

黯淡〆 2024-07-15 17:46:17

RDF Triple 是一个实际的表达式,它定义了表示对象之间关系的方式。 三元组由三个部分组成:主语、谓语和宾语(通常以相同的顺序编写)。 谓词将主语与宾语联系起来。

主语----谓语----> 对象

更多有用的信息可以在以下位置找到:

http://www.w3.org/TR/ rdf-概念/

RDF Triple is an actual expression that defines a way in which you can represent a relationship between objects. There are three parts to a triple: Subject, Predicate and Object (typically written in the same order). A predicate relates subject to object.

Subject ----Predicate---> Object

More useful information can be found at:

http://www.w3.org/TR/rdf-concepts/

音栖息无 2024-07-15 17:46:17

一个简单的答案可以是,RDF 三元组是使用 RDF 数据模型的一些知识的表示。 该模型基于以主语-谓语-宾语表达式的形式对资源(特别是网络资源URI)进行陈述的思想。 RDF 也是Web 上数据交换的标准模型。 即使底层模式不同,RDF 也具有促进数据合并的功能,并且它特别支持模式随时间的演变,而不需要更改所有数据使用者。 我推荐这篇文章来了解如何操作:https://www.w3.org/DesignIssues/ RDF-XML.html

A simple answer can be that an RDF triple is a representation of some knowledge using RDF data model. This model is based upon the idea of making statements about resources (in particular web resources URIs) in the form of subject–predicate–object expressions. RDF is also a standard model for data interchange on the Web. RDF has features that facilitate data merging even if the underlying schemas differ, and it specifically supports the evolution of schemas over time without requiring all the data consumers to be changed. I recommend this article to know how: https://www.w3.org/DesignIssues/RDF-XML.html

尘世孤行 2024-07-15 17:46:17

人们可以将三元组视为一种陈述有关资源的单个“事实”的句子。 首先要了解 RDF Triple,您应该知道 RDF 中的每件事都是根据 URI 定义的 http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn -URI-reference或空白节点http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-blank-node

RDF Triple 由三个部分组成:-
1) 主题
2)谓词
3)对象
例如:- Pranay 拥有法拉利汽车
这里的主语是 Pranay,hasCar 是谓语,Ferrari 是宾语。 这都是用 RDF-URI 定义的。 欲了解更多信息,您可以访问:- http://www.w3.org/TR/owl-参考/

One can think of a triple as a type of sentence that states a single "fact" about a resource. First of all to understand RDF Triple you should know that each and every thing in RDF is defined in terms of URI http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-URI-referenceor blank node http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-blank-node.

An RDF Triple consists of three components :-
1) Subject
2) Predicate
3) Object
For ex :- Pranay hasCar Ferrari
Here Subject is Pranay, hasCar is a predicate and Ferrari is a object. This are each defined with RDF-URI. For more information you can visit :- http://www.w3.org/TR/owl-ref/

月寒剑心 2024-07-15 17:46:17

通过示例进行三重解释

要有一个将用户和问题联系起来的表格。

TABLE dc:creator
-------------------------
| Question |   User     |
-------------------------
|    45    |   485527   |
|    44    |   485527   |
|    40    |   485528   |

从概念上讲,这可以用三个 RDF 三元组 来表达,例如......

<question:45> <dc:creator> <user:485527>
<question:44> <dc:creator> <user:485527>
<question:40> <dc:creator> <user:485528>

...这样每一行都会转换为一个将用户与问题相关联的三元组。 每个三元组的一般形式可以描述为:

。 <谓词>

RDF 的一个特点是,您可以(或必须)使用 用于识别 实体以及关系。 在此处查找更多信息。 这使得每个人都可以重用已经存在的关系(谓词)并发布有关的声明www 中任意实体

将 SO 答案与其创建者相关的示例:

<https://stackoverflow.com/a/49066324/1485527>   
<http://purl.org/dc/terms/creator> 
<https://stackoverflow.com/users/1485527>

Triple explained by example

Be there a table that relates users and questions.

TABLE dc:creator
-------------------------
| Question |   User     |
-------------------------
|    45    |   485527   |
|    44    |   485527   |
|    40    |   485528   |

This could conceptually be expressed in three RDF triples like...

<question:45> <dc:creator> <user:485527>
<question:44> <dc:creator> <user:485527>
<question:40> <dc:creator> <user:485528>

...so that each row is converted to one triple that relates a user to a question. The general form of each triple can be described as:

<Subject> <Predicate> <Object>

One specialty about RDF is, that you can (or must) use URIs/IRIs to identify entities as well as relations. Find more here. This makes it possible for everyone to reuse already existing relations (predicates) and to publish statements about arbitrary entities in the www.

Example relating a SO answer to its creator:

<https://stackoverflow.com/a/49066324/1485527>   
<http://purl.org/dc/terms/creator> 
<https://stackoverflow.com/users/1485527>
下雨或天晴 2024-07-15 17:46:17

作为一名开发人员,我挣扎了一段时间,直到我终于理解了 RDF 及其内容,主要是因为我一直通过代码而不是数据来看待世界。

鉴于此内容已发布在 StackOverflow 上,这里是最终让我感兴趣的 Java 类比:RDF 三元组用于数据类的方法/参数的编码内容。

因此:

  • 具有包名称的类是主题
  • 此类上的方法是谓词
  • 方法上的参数是对象,它们本身由类表示 上下文
  • 是导入语句,以避免编写类的完整规范

名称这个类比唯一不成立的一点是谓词也有命名空间,而方法没有。 但是,当使用谓词时,作为主语和客体的类实例之间创建的总体关系反映了调用方法来执行某些操作的想法。

基本上,RDF 之于数据就像 OO 之于编码。

As a developer, I have struggled for a while until I finally understood what RDF and its tripes was about, mostly because I have always seen the world through code and not through data.

Given this is posted on StackOverflow, here is the Java analogy that finally made it click for me: a RDF triple is to data what a class' method/parameter is to code.

So:

  • A class with its package name is the Subject
  • A method on this class is the Predicate
  • Parameter(s) on the method is the Object, which are themselves represented by classes
  • Contexts are import statements to avoid writing the full canonical name of classes

The only point where this analogy breaks down a bit is that Predicates also have namespaces, while methods do not. But the overall relationships created between class instances as Subject and Object when a Predicate is used reflects on the idea of calling a method to do something.

Basically, RDF is to data what OO is to code.

滿滿的愛 2024-07-15 17:46:17

看:
http://www.w3.org /TR/2004/REC-rdf-concepts-20040210/#dfn-rdf-triple

RDF 三元组包含三个组成部分:

  • 主语,它是 RDF URI 引用或空白节点
  • 谓语,它是 RDF URI 引用
  • 对象,它是 RDF URI 引用、文字或空白节点,

其中文字本质上是带有可选语言标签的字符串,
空白节点也是字符串。 URI、文字和空白节点必须
来自成对不相交的集合。

See:
http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-rdf-triple

An RDF triple contains three components:

  • the subject, which is an RDF URI reference or a blank node
  • the predicate, which is an RDF URI reference
  • the object, which is an RDF URI reference, a literal or a blank node

where literals are essentially strings with optional language tags,
and blank nodes are also strings. URIs, literals and blank nodes must
be from pair-wise disjoint sets.

愛放△進行李 2024-07-15 17:46:16

我认为这个问题需要分为两部分 - 什么是三元组以及是什么让“RDF 三元组”如此特别?

首先,正如这里的大多数其他评论者已经指出的那样,三元组是“主语/谓语/宾语”形式的陈述 - 即通过将一个对象(主语)链接到另一个对象(对象)或文字的陈述一个谓词。 我们都熟悉三元组:三元组是二元关系的最小不可约表示。 用简单的英语来说:电子表格是三元组的集合,例如,如果电子表格中的一列具有标题“Paul”,一行具有标题“has Sister”,并且单元格中的值为“Lisa”。 这里有一个三元组:Paul(主语)有 Sister(谓语)Lisa(字面/宾语)。

RDF 三元组的特殊之处在于,三元组的每个部分都有一个与之关联的 URI,因此日常陈述“Mike Smith 认识 John Doe”可能在 RDF 中表示为:

uri://people#MikeSmith12 http://xmlns.com/foaf/0.1/knows uri://people#JohnDoe45

与电子表格的类比是,通过给出URI 是一个唯一的地址,您可以为电子表格中的单元格提供其整个地址空间......因此原则上您可以将电子表格的每个单元格(如果以 RDF 三元组表示)粘贴到不同服务器上的不同文档中并重新构建电子表格通过单个查询。

编辑:
官方文档的这一部分解决了原来的问题。

I think the question needs to be split into two parts - what is a triple and what makes an "RDF triple" so special?

Firstly, a triple is, as most of the other commenters here have already pointed out, a statement in "subject/predicate/object" form - i.e. a statement linking one object (subject) to another object(object) or a literal, via a predicate. We are all familiar with triples: a triple is the smallest irreducible representation for binary relationship. In plain English: a spreadsheet is a collection of triples, for example, if a column in your spreadsheet has the heading "Paul" and a row has the heading "has Sister" and the value in the cell is "Lisa". Here you have a triple: Paul (subject) has Sister(predicate) Lisa (literal/object).

What makes RDF triples special is that EVERY PART of the triple has a URI associated with it, so the everyday statement "Mike Smith knows John Doe" might be represented in RDF as:

uri://people#MikeSmith12 http://xmlns.com/foaf/0.1/knows uri://people#JohnDoe45

The analogy to the spreadsheet is that by giving every part of the URI a unique address, you give the cell in the spreadsheet its whole address space....so you could in principle stick every cell (if expressed in RDF triples) of the spreadsheet into a different document on a different server and reconstitute the spreadsheet through a single query.

Edit:
This section of the official documentation addresses the original question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文