Open elf-pavlik opened 1 month ago
I don't have a clear idea of the expected interface. Hopefully, I will be able to come up with some options.
Here are a few things to keep in mind:
PUT
Link
HEAD
describedby
PATCH
An example of how I'm using it currently, blob is a File:
blob
File
const { ok } = await session.rawFetch(fileId, { method: 'PUT', headers: { 'Content-Type': blob.type }, body: blob }); const descriptionIri = await session.discoverDescription(fileId) const newFile = solidLdoDataset.usingType(FileShapeType) .fromSubject(fileId); const resource = solidLdoDataset.getResource(descriptionIri); const cFile = changeData(newFile, resource); cFile.fileName = blob.name cFile.format = blob.type const fileResult = await commitData(cFile)
Given shape
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX solidshapes: <http://localhost:3000/shapetrees/shapes/> PREFIX nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> PREFIX ma: <http://www.w3.org/ns/ma-ont#> solidshapes:File { nfo:fileName xsd:string ; ma:format xsd:string }
I always use opaque IRIs generated with randomUUID. I'm saving the original file name and using it when offering a download https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/download
randomUUID
I don't have a clear idea of the expected interface. Hopefully, I will be able to come up with some options.
Here are a few things to keep in mind:
PUT
doesn't include theLink
header, we needHEAD
to get thedescribedby
relation.PATCH
the description resource, not the subject resourceAn example of how I'm using it currently,
blob
is aFile
:Given shape
I always use opaque IRIs generated with
randomUUID
. I'm saving the original file name and using it when offering a download https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/download