mjordan / islandora_workbench

A command-line tool for managing content in an Islandora 2 repository
MIT License
24 stars 39 forks source link

Not an issue, just a thought. Similar to #111, perhaps #204

Open Digital-Grinnell opened 3 years ago

Digital-Grinnell commented 3 years ago

More from experience with IMI here...

One of the hurdles we had to address with IMI was how to get complex relations into our metadata, things like optional attributes. I managed to get something working by introducing some simple syntax rules and creating some TWIG subroutines to deal with it. The result is "documented" in a public gist at https://gist.github.com/McFateM/5921942b162cfa232683754763adc4ce, and lines 72 thru 112 deal with the syntax.

The TWIG doesn't mention this, but each field's permissible syntax is also reflected in the corresponding CSV column heading. So, for example, a column heading of Related_Items~Type^URI indicates that cells in that column represent related items with an optional type attribute, and an optional uri attribute. Personal_Names is plural so the field can be multi-valued. Example field contents might be:

Digital Grinnell ~ host ^ https://digital.grinnell.edu/ | Grinnell College ~ supporting host ^ https://grinnell.edu

Note that the documentation in my gist does not yet address the ^URI portion of the syntax.

This limited complexity wasn't too difficult to implement in TWIG, but I considered something more robust...never have implemented it. My plan was to introduce IMI-hook functions named "imi_Type" and another named "imi_URI" in this case. When ~Type was encountered in a column heading the "imi_Type" function would be called to process that portion of the field, and similarly the "imi_URI" function would be called to process elements corresponding to ^URI values.

mjordan commented 3 years ago

Interesting approach. I'll put some thought into how something like this might be applied to taxonomy fields.