Deal with InstancesUploadEditor templating shortcomings #312
Labels
No labels
bug
config
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
orinoco/shacl-vue#312
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
https://github.com/psychoinformatics-de/datalad-concepts/pull/503 triggered this challenge.
The added annotation also required a different TTL template because here we are allowing upload on a slot with range
XYZDistribution, where previously the upload is on a slot with rangeXYZDocument.The context is a two-way linkage between a document and distribution. Up until now for a file upload, the
DocumentUploadTemplatettl file specified the creation of both a newXYZDocumentrecord and a newXYZDistributionrecord, and for linking them correctly. Since both of them were created in-place by the code that assesses the template, their PIDs are available in place and the two way linkage is straightforward.Now, for a file upload on the
distributionsslot of anXYZDocument, the new template should only specify the creation of aXYZDistributionrecord (because theXYZDocumentalready exists, or was just created, and is being edited) and the two-way linkage should still be done. The link fromXYZDocumenttoXYZDistributionviadistributionsfollows the normal process of form editing, nothing to update here. But the opposite link fromXYZDistributiontoXYZDocument(viadistribution_of) needs to be part of the TTL template step, which happens on successful file upload. There is no problem with also passing theXYZDocumentPID to the templating process, so that that link can be set on theXYZDistributionrecord when it is created from the template. The problem is that that might be an internal/temporary PID: internal if the open form is for a newXYZDocumentthat was just created, or temporary in case the user decides to change the PID of theXYZDocument. This means that, specifically upon form save, there would need to be an extra check for the correctness of the PID of thedistribution_ofslot of the createdDistribution.shacl-vuealready has a mechanism for registeringonSave,onCancel, and similar handlers for a form from any component. The challenge is that these handlers, for theInstancesUploadEditor, would need to be conditional on the type of TTL template being used and the existence or not of two-way linking slots.So this would have to somehow also come from config, otherwise some complicated interpreting logic needs to be added to the component itself. Perhaps that might be necessary either way...
I core part of why this is a challenge is that the
InstancesUploadEditorcreates the graph data (via the templating mechanism) on successful upload, as opposed to on form save. That is why it needs (currently and perhaps inadequately) accurate data inside the template.