ontodev / valve.rs

A lightweight validation engine written in rust.
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Implement general apply operation, which is the inverse of export for messages, updates, etc. #20

Closed jamesaoverton closed 6 months ago

jamesaoverton commented 1 year ago

cogs apply takes a message table and "applies" it to the specified spreadsheet cells, adding comments (error messages) and formatting (e.g. red background for an error). Effectively, this is the opposite of our export operation (#19).

While it could sometimes be useful to apply a message table to a VALVE database, applying updates is the primary use case. I want to be able to:

  1. fetch an upstream dataset
  2. use VALVE to load it
  3. use Sprocket to edit it (usually a small percentage of cells), see #18
  4. export an updates.tsv that I can store in version control
  5. delete my VALVE database
  6. use VALVE to reload the dataset and apply updates.tsv

Then the result of (6) should be the same as the result of (3). This fixes a serious problem I regularly face, where I want to make some changes to an upstream dataset, but keep careful track of those changes so I can apply them again. I might want to send the updates.tsv to the owner of the upstream dataset.

I would also be like to fetch an updated version of the original dataset and apply my updates. Depending on how the upstream data has changed, the updates might not apply cleanly anymore. We'll consider that problem later.

There are obvious similarities to diff/patch, but specialized for tables. My favourite tool for general table diff is daff, but I think that I'm asking for something different here. In this issue I am not considering adding or deleting rows or columns, just updating cells. Full generality seems like a much harder problem.