Pod Resources#
Solid Pods are data storage locations. Pods can store different types of resources:
Container (An RDF resource that can contain other resources)
Resource Description Framework (RDF) Resource#
RDF resource is a document/file whose contents consists of statements that have the following form (also known as a triple):
<subject> <predicate> <object>
where:
subject is the thing being described and is a URI.
predicate is the descriptive property (e.g., name, height, size, etc.) of the thing and is a URI.
object is the property value and is either a URI or a literal.
The predicate describes the relationship between the subject and the object.
SolidRDFSource
#
The SolidRDFSource class maps to an RDF resource stored or to be stored in a Solid Pod. [1]
A summary of parameters to the SolidRDFSource class constructors are as follows:
Field |
Type |
Description |
---|---|---|
|
The URI (Uniform Resource Identifier) of the resource. |
|
|
The RDF dataset (i.e., the set(s) of triples) contained in the resource. |
|
|
Collection of HTTP headers. |
To instantiate, specify the identifier (i.e., the URI) for the resource:
// Locally instantiate a new resource
SolidRDFSource newResource = new SolidRDFSource(
URI.create("https://pod.example.com/resource/path")); // identifier
Optionally, you can also initialize the resource data during instantiation by including an RDF dataset:
// Locally instantiate a new resource with initial RDF Dataset
SolidRDFSource newResourcePopulated = new SolidRDFSource(
URI.create("https://pod.example.com/resource/path"), // identifier
initialDataset); // dataset
You can extended the SolidRDFSource class to model a POJO (Plain Old Java Object) class as an RDF resources. See Data Modeling (RDF) and Modeling an RDF Resource for information on modeling POJOs as RDF resources.
Class Methods#
You can:
Use the SolidRDFSource class methods to directly interact with local SolidRDFSource object’s dataset or
Or, if you have extended the class to model a POJO (Plain Old Java Object) class as an RDF resources, use that class methods/members.
public class Expense extends SolidRDFSource { // ... }
Read/Write to Pod#
To read RDF resources from your Pod or write RDF resources to your Pod (i.e., CRUD operations), the library provides SolidSyncClient and SolidClient classes. See CRUD for details.
Tip
When saving a new resource to a Pod (e.g.,
https://pod.example.com/container1/container2/resource
), if any
Container in the resource path does not exist (e.g., container1/
and container2/
), the SolidSyncClient.create() and
SolidClient.create() methods creates the missing containers as well.
For the CRUD operation response headers, you can use SolidRDFSource.getHeaders(). See Appendix: Headers.
Container#
A Container is an RDF resource that can contain other RDF (including other Containers) and non-RDF resources. A Container is analogous to a folder in a file system.
Important
Container URIs always end with a slash /
.
SolidContainer
#
The SolidContainer class maps to a Container stored or to be stored in a Solid Pod. [1] The SolidContainer class extends SolidRDFSource.
To instantiate, specify the destination URI for the Container.
Container URIs always end with a slash /
.
// Locally instantiate a new Container.
// Container URIs ends with a slash "/"
SolidContainer newResource = new SolidContainer(
URI.create("https://pod.example.com/container/path/"));
Class Methods#
You can use SolidContainer class methods to interact with a Container directly. For example, to retrieve all contained resources within a Container, you can use getResources.
Read/Write to Pod#
To read Containers from your Pod or write Containers to your Pod (i.e., CRUD operations), the library provides SolidSyncClient and SolidClient classes.
Tip
Although you can instantiate and save a SolidContainer by itself, when creating a resource to a Pod (e.g.,
https://pod.example.com/container1/container2/resource
), if any Container in the location path does not exist (e.g.,container1/
andcontainer2/
), the SolidSyncClient.create() and SolidClient.create() methods creates the missing containers as well as the resource.To delete a Container, the Container must be empty.
For the CRUD operation response headers, you can use SolidContainer.getHeaders(). See Appendix: Headers.
Non-RDF Resource#
A non-RDF Resource is any non-RDF binary or text file, such as
.pdf
, .jpeg
, etc.
SolidNonRDFSource
#
The SolidNonRDFSource class maps to a non-RDF resources stored or to be stored in a Solid Pod. [1]
A summary of parameters to the SolidNonRDFSource class constructors are as follows:
Field |
Type |
Description |
---|---|---|
|
The URI (Uniform Resource Identifier) of the resource. |
|
|
The MIME type for the file. |
|
|
Input stream of the file content. |
To instantiate, specify the identifier (i.e., the URI), the content
type (i.e., MIME type), and the input stream for the resource. For
example, the following instantiates a SolidNonRDFSource for a .jpg
file:
MultipartFile file = //... Some .jpg file
// Locally instantiate a new SolidNonRDFSource.
SolidNonRDFSource newNonRDFSource = new SolidNonRDFSource(
URI.create("https://pod.example.com/container1/somePic.jpg"), // identifier
file.getContentType(), // MIME type
file.getInputStream()); // InputStream
Read/Write to Pod#
To read non-RDF resources from your Pod or write non-RDF resources to your Pod (i.e., CRUD operations), the library provides SolidSyncClient and SolidClient classes. See CRUD for details.
Tip
When saving a new resource to a Pod (e.g.,
https://pod.example.com/container1/container2/somePic.jpg
), if any
Container in the resource path does not exist (e.g., container1/
and container2/
), the SolidSyncClient.create() and
SolidClient.create() methods creates the missing containers as well.
For the CRUD operation response headers, you can use SolidNonRDFSource.getHeaders(). See Appendix: Headers.