Package com.inrupt.client.solid

package com.inrupt.client.solid

Support for Solid specific concepts for the Inrupt Java Client Libraries.

Solid Client

This Solid domain-specific module contains two dedicated Solid clients you can make use of: SolidClient which works asynchronously and SolidSyncClient which works synchronously.

One can instantiate a Solid client in different ways, depending on the use case:

A simple direct way is with the following line:

    SolidClient client = SolidClient.getClient();

This will make use of the client that is currently loaded on the classpath. (If you have the core module (inrupt-client-core) loaded, this will make use of the DefaultClient).

The above line is equivalent to:

    Client classPathClient = ClientProvider.getClient();
    SolidClient client = SolidClient.getClientBuilder().client(classPathClient).build();

The Solid client can be used to perform CRUD operations on Solid resources.

In this example, the client reads a Solid resource as a Playlist object.

    var playlist =, Playlist.class);
    playlist.thenAccept(p -> {

One may also create new resources.

    var playlist = new Playlist(uri);
    playlist.setTitle("Jazz Collection");


Or update existing resources.

    var playlist =, Playlist.class);

    playlist.thenCompose(p -> {
        p.setTitle("Bossa Nova");
        return client.update(p);

Or delete resources.


Solid RDFSource and Solid Container

This module also contains a BodyHandler which consumes the response body and converts it into a SolidRDFSource or a SolidContainer Java object.

The following example reads a Solid Container and presents it as a SolidContainer Java object:

        Request request = Request.newBuilder()
            .header("Accept", "text/turtle")

        Response<SolidContainer> response = client.send(
        System.out.println("HTTP status: " + response.statusCode());
        System.out.println("Resource URI: " + response.body().getId());