Home | Trees | Index | Help |
---|
Package musicbrainz2 :: Module model :: Class Relation |
|
object
--+
|
Relation
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 aRelation
object only contains the target
but not the source end of the relation.
To Do: Add some examples.
Method Summary | |
---|---|
Constructor. | |
Adds an attribute to the list. | |
Returns a list of attributes describing this relation. | |
Returns the begin date. | |
Returns the reading direction. | |
Returns the end date. | |
Returns this relation's target object. | |
Returns the target's ID. | |
Returns the target's type. | |
Returns this relation's type. | |
Sets the begin date. | |
Sets the reading direction. | |
Sets the end date. | |
Sets this relation's target object. | |
Sets the target's ID. | |
Sets the target's type. | |
Sets this relation's type. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Property Summary | |
---|---|
attributes : The list of attributes describing this relation. | |
beginDate : The begin date. | |
direction : The reading direction. | |
endDate : The end date. | |
target : The relation's target object. | |
targetId : The type of target this relation points to. | |
type : The relation's type. |
Class Variable Summary | |
---|---|
str |
DIR_BACKWARD : Relation reading direction is from target to source. |
str |
DIR_BOTH : Relation reading direction doesn't matter. |
str |
DIR_FORWARD : Relation reading direction is from source to target. |
str |
TO_ARTIST : Identifies relations linking to an artist. |
str |
TO_RELEASE : Identifies relations linking to a release. |
str |
TO_TRACK : Identifies relations linking to a track. |
str |
TO_URL : Identifies relations linking to an URL. |
Method Details |
---|
__init__(self,
relationType=None,
targetType=None,
targetId=None,
direction='both',
attributes=None,
beginDate=None,
endDate=None,
target=None)
Constructor.
|
addAttribute(self, attribute)Adds an attribute to the list.
|
getAttributes(self)Returns a list of attributes describing this relation. The attributes permitted depend on the relation type.
|
getBeginDate(self)Returns 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.
|
getDirection(self)Returns the reading direction. The direction may be one ofRelation.DIR_FORWARD , Relation.DIR_BACKWARD , or Relation.DIR_BOTH , depending on how the
relation should be read. For example, if direction is Relation.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 .
|
getEndDate(self)Returns 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.
|
getTarget(self)Returns this relation's target object. Note that URL relations never have a target object. Use thegetTargetId method to get the URL.
|
getTargetId(self)Returns the target's ID. This is the ID the relation points to. It is an absolute URI, and in case of an URL relation, it is a URL.
|
getTargetType(self)Returns the target's type. For MusicBrainz data, the following target types are defined:
|
getType(self)Returns this relation's type.
|
setBeginDate(self, dateStr)Sets the begin date.
|
setDirection(self, direction)Sets the reading direction.
|
setEndDate(self, dateStr)Sets the end date.
|
setTarget(self, target)Sets this relation's target object. Note that URL relations never have a target object, they are set usingsetTargetId .
|
setTargetId(self, targetId)Sets the target's ID.
|
setTargetType(self, targetType)Sets the target's type.
|
setType(self, type_)Sets this relation's type.
|
Property Details |
---|
attributesThe list of attributes describing this relation.
|
beginDateThe begin date.
|
directionThe reading direction.
|
endDateThe end date.
|
targetThe relation's target object. |
targetIdThe type of target this relation points to.
|
typeThe relation's type. |
Class Variable Details |
---|
DIR_BACKWARDRelation reading direction is from target to source.
|
DIR_BOTHRelation reading direction doesn't matter.
|
DIR_FORWARDRelation reading direction is from source to target.
|
TO_ARTISTIdentifies relations linking to an artist.
|
TO_RELEASEIdentifies relations linking to a release.
|
TO_TRACKIdentifies relations linking to a track.
|
TO_URLIdentifies relations linking to an URL.
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Wed Dec 20 18:19:28 2006 | http://epydoc.sf.net |