> For the complete documentation index, see [llms.txt](https://relationlabs.gitbook.io/protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://relationlabs.gitbook.io/protocol/key-concepts/rdf.md).

# RDF

[RDF (Resource Description Framework)](https://www.w3.org/RDF/) is a semantic standard used to describe structured knowledge, which is an international standard published by W3C for knowledge graph. It is a logical and well-developed data model.

The social data in Relation Protocol is written following the RDF standard, including:

## [Graph data model](https://www.w3.org/TR/rdf-concepts/#section-data-model)

> The underlying structure of any expression in RDF is a collection of triples, each consisting of a subject, a predicate and an object. A set of such triples is called an RDF graph (defined more formally in section 6). This can be illustrated by a node and directed-arc diagram, in which each triple is represented as a node-arc-node link (hence the term "graph").

<figure><img src="/files/QnOwqObN8QDcsWHEqXoQ" alt=""><figcaption><p>Figure 2-1 RDF triples</p></figcaption></figure>

> Each triple represents a statement of a relationship between the things denoted by the nodes that it links. Each triple has three parts:
>
> 1. a [subject](https://www.w3.org/TR/rdf-concepts/#dfn-subject),
> 2. an [object](https://www.w3.org/TR/rdf-concepts/#dfn-object), and
> 3. a [predicate](https://www.w3.org/TR/rdf-concepts/#dfn-predicate) (also called a [property](https://www.w3.org/TR/rdf-concepts/#dfn-property)) that denotes a relationship.
>
> The direction of the arc is significant: it always points toward the object.

## [RDF Schema](https://www.w3.org/TR/rdf-schema/#ch_introduction)

> RDF Schema provides a data-modelling vocabulary for RDF data.
>
> The RDF Schema class and property system is similar to the type systems of object-oriented programming languages such as Java.

## [RDF triples](https://www.w3.org/TR/rdf-concepts/#section-triples)

> An RDF triple contains three components:
>
> * the subject, which is an [RDF URI reference](https://www.w3.org/TR/rdf-concepts/#dfn-URI-reference) or a [blank node](https://www.w3.org/TR/rdf-concepts/#dfn-blank-node)
> * the predicate, which is an [RDF URI reference](https://www.w3.org/TR/rdf-concepts/#dfn-URI-reference)
> * the object, which is an [RDF URI reference](https://www.w3.org/TR/rdf-concepts/#dfn-URI-reference), a [literal](https://www.w3.org/TR/rdf-concepts/#dfn-literal) or a [blank node](https://www.w3.org/TR/rdf-concepts/#dfn-blank-node)
>
> An RDF triple is conventionally written in the order subject, predicate, object.
>
> The predicate is also known as the property of the triple.

## [RDF graph](https://www.w3.org/TR/rdf-concepts/#section-rdf-graph)

> An RDF graph is a set of RDF triples.
>
> The set of nodes of an RDF graph is the set of subjects and objects of triples in the graph.

## For example

Alice follow Bob, described by RDF is:

```sparql
<http://relationlabs.ai/entity/Alice> <http://relationlabs.ai/property/follow> <http://relationlabs.ai/entity/Bob> .
```

<figure><img src="/files/Wkr2na0xp2IT6o1rQBiI" alt=""><figcaption><p>Figure 2-2 Follow graph</p></figcaption></figure>

## References

* <https://www.w3.org/TR/rdf-schema/>
* <https://www.w3.org/TR/rdf-concepts/>
