upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/32.md
diff options
context:
space:
mode:
Diffstat (limited to '32.md')
-rw-r--r--32.md163
1 files changed, 163 insertions, 0 deletions
diff --git a/32.md b/32.md
new file mode 100644
index 0000000..79f5937
--- /dev/null
+++ b/32.md
@@ -0,0 +1,163 @@
1NIP-32
2======
3
4Labeling
5---------
6
7`draft` `optional`
8
9A label is a `kind 1985` event that is used to label other entities. This supports a number of use cases,
10including distributed moderation, collection management, license assignment, and content classification.
11
12This NIP introduces two new tags:
13
14- `L` denotes a label namespace
15- `l` denotes a label
16
17Label Namespace Tag
18----
19
20An `L` tag can be any string, but publishers SHOULD ensure they are unambiguous by using a well-defined namespace
21(such as an ISO standard) or reverse domain name notation.
22
23`L` tags are RECOMMENDED in order to support searching by namespace rather than by a specific tag. The special `ugc`
24("user generated content") namespace MAY be used when the label content is provided by an end user.
25
26`L` tags starting with `#` indicate that the label target should be associated with the label's value.
27This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc.
28
29Label Tag
30----
31
32An `l` tag's value can be any string. If using an `L` tag, `l` tags MUST include a mark matching an `L`
33tag value in the same event. If no `L` tag is included, a mark SHOULD still be included. If none is
34included, `ugc` is implied.
35
36Label Target
37----
38
39The label event MUST include one or more tags representing the object or objects being
40labeled: `e`, `p`, `a`, `r`, or `t` tags. This allows for labeling of events, people, relays,
41or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and
42`p` tags.
43
44Content
45-------
46
47Labels should be short, meaningful strings. Longer discussions, such as for an
48explanation of why something was labeled the way it was, should go in the event's `content` field.
49
50Self-Reporting
51-------
52
53`l` and `L` tags MAY be added to other event kinds to support self-reporting. For events
54with a kind other than 1985, labels refer to the event itself.
55
56Example events
57--------------
58
59A suggestion that multiple pubkeys be associated with the `permies` topic.
60
61```json
62{
63 "kind": 1985,
64 "tags": [
65 ["L", "#t"],
66 ["l", "permies", "#t"],
67 ["p", <pubkey1>, <relay_url>],
68 ["p", <pubkey2>, <relay_url>]
69 ],
70 ...
71}
72```
73
74A report flagging violence toward a human being as defined by ontology.example.com.
75
76```json
77{
78 "kind": 1985,
79 "tags": [
80 ["L", "com.example.ontology"],
81 ["l", "VI-hum", "com.example.ontology"],
82 ["p", <pubkey1>, <relay_url>],
83 ["p", <pubkey2>, <relay_url>]
84 ],
85 ...
86}
87```
88
89A moderation suggestion for a chat event.
90
91```json
92{
93 "kind": 1985,
94 "tags": [
95 ["L", "nip28.moderation"],
96 ["l", "approve", "nip28.moderation"],
97 ["e", <kind40_event_id>, <relay_url>]
98 ],
99 ...
100}
101```
102
103Assignment of a license to an event.
104
105```json
106{
107 "kind": 1985,
108 "tags": [
109 ["L", "license"],
110 ["l", "MIT", "license"],
111 ["e", <event_id>, <relay_url>]
112 ],
113 ...
114}
115```
116
117Publishers can self-label by adding `l` tags to their own non-1985 events. In this case, the kind 1 event's author
118is labeling their note as being related to Milan, Italy using ISO 3166-2.
119
120```json
121{
122 "kind": 1,
123 "tags": [
124 ["L", "ISO-3166-2"],
125 ["l", "IT-MI", "ISO-3166-2"]
126 ],
127 "content": "It's beautiful here in Milan!",
128 ...
129}
130```
131
132Other Notes
133-----------
134
135When using this NIP to bulk-label many targets at once, events may be deleted and a replacement
136may be published. We have opted not to use parameterizable/replaceable events for this due to the
137complexity in coming up with a standard `d` tag. In order to avoid ambiguity when querying,
138publishers SHOULD limit labeling events to a single namespace.
139
140Before creating a vocabulary, explore how your use case may have already been designed and
141imitate that design if possible. Reverse domain name notation is encouraged to avoid
142namespace clashes, but for the sake of interoperability all namespaces should be
143considered open for public use, and not proprietary. In other words, if there is a
144namespace that fits your use case, use it even if it points to someone else's domain name.
145
146Vocabularies MAY choose to fully qualify all labels within a namespace (for example,
147`["l", "com.example.vocabulary:my-label"]`. This may be preferred when defining more
148formal vocabularies that should not be confused with another namespace when querying
149without an `L` tag. For these vocabularies, all labels SHOULD include the namespace
150(rather than mixing qualified and unqualified labels).
151
152A good heuristic for whether a use case fits this NIP is whether labels would ever be unique.
153For example, many events might be labeled with a particular place, topic, or pubkey, but labels
154with specific values like "John Doe" or "3.18743" are not labels, they are values, and should
155be handled in some other way.
156
157
158Appendix: Known Ontologies
159-------------------------
160
161Below is a non-exhaustive list of ontologies currently in widespread use.
162
163- [social.ontolo.categories](https://ontolo.social/)