# Tutorial

The tutorial in this section creates a Spring Boot personal (i.e., single-user) Web service on **`http://localhost:8080`** that uses Inrupt’s Java client library to:

* Read the Pod URLs associated with the user’s [WebID](/reference/glossary.md#webid).
* Store and manage expense records in the user’s Pod. The expense records are stored as [Resource Description Framework (RDF) resource](/reference/glossary.md#rdf-resource).

{% hint style="info" %}
The locally-run personal Web service uses the [Client Credentials](https://www.rfc-editor.org/rfc/rfc6749) flow; that is, the service logs in with its credentials on behalf of the user who registered the client.
{% endhint %}

For this part of the tutorial, an expense record (with date, description, provider, amount, currency, category information) is stored as a file in the Pod with the following structure and sample values (shown in Turtle):

```turtle
<https://storage.example.com/{rootContainer}/expenses/20230306/teamLunchExpense>
    <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> &#x3C;https://schema.org/Invoice> ;
    <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> .
```

{% hint style="info" %}

* The **`subject`** and the **`predicates`** are URLs.
* The **`object`** may be URLs or literals.
  {% endhint %}

Attach a receipt to the expense:

* Store the receipt (as a non-RDF **`.png`** , **`.pdf`** , or **`.jpeg`** file) to the user’s Pod.
* Update the the Expense resource by adding a link to the saved receipt file.

```turtle
 <https://storage.example.com/{rootContainer}/expenses/20230306/teamLunchExpense>
     <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://schema.org/Invoice> ;
     <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> ;
    <strong> <https://schema.org/image>     <https://storage.example.com/{rootContainer}/expenses/20230306/teamLunchExpense_somerandomsuffix.jpg> .
```


---

# 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/sdk/java-sdk/tutorial.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.
