Class | MusicBrainz::Model::Relation |
In: |
lib/rbrainz/model/relation.rb
|
Parent: | Object |
Represents a relation between two Entities.
There may be an arbitrary number of relations between all first class objects in MusicBrainz. The Relation itself has multiple attributes, which may or may not be used for a given relation type.
Note that a Relation object only contains the target but not the source end of the relation.
TODO: | Add some examples. |
DIR_BACKWARD | = | :backward | Relation reading direction is from target to source. | |
DIR_FORWARD | = | :forward | Relation reading direction is from source to target. | |
DIR_BOTH | = | :both | Relation reading direction doesn‘t matter. | |
TO_ARTIST | = | NS_REL_1 + 'Artist' | Identifies relations linking to an artist. | |
TO_RELEASE | = | NS_REL_1 + 'Release' | Identifies relations linking to a release. | |
TO_TRACK | = | NS_REL_1 + 'Track' | Identifies relations linking to a track. | |
TO_LABEL | = | NS_REL_1 + 'Label' | Identifies relations linking to a label. | |
TO_URL | = | NS_REL_1 + 'Url' | Identifies relations linking to an URL. |
attributes | [R] |
The list of attributes describing this relation.
The attributes permitted depend on the relation type. |
begin_date | [R] |
The begin date.
The definition depends on the relation‘s type. It may for example be the day of a marriage or the year an artist joined a band. For other relation types this may be undefined. |
direction | [RW] |
The reading direction.
The direction may be one of DIR_FORWARD, DIR_BACKWARD, or DIR_BOTH, depending on how the relation should be read. For example, if direction is DIR_FORWARD for a cover relation, it is read as "X is a cover of Y". Some relations are bidirectional, like marriages. In these cases, the direction is Relation.DIR_BOTH. |
end_date | [R] |
The end date.
As with the begin date, the definition depends on the relation‘s type. Depending on the relation type, this may or may not be defined. |
target | [R] |
The relation‘s target object.
The target can either be an object of the type Model::Entity or a URL if the type of the relation is TO_URL. |
type | [RW] | The relation‘s type. |
Set the begin date of this relation to date.
Should be an IncompleteDate object or a date string, which will get converted into an IncompleteDate.
Set the end date of this relation to date.
Should be an IncompleteDate object or a date string, which will get converted into an IncompleteDate.
Set the target of this relation.
The target can either be an object of the type Model::Entity or a URL if the type of the relation is TO_URL.