Hello everyone, here is the problem I came across.
- End goal:
I want my things to be stored within a specified folder in separate files. And then I want to able to easily fetch them from the user’s POD in a single fetch call. - Here is the story so far:
I use the @inrupt/solid-client library, here is how I create a folder:
createContainerAt(notesFolder, {
fetch: fetch
});
This would create a container where I store my files.
Next I save files in this container, using the following method:
I first fetch the dataset:
let dataSet = await getSolidDataset(notesFolder, {
fetch: fetch
});
Then I build a Thing:
const newNote = buildThing(createThing({ url: `${notesFolder}${id}.ttl`})).addUrl(RDF.type, schema.TextDigitalDocument)
.addStringNoLocale(DCTERMS.title, note.title)
.addStringNoLocale(schema.text, note.content)
.addInteger(schema.identifier, id)
.build();
Then I set this thing in a data set I fetched before and call save in container function:
dataSet = setThing(dataSet, newNote);
const updDataSet = saveSolidDatasetInContainer(noteUrl, dataSet, { fetch: fetch });
This is how a resulting file looks like in a user’s POD:
this is how the container folder looks like:
when I try to fetch the files as an array (there will be many files like this)
this is how I fetch them:
let dataSet = await getSolidDataset("https://pod.inrupt.com/ayazdyshin/SolidPlannerApp/notes/", { fetch: fetch });
let allThings = getThingAll(dataSet);
Now, in this array of things, the first thing would be container itself, and the second thing would be the note that I want to fetch.
this is how the note thing looks like if output it to the console:
Now here is where the problem comes:
If I try to get one of the values, from this note, I get null, for example:
console.log(getInteger(allThings[1], "http://schema.org/identifier"));
console.log(getStringNoLocale(allThings[1], "http://schema.org/text"));
Both would result in a null.
I would really appreciate any help as I am completely lost in this.
Thank you in advance