@beepsoft I'm thinking about putting this in for my app which is more around cultural collection management. It doesn't have to be in the crate-builder / profile layer (I could just do it in my app) but I think it could be generally useful. What do you think? Does the proposed implementation make sense?
To link one entity to another we define a forward looking relationship in the profile, viz:
File : keywords -> DefinedTerm
This gives us a link from the keywords prop on a File to a Defined Term.
However, when we look at the term, we don't have a forward looking link from it back to the file, viz:
DefinedTerm : appliesTo -> File
We can get that association by looking at the @reverse links but that, semantically, doesn't mean as much as having a definite forward looking association.
So, it would be nice for a profile to be able to define a set of associations to be created automatically, ala:
{
metadata: {},
reverseMappings: [
{ property: 'keywords', reverse: 'appliesTo' },
{ property: 'memberOf', reverse: 'hasMember' },
...
],
resolve: {},
...
}
Then, whenever an association is made from the keywords
prop on any entity to another entity, the reverse will automatically be created by describo. That is, the target entity will get an appliesTo
property linking back to the original entity.
When unlinking an entity from a property, if reverseMappings is defined, then both links should be removed.
If this configuration is not found in the profile then nothing happens.