History:Work/Relationship Inheritance in Works Trees Proposal

From MusicBrainz Wiki
Revision as of 06:36, 1 November 2011 by JimDeLaHunt (talk | contribs) (Copy editing throughout, based on RFC discussion and IRC chat today.)


Status: This page describes an active style guideline proposal and is not official.



Proposal number: RFC-339
Champion: Jim DeLaHunt
Current status: RFC

RFC


MusicBrainz can represent metadata about musical compositions, and portions of those compositions, by using multiple Work entities linked together with "Parts" relationships. For instance, there is one Work entity for Beethoven's Symphony No. 9 in D minor, Op. 125 "Choral", and four more for each of its movements (I., II., III., IV.). A "Parts" relationship indicates that each movement's Work entity is a part of the Symphony's Work entity.

This structure of linked Work entities is referred to as a Work Tree. The Work entity which is not a part of any other Work is called the root. Any Work entity which has a linked Work entity as a part of it, is a parent Work entity. The linked Entity, part of the Parent, is a child Work entity. The ancestors of a Work entity are the Parent, and the Parent's Ancestors. Similarly, the descendants of a Work entity are the Children of the entity, and each Child's Descendants.

The MusicBrainz database represents the fact that a composer composed a musical work, by means of a Composer Relationship between the Artist entity for the composer and the Work entity for the composition. If this relationship is attached to the Work entity for part of the composition, that has a different meaning than attaching it to the Work entity for just one movement. The Parts Relationship Type sets up inheritance between the parent and child Work entities, so that a Relationship attached to one of the Work entities has a meaning about the other entity. The same applies for the other Relationships on Work entities.

Relationship Inheritance Rules

Given two Work entities, which we'll call Parent and Child, with a Parts Relationship Type saying "Child is a part of Parent", then the meaning of relationships to either Work entity (which are not Parts Relationship Type themselves) is as follows:

Indivisibility
Any relationship to Parent applies to the all of the composition to which Parent refers, and to any portion of it.
All of Child inherits from Parent
Any relationship to Parent, be it from an Artist, ReleaseGroup, Release, Label, URL, or Work (except for Work-Work Parts Relationship Type), means that the same relationship applies also to the entire portion of the musical composition to which Child refers, whether or not a corresponding relationship entry to Child is explicitly recorded.
Some of Parent inherits from Child
Any relationship to Child, be it from an Artist, ReleaseGroup, Release, Label, URL, or Work (except for Work-Work Parts Relationship Type), means that the same relationship applies to some non-zero portion, and maybe or maybe not all, of Parent, even if no corresponding relationship entry to Parent is explicitly recorded.
Siblings don't inherit
Given another Work entity, Child 2, which also has a Parts Relationship Type saying "Child 2 is a part of Parent", then any relationship to Child does not imply any meaning about that relationship and Child 2. Inheritance passes between parent and child, but not from one child to another of the same parent.
Inheritence is transitive
Given yet another Work entity, Grandchild, which has a Parts Relationship Type saying "Grandchild is a part of Child", then any relationship which Child inherits from Parent, Grandchild in turn inherits from Child (its parent). Any relationship which Child inherits from Grandchild (its own child), Parent in turn inherits from Child.

These rules cause inheritance for any between a Work and any other entity (Artist, ReleaseGroup, Release, Label, URL, or Work), except for the Parts Relationship Type (Work-Work). This relationship defines the parent-child structure, so it doesn't itself inherit.

Discussion

Software which reads the MusicBrainz database implements relationship inheritance for a Work entity in a Work Tree, by traversing the Parts Relationship Type links, and reporting which Relationships affect the starting Work entity. Some Relationships will be attached to the entity, some will be inherited from ancestors, some will be inherited from descendants. Some Relationships will apply to the whole Work entity, some will apply to just some portion (and maybe or maybe not all) of it. As of October 2011, MusicBrainz software does not implement these inheritance rules. However, it does similar link traversals in other contexts, e.g. to get the Recording artists for a Work entity.

The inheritance rules do not themselves dictate where to apply Relationships to Work entities in a Works Tree. Until MusicBrainz software implements inheritance rules, applying Relationships to the lowest Work entity in the tree has the advantage that current software is most likely to detect them. However, this means multiple Relationships need to be applied to multiple partial-work entities in the tree, with a chance that they will accidentally be different, or that some entities will be missed. Applying Relationships to the highest Work entity in a tree, where it still applies, has the advantage that relationships inherited to the lowest Works in the tree will be consistent and have complete coverage. It also has the advantage of lower data entry effort and lower storage requirements, though these are less important factors. However, until MusicBrainz software implements inheritance, they may be largely invisible.

The definitions for ancestors and descendants above are recursive. This kind of definition works well for some people, and for mathematicians and computer scientists. It can be brain-twisting for many people. Here's another way to express those definitions. The Ancestors of a Work entity in a Work Tree are: that entity's Parent, the Parent's Parent, and so on back to the Root entity of the work tree. The Root entity itself has zero Ancestors. The Descendants of a Work entity in a Work Tree are: all of that entities Children, and all of Children of the first Child, and all of Children of the second Child, and so on through all the entities Children, and all the Children's Children's Children, stopping at the final Work entities which themselves have no Children. Some entities in any Work Tree will have zero Descendants.

Examples

Suppose there is one Work entity for Beethoven's Symphony No. 9 in D minor, Op. 125 "Choral". (MusicBrainz has this entity, but we're embellishing it a little bit for this example.) There are four more Work entities for each of its movements (I..., II..., III..., and IV. Finale. Presto - Allegro assai). Each movement is linked to the parent Work entity for the Symphony by a Parts Relationship Type.

There is another Work entity 'Ode an die Freude' aus Sinfonie No. 9, Op. 125, and let's say it refers only to the part with the singing. It is linked to the IV. movement with a relationship, ... is a part of IV. Finale. Presto - Allegro assai.

This structure is a work tree. It has six linked Work entities. They Symphony's entity is the root. The entities for Movements I-IV are children of the root. The entity for Ode an die Freude is a child of the entity for Movement IV.

Let's say there is a Composer relationship of Ludwig van Beethoven to attached to the Root entity, Symphony No. 9 in D minor, Op. 125 "Choral". There is a Librettist relationship of Friedrich Schiller attached to IV. Finale. Presto - Allegro assai.

This structure conveys several meanings.

  • Each of the four movements has Composer relationship with Beethoven, even though they have no direct Composer relationship defined (All of Child inherits from Parent).
  • Beethoven is the Composer of every portion of every movement (All of Child inherits from Parent).
  • Schiller has the Librettist relationship with some portion, but maybe or maybe not all, of the overall Symphony No. 9 in D minor, Op. 125 "Choral" (Some of Parent inherits from Child)
  • Schiller does not have the Librettist relationship with movements I, II, and III (Siblings don't inherit)
  • Schiller has the Librettist relationship with the excerpt, 'Ode an die Freude' aus Sinfonie No. 9, Op. 125 (All of Child inherits from Parent).
  • If the Librettist relationship with Schiller were attached to the overall Symphony No. 9 in D minor, Op. 125 "Choral" instead of movement IV., then Schiller would have the Librettist relationship with movements I., II., and III. also (All of Child inherits from Parent). It turns out that these movements are entirely instrumental; they have no words. Whether it's meaningful for an instrumental movement to have a Librettist is a matter for Librettist Relationship Type, not here.
  • The excerpt 'Ode an die Freude' aus Sinfonie No. 9, Op. 125 has the Composer relationship with Beethoven (Inheritence is transitive).
  • If the Librettist relationship with Schiller were attached to the excerpt 'Ode an die Freude' aus Sinfonie No. 9, Op. 125, instead of to movement IV., then the Librettist relationship with the overall Symphony No. 9 in D minor, Op. 125 "Choral" would be unchanged: the Librettist relationship would be with some portion, but maybe or maybe not all, of the overall composition (Inheritence is transitive).

Without relationship inheritance, a search for Releases that had Recordings of performances of works composed by Beethoven wouldn't turn up many instances of the Symphony No. 9. Most Releases would put each movement of the symphony on a separate Track, and each Track would link to a corresponding Recording, and the Recording is most accurately linked to the child Work for the movement. But the Composer relationship for Beethoven is attached to the overall Symphony No. 9 work, not the child works for each movement. It is the relationship inheritance which connects the Release to the Composer, in this example.