Step 5: Add receipt.png

You can use the Java Client Libraries to save non-RDF resources (e.g., .png , .pdf ) to your Pod.

For this part of the tutorial, the getting started app uses Inrupt’s Java client library to:

  • Store a copy of the expense receipts to your Pod.

  • Update the associated expense to link to the URLs of the receipts.

You can find the complete code at Complete Code.

Update application.properties

Add the following properties to the src/main/resources/application.properties file:

spring.servlet.multipart.max-file-size=128KB
spring.servlet.multipart.max-request-size=128KB

Modify Expense Class

  1. Open Expense class file:

Open src/main/java/com/example/gettingstarted/Expense.java

  1. Add the java.util.* import statement:

import java.util.*;
  1. Add the predicate definition for the receipts in the Expense class:

static IRI SCHEMA_ORG_IMAGE = rdf.createIRI("https://schema.org/image");
  1. Update the Expense class constructor to include the receipts:

  1. Add the getter and setters for the receipts in the Expense class:

  1. Add getter for the receipts in the inner Node class:

Modify ExpenseController Class

  1. Open ExpenseController class file.

Open src/main/java/com/example/gettingstarted/ExpenseController.java

  1. Add the following import statements:

  1. Add the following method to handle the upload of non-RDF files:

  1. Add the following method that uploads a receipt file and links it to the associated Expense.

Last updated