1NIP-322======34Labeling5--------67`draft` `optional`89This NIP defines two new indexable tags to label events and a new event kind (`kind:1985`) to attach those labels to existing events. This supports several use cases, including distributed moderation, collection management, license assignment, and content classification.1011New Tags:1213- `L` denotes a label namespace14- `l` denotes a label1516Label Namespace Tag17----1819An `L` tag can be any string, but publishers SHOULD ensure they are unambiguous by using a well-defined namespace20(such as an ISO standard) or reverse domain name notation.2122`L` tags are RECOMMENDED in order to support searching by namespace rather than by a specific tag. The special `ugc`23("user generated content") namespace MAY be used when the label content is provided by an end user.2425`L` tags starting with `#` indicate that the label target should be associated with the label's value.26This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc.2728Label Tag29----3031An `l` tag's value can be any string. If using an `L` tag, `l` tags MUST include a mark matching an `L`32tag value in the same event. If no `L` tag is included, a mark SHOULD still be included. If none is33included, `ugc` is implied.3435Label Target36----3738The label event MUST include one or more tags representing the object or objects being39labeled: `e`, `p`, `a`, `r`, or `t` tags. This allows for labeling of events, people, relays,40or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and41`p` tags.4243Content44-------4546Labels should be short, meaningful strings. Longer discussions, such as for an47explanation of why something was labeled the way it was, should go in the event's `content` field.4849Self-Reporting50-------5152`l` and `L` tags MAY be added to other event kinds to support self-reporting. For events53with a kind other than 1985, labels refer to the event itself.5455Example events56--------------5758A suggestion that multiple pubkeys be associated with the `permies` topic.5960```yaml61{62 "kind": 1985,63 "tags": [64 ["L", "#t"],65 ["l", "permies", "#t"],66 ["p", <pubkey1>, <relay_url>],67 ["p", <pubkey2>, <relay_url>]68 ],69 // other fields...70}71```7273A report flagging violence toward a human being as defined by ontology.example.com.7475```yaml76{77 "kind": 1985,78 "tags": [79 ["L", "com.example.ontology"],80 ["l", "VI-hum", "com.example.ontology"],81 ["p", <pubkey1>, <relay_url>],82 ["p", <pubkey2>, <relay_url>]83 ],84 // other fields...85}86```8788A moderation suggestion for a chat event.8990```yaml91{92 "kind": 1985,93 "tags": [94 ["L", "nip28.moderation"],95 ["l", "approve", "nip28.moderation"],96 ["e", <kind40_event_id>, <relay_url>]97 ],98 // other fields...99}100```101102Assignment of a license to an event.103104```yaml105{106 "kind": 1985,107 "tags": [108 ["L", "license"],109 ["l", "MIT", "license"],110 ["e", <event_id>, <relay_url>]111 ],112 // other fields...113}114```115116Publishers can self-label by adding `l` tags to their own non-1985 events. In this case, the kind 1 event's author117is labeling their note as being related to Milan, Italy using ISO 3166-2.118119```yaml120{121 "kind": 1,122 "tags": [123 ["L", "ISO-3166-2"],124 ["l", "IT-MI", "ISO-3166-2"]125 ],126 "content": "It's beautiful here in Milan!",127 // other fields...128}129```130131Author is labeling their note language as English using ISO-639-1.132133```yaml134{135 "kind": 1,136 "tags": [137 ["L", "ISO-639-1"],138 ["l", "en", "ISO-639-1"]139 ],140 "content": "English text",141 // other fields...142}143```144145Other Notes146-----------147148When using this NIP to bulk-label many targets at once, events may be requested for deletion using [NIP-09](09.md) and a replacement149may be published. We have opted not to use addressable/replaceable events for this due to the150complexity in coming up with a standard `d` tag. In order to avoid ambiguity when querying,151publishers SHOULD limit labeling events to a single namespace.152153Before creating a vocabulary, explore how your use case may have already been designed and154imitate that design if possible. Reverse domain name notation is encouraged to avoid155namespace clashes, but for the sake of interoperability all namespaces should be156considered open for public use, and not proprietary. In other words, if there is a157namespace that fits your use case, use it even if it points to someone else's domain name.158159Vocabularies MAY choose to fully qualify all labels within a namespace (for example,160`["l", "com.example.vocabulary:my-label"]`). This may be preferred when defining more161formal vocabularies that should not be confused with another namespace when querying162without an `L` tag. For these vocabularies, all labels SHOULD include the namespace163(rather than mixing qualified and unqualified labels).164165A good heuristic for whether a use case fits this NIP is whether labels would ever be unique.166For example, many events might be labeled with a particular place, topic, or pubkey, but labels167with specific values like "John Doe" or "3.18743" are not labels, they are values, and should168be handled in some other way.169170171Appendix: Known Ontologies172--------------------------173174Below is a non-exhaustive list of ontologies currently in widespread use.175176- [social ontology categories](https://github.com/CLARIAH/awesome-humanities-ontologies)