TaggingRules
is an option for selections that specifies a list of strings to be associated with a selection.
Details
- TaggingRules provides a way of storing additional information with a selection, for example, to be used by other programs in processing a notebook. It can be set to a list of one or more strings.
- With the default setting TaggingRules< >, no additional information is associated with the selection.
- Typically, structured metadata is broken up into pieces that can be identified using keys in the form "key"value. The key can then be individually queried using AbsoluteCurrentValue[obj,{TaggingRules,"key"}].
- Another typical method for storing highly structured data is to use subkeys inside of keys. For example, "key"<"key1"data1,"key2"data2,… >. The subkeys can then be queried using AbsoluteCurrentValue[obj,{TaggingRules,"key","subkey"}]. Subkeys can have their own subkeys to an arbitrary depth.
- TaggingRules can be set at the cell, notebook, and global level.
- TaggingRules<key1val1,… > effectively merges the keyi with any keys inherited from a more general scope. The fully merged set of keys and values can be read using AbsoluteCurrentValue. Specifying keys and values as a list instead of an association will cause inherited keys to be ignored.
Examples
open allclose allBasic Examples (2)
Apply TaggingRules at the cell level:
Use nested rules as TaggingRules:
Reference specific TaggingRules values using CurrentValue:
Reference nested values directly by using subselectors in CurrentValue:
Scope (5)
Basic Uses (3)
Apply TaggingRules at the notebook level:
Apply TaggingRules at the global level:
Restore TaggingRules to its default value:
If a tagging rule key does not exist, CurrentValue returns Inherited for its value:
Inheritance (2)
TaggingRules specified as an Association will be merged with inherited rules:
Specifying the inner value as a list will ignore inherited rules:
Rules with the same name but differing values will be overwritten upon inheritance:
If the value is an Association, then the associations are instead merged:
Applications (1)
TaggingRules can be used like a DynamicModule variable that spans cells:
Text
Wolfram Research (1999), TaggingRules, Wolfram Language function, https://reference.wolfram.com/language/ref/TaggingRules.html (updated 2021).
CMS
Wolfram Language. 1999. "TaggingRules." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/TaggingRules.html.
APA
Wolfram Language. (1999). TaggingRules. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TaggingRules.html