-
Notifications
You must be signed in to change notification settings - Fork 0
SolidDataset management using Inrupt
Imports from @inrupt/solid-client needed
- getSolidDataset
Using getSolidDataset(url, options?): Promise<SolidDataset & WithServerResourceInfo>
- url: URL to fetch a SolidDataset from.
- Returns a promise resolving to a SolidDataset containing the data at the given Resource, or rejecting if fetching it failed.
It can be used like await getSolidDataset(ListUrls, { fetch: fetch });
We can know if the path exists or not by checking a error is raised. If typeof error.statusCode === "number"
and error.statusCode === 404
, the path needs to be created.
Using
createSolidDataset(): SolidDataset
we can initialise a new SolidDataset in memory.
Imports from @inrupt/solid-client needed
- createThing
- addUrl
- addStringNoLocale
- setThing
Imports from @inrupt/vocab-common-rdf needed
- SCHEMA_INRUPT
- RDF
- AS
We can use this to add info to the Dataset.
createThing: Initialises a new Thing in memory with a given URL. We can give it a name with
name: "NameToGive"
addUrl: Create a new Thing with a URL added for a Property.
- thing: Thing to add a URL value to.
- property: Property for which to add the given URL value. It can be a string or a url.
- We can use
RDF.
to choose the format (value, JSON)
- value: It can be string or Url or Readonly<{}>.
- We can use the
AS.
and choose an property (Article, Document)
addStringNoLocale: Create a new Thing with an unlocalised string added for a Property.
- thing: Thing to add an unlocalised string value to.
- This will be the thing created before
- property: Property for which to add the given string value.
- With
SCHEMA_INRUPT.
we can choose the property to use.
- value: String to add to thing for the given property.
setThing: Insert a Thing into a SolidDataset, replacing previous instances of that Thing.
- solidDataset: The SolidDataset to insert a Thing into.
- thing: The Thing to insert into the given SolidDataset.
Imports from @inrupt/solid-client needed
- saveSolidDatasetAt
Using saveSolidDatasetAt<Dataset>(url, solidDataset, options?): Promise<Dataset & WithServerResourceInfo & WithChangeLog>
- url: URL to save solidDataset to.
- solidDataset: The SolidDataset to save. Returns a Promise resolving to a SolidDataset containing the stored data, or rejecting if saving it failed.
It can be used like await saveSolidDatasetAt(ListUrl, ReadingList,{ fetch: fetch } );