Advanced Relationship Attribute Syntax: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
m (4 revision(s))
No edit summary
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{DocumentationHeader|AdvancedRelationship}}

=Syntax for AdvancedRelationship Attributes=

==Defining Attributes==
==Defining Attributes==


[[Relationship Editor|RelationshipEditor]]<code><nowiki></nowiki></code>s can specify [[Advanced Relationship Attribute|AdvancedRelationshipAttribute]]<code><nowiki></nowiki></code>s in the "Edit Rel.Types" menu ([http://musicbrainz.org/edit/relationships/link_attrs.html http://musicbrainz.org/edit/relationships/link_attrs.html]).
[[Relationship Editor]]s can specify [[:Category:Relationship Attribute|Advanced Relationship Attributes]] in the "Edit Rel.Types" menu ([http://musicbrainz.org/edit/relationships/link_attrs.html http://musicbrainz.org/edit/relationships/link_attrs.html]).


The list starts with a "ROOT" node which cannot be edited, but you can add new sub-nodes to that node.
The list starts with a "ROOT" node which cannot be edited, but you can add new sub-nodes to that node.
* Nodes that have no children will be yes/no attributes. Those are displayed as checkboxes when a user edits an [[Advanced Relationship|AdvancedRelationship]].
* Nodes that have no children will be yes/no attributes. Those are displayed as checkboxes when a user edits a [[:Category:Relationship Type|Relationship Type]].
* Nodes which have one (two???) or more children will be drop-down attributes. Those are displayed as drop down boxes.
* Nodes which have one (two???) or more children will be drop-down attributes. Those are displayed as drop down boxes.


==Adding Attributes to Relationship Types==
==Adding Attributes to Relationship Types==


When editing an [[Advanced Relationship Type|AdvancedRelationshipType]], all existing attributes are presented. Each one has
When editing an [[:Category:Relationship Type|Advanced Relationship Type]], all existing attributes are presented. Each one has:
* A checkbox to enable the attribute for that relationship type.
* A "Min." and a "Max" value.
<ul><li style="list-style-type:none">These values specify how often the attribute can be selected:
* choose 0-1 for an optional attribute
* choose 1-1 for a compulsory attribute
* choose a higher number if you want people to select multiple values (this only really makes sense for drop-down attributes).
</ul>


* a checkbox to enable the attribute for that relationship type.
Please [[Answer Me|AnswerMe]]: What happens if the Min. or Max fields are left empty?
* a "Min." and a "Max." value.
** These values specify how often the attribute can be selected:
*** Choose 0-1 for an optional attribute.
*** Choose 1-1 for a compulsory attribute.
*** Choose a higher number if you want people to select multiple values. (This only really makes sense for drop-down attributes.)


==Displaying Attributes==
==Displaying Attributes==


[[Advanced Relationship Attribute|AdvancedRelationshipAttribute]] are displayed in the link phrases on the server using the following syntax:
[[:Category:Relationship Attribute|Advanced Relationship Attributes]] are displayed in the link phrases on the server using the following syntax:

* <code><nowiki>{</nowiki></code>''<attribute>''<code><nowiki>}</nowiki></code>
* <code><nowiki>{</nowiki></code>''<attribute>''<code><nowiki>}</nowiki></code>
<ul><li style="list-style-type:none">Displays the value ''<attribute>'' is set to.
** Displays the value ''<attribute>'' is set to.
</ul>

* <code><nowiki>{</nowiki></code>''<attribute>''<code><nowiki>: </nowiki></code>''<text>''<code><nowiki>}</nowiki></code>
* <code><nowiki>{</nowiki></code>''<attribute>''<code><nowiki>: </nowiki></code>''<text>''<code><nowiki>}</nowiki></code>
<ul><li style="list-style-type:none">Displays ''<text>'' if ''<attribute>'' is set.
** Displays ''<text>'' if ''<attribute>'' is set.
</ul>

* <code><nowiki>{</nowiki></code>''<attribute>''<code><nowiki>: </nowiki></code>''<truetext>''<code><nowiki>|</nowiki></code>''<falsetext>''<code><nowiki>}</nowiki></code>
* <code><nowiki>{</nowiki></code>''<attribute>''<code><nowiki>: </nowiki></code>''<truetext>''<code><nowiki>|</nowiki></code>''<falsetext>''<code><nowiki>}</nowiki></code>
<ul><li style="list-style-type:none">Displays ''<truetext>'' if ''<attribute>'' is set, else it displays ''<falsetext>''.
** Displays ''<truetext>'' if ''<attribute>'' is set, else it displays ''<falsetext>''.
</ul>All texts can contain a percent sign (<code><nowiki>%</nowiki></code>) which will be replaced by the value the attribute is set to.

All texts can contain a percent sign (<code><nowiki>%</nowiki></code>) which will be replaced by the value the attribute is set to.


====Example====
===Example===


<pre>{instrument:has %|was} {additional:additionally} arranged by
<pre>{instrument:has %|was} {additional:additionally} arranged by</pre>
</pre>


Instrument is a drop-down attribute, additional is a yes/no attribute. Thus it would result in "has Violins arranged by" or "was additionally arranged by".
Instrument is a drop-down attribute, additional is a yes/no attribute. Thus it would result in "has Violins arranged by" or "was additionally arranged by".


[[Category:To Be Reviewed]] [[Category:Advanced Relationships]] [[Category:Server]]
[[Category:Relationships]] [[Category:To Be Reviewed]] [[Category:Server]]

Latest revision as of 16:06, 26 May 2015

Defining Attributes

Relationship Editors can specify Advanced Relationship Attributes in the "Edit Rel.Types" menu (http://musicbrainz.org/edit/relationships/link_attrs.html).

The list starts with a "ROOT" node which cannot be edited, but you can add new sub-nodes to that node.

  • Nodes that have no children will be yes/no attributes. Those are displayed as checkboxes when a user edits a Relationship Type.
  • Nodes which have one (two???) or more children will be drop-down attributes. Those are displayed as drop down boxes.

Adding Attributes to Relationship Types

When editing an Advanced Relationship Type, all existing attributes are presented. Each one has:

  • a checkbox to enable the attribute for that relationship type.
  • a "Min." and a "Max." value.
    • These values specify how often the attribute can be selected:
      • Choose 0-1 for an optional attribute.
      • Choose 1-1 for a compulsory attribute.
      • Choose a higher number if you want people to select multiple values. (This only really makes sense for drop-down attributes.)

Displaying Attributes

Advanced Relationship Attributes are displayed in the link phrases on the server using the following syntax:

  • {<attribute>}
    • Displays the value <attribute> is set to.
  • {<attribute>: <text>}
    • Displays <text> if <attribute> is set.
  • {<attribute>: <truetext>|<falsetext>}
    • Displays <truetext> if <attribute> is set, else it displays <falsetext>.

All texts can contain a percent sign (%) which will be replaced by the value the attribute is set to.

Example

{instrument:has %|was} {additional:additionally} arranged by

Instrument is a drop-down attribute, additional is a yes/no attribute. Thus it would result in "has Violins arranged by" or "was additionally arranged by".