# RDF

## Resource Description Framework

[Resource Description Framework (RDF)](https://www.w3.org/TR/rdf11-concepts/) is a framework for describing a resource, but describing the resource in a way that allows you to integrate with (i.e., “link to”) related data across the Web.

[RDF resource](https://docs.inrupt.com/glossary#rdf-resource) is a document/file whose contents consist of statements that describe a subject by its relationships and have the following form (also known as a triple):

```turtle
<subject> <predicate> <object> .
```

where:

* **`subject`** is the thing being described and is a URL.
* **`predicate`** is the descriptive property (e.g., name, height, size, etc.) of the thing and is a URL.
* **`object`** is the property value and is either a URL or a literal.

The predicate describes the relationship between the subject and the object. That is,

<figure><img src="https://2584838151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLMLxFYifBOpjrf8rQMX1%2Fuploads%2Fgit-blob-dc2a9e754f7096b7af3a679bed9af1254a576408%2FScreenshot%202025-07-21%20at%2019-04-41%20Data%20Modeling%20(RDF)%20%E2%80%94%20Inrupt%20Java%20Client%20Libraries.png?alt=media" alt=""><figcaption></figcaption></figure>

## Use of URLs

In RDF, the use of URLs allows for disambiguation of the terms:

* URLs provide global uniqueness.
* URLs can be looked up which can provide additional context (such as descriptions and additional information) and thereby may help reduce ambiguity.

For example, consider a Java class with a field named **`"title"`**. The string literal **`"title"`** may refer to a job title, an honorific (e.g., “Dr.”, etc.), a title of a book, etc. Determining which title definition applies depends on the context. The use of URLs can help address this ambiguity. For example:

* **`http://schema.org/title`** refers to a job title, and
* **`http://purl.org/dc/terms/title`** refers to a title of some resource (like a book, a course, etc.)

## Turtle

When expressing RDF triples in [Turtle (Terse RDF Triple Language) format](https://www.w3.org/TR/rdf11-primer/#section-turtle) :

* URLs are enclosed in angle brackets.
* Triple statements end with a period (**`.`**).

For example, the following statements are examples of Turtle:

```turtle
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense> <https://schema.org/provider> "Example Restaurant" .
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/purchaseDate>  "2023-03-07T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/provider>      "Example Restaurant" ;
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/description>   "Team Lunch";
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/category>      "Travel and Entertainment" ;
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/priceCurrency> "USD" ;
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/totalPrice>    "120"^^<http://www.w3.org/2001/XMLSchema#decimal> .
```

In Turtle, for statements with the same subject, you can avoid repeating the subject by combining the statements with a semicolon (**`;`**):

```turtle
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>
        <https://schema.org/purchaseDate>  "2023-03-07T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
        <https://schema.org/provider>      "Example Restaurant" ;
        <https://schema.org/description>   "Team Lunch";
        <https://schema.org/category>      "Travel and Entertainment" ;
        <https://schema.org/priceCurrency> "USD" ;
        <https://schema.org/totalPrice>    "120"^^<http://www.w3.org/2001/XMLSchema#decimal> .
```

For object values (can be a literal or a URL), you can append **`^^<URL of the data type>`** to the literal value to avoid ambiguity. For example, the following object value explicitly indicates that the value is a decimal and not a string or an integer literal.

```turtle
"120"^^<http://www.w3.org/2001/XMLSchema#decimal> .
```

## Additional Information

For more information on RDF and Turtle, see:

* [RDF 1.1 Primer: Triples](https://www.w3.org/TR/rdf11-primer/#section-triple).
* [RDF 1.1 Primer: Turtle format](https://www.w3.org/TR/rdf11-primer/#section-turtle).
