list-treeCRUD Module

Both SolidSyncClientarrow-up-right and SolidClientarrow-up-right provide methods for reading and writing resources to your Solid Pod; that is, performing create/read/update/delete (CRUD) operations. The resources can be RDF resources as well as non-RDF resources (such as .jpg, .pdf, .txt, .json files).

SolidClient

SolidClientarrow-up-right is an asynchronous client for interacting with Solid resources.

SolidClient client = SolidClient.getClient();

For an authenticated client, pass the authenticated Session object to the client:

client.session(mySession);

See also:

.create()

SolidClient.create()arrow-up-right creates a new resource (SolidRDFSourcearrow-up-right, SolidContainerarrow-up-right, and SolidNonRDFSourcearrow-up-right) at the specified location in your Pod.

For example, assume an Expense class that extends SolidRDFSourcearrow-up-right. To save an Expense object to a Pod, pass the object to the method:

client.create(newExpense).toCompletableFuture().join();
circle-exclamation

.read()

SolidClient.read()arrow-up-right reads a resource from your Pod and map to a specified class.

For example, assume an Expense class that extends SolidRDFSourcearrow-up-right. To read the Expense resource from a Pod, pass the resource’s identifier (i.e., its URI) and the class:

.update()

SolidClient.update()arrow-up-right updates a resource in your Pod.

  • If the resource does not exist at the location, creates a new resource.

  • If the resource already exists at the location, overwrites the resource.

For example, assume an Expense class that extends SolidRDFSourcearrow-up-right. To update (or create) an Expense resource in a Pod, pass the object to the method:

.delete()

SolidClient.delete()arrow-up-right deletes a resource from your Pod.

  • You can specify the URL of the resource to delete:

or

circle-info

To delete a SolidContainer, the SolidContainer must be empty.

SolidSyncClient

SolidSyncClientarrow-up-right is a synchronous client for interacting with Solid resources.

For an authenticated client, pass the authenticated Session object to the client:

.create()

SolidSyncClient.create()arrow-up-right creates a new resource (SolidRDFSourcearrow-up-right, SolidContainerarrow-up-right, and SolidNonRDFSourcearrow-up-right) at the specified location in your Pod.

For example, assume an Expense class that extends SolidRDFSourcearrow-up-right. To save an Expense object to a Pod, pass the object to the method:

circle-info
  • If any container in the location path does not exist, the method creates the missing containers as well as the resource.

  • If the resource already exists at the location, the operation errors with PreconditionFailedException. Use .update() instead.

.read()

SolidSyncClient.read()arrow-up-right reads a resource from your Pod and map to a specified class.

or example, assume an Expense class that extends SolidRDFSourcearrow-up-right. To read the Expense resource from a Pod, pass the resource’s identifier (i.e., its URI) and the class:

.update()

SolidSyncClient.update()arrow-up-right updates a resource in your Pod.

  • If the resource does not exist at the location, it creates a new resource.

  • If the resource already exists at the location, it overwrites the resource.

For example, assume a Expense class that extends SolidRDFSourcearrow-up-right. To update (or create) an Expense resource in a Pod, pass the object to the method:

.delete()

SolidSyncClient.delete()arrow-up-right deletes a resource from your Pod.

  • You can specify the URL of the resource to delete:

or

circle-info

To delete a SolidContainer, the SolidContainer must be empty.

Headers

You can use the resource class’ getHeaders() method to get the headers:

See also Headers.

Alternatively, you can also use the resource class’ getMetadata() methods:

The getMetadata() methods return Solid-specific data (parsed into Java types) from a resource’s response headers. To access the complete set of response headers, use the getHeaders() method.

Last updated