Bi-directional metainfo references
Bi-directional references allow to reference a target from a source manually and automatically create a back reference from the target to the source. This requested in one way or the other multiple people (@sbrueck, @aalbino, Michael). For example, it would allow to connect samples with processes and allow to track the processes for a sample and vice versa even if these are designed to be in different NOMAD entries. Similar examples would sample-experiment, sample-chemical, experiment-instrument, etc.
On a definition level this would mean we either pair two references to create on bi-directional one, or we mark a reference as bi-directional.
On the data level, adding a reference to a target section on a source section requires to change the target section (i.e. add a back references). Doing this for intra-archive references is easy. For inter-archive references this would be very hard. Changing a target section technically would require the re-processing of the target entry. If you think this further, you'll quickly realise the mess this would create.
I propose another solution: virtual back-references. Here, we do not create an explicit back-reference. On the definition level, we mark a reference as bi-directional with an additional quantity property with_reverse_ref
. When normalising an archive, we look for all with_reverse_ref
quantities and add reverse_ref
sub-sections to the metadata
section. These is indexed in elasticsearch. ReverseRef
would contain quantities identifying the source section, the source entry, and the reference definition. With the right searches, it now becomes easy to get the virtual back-references for a given target and reference definition.