What's a RDF triple?

Viewed 45538

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

14 Answers

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.

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:gcc-help@gcc.gnu.org> .
"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 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

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.

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)

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.

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/

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

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.

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.

Related