# 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](/reference/glossary.md#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="/files/trIGvZAkyawmoUbHkVEI" 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).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inrupt.com/reference/rdf.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
