diff options
| author | gsovereignty <gsovereignty@proton.me> | 2023-11-14 09:13:20 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-14 09:13:20 +0800 |
| commit | b06375d164ffa8d2f56df40b037be6ec52f3483e (patch) | |
| tree | 8bf8d249b9c0da49f66ddd81e0ed892989d79882 /32.md | |
| parent | c5930de1076a747eb8181267a76ddaba8a8aad67 (diff) | |
| parent | b6c7a255102a65c4978b465a85f124e910e82a2d (diff) | |
Merge branch 'master' into patch-3
Diffstat (limited to '32.md')
| -rw-r--r-- | 32.md | 114 |
1 files changed, 68 insertions, 46 deletions
| @@ -6,50 +6,38 @@ Labeling | |||
| 6 | 6 | ||
| 7 | `draft` `optional` `author:staab` `author:gruruya` `author:s3x-jay` | 7 | `draft` `optional` `author:staab` `author:gruruya` `author:s3x-jay` |
| 8 | 8 | ||
| 9 | A label is a `kind 1985` event that is used to label other entities. This supports a number of use cases, from distributed moderation and content recommendations to reviews and ratings. | 9 | A label is a `kind 1985` event that is used to label other entities. This supports a number of use cases, |
| 10 | including distributed moderation, collection management, license assignment, and content classification. | ||
| 10 | 11 | ||
| 11 | Label Target | 12 | This NIP introduces two new tags: |
| 12 | ---- | ||
| 13 | 13 | ||
| 14 | The label event MUST include one or more tags representing the object or objects being | 14 | - `L` denotes a label namespace |
| 15 | labeled: `e`, `p`, `a`, `r`, or `t` tags. This allows for labeling of events, people, relays, | 15 | - `l` denotes a label |
| 16 | or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and | ||
| 17 | `p` tags. | ||
| 18 | 16 | ||
| 19 | Label Tag | 17 | Label Namespace Tag |
| 20 | ---- | 18 | ---- |
| 21 | 19 | ||
| 22 | This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace. | 20 | An `L` tag can be any string, but publishers SHOULD ensure they are unambiguous by using a well-defined namespace |
| 23 | A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature | 21 | (such as an ISO standard) or reverse domain name notation. |
| 24 | external to nostr defined either formally or by convention. Any string can be a namespace, but publishers SHOULD | ||
| 25 | ensure they are unambiguous by using a well-defined namespace (such as an ISO standard) or reverse domain name notation. | ||
| 26 | |||
| 27 | Namespaces starting with `#` indicate that the label target should be associated with the label's value. | ||
| 28 | This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc. | ||
| 29 | |||
| 30 | Some examples: | ||
| 31 | 22 | ||
| 32 | - `["l", "footstr", "#t"]` - the publisher thinks the given entity should have the `footstr` topic applied. | 23 | `L` tags are REQUIRED in order to support searching by namespace rather than by a specific tag. The special `ugc` |
| 33 | - `["l", "<pubkey>", "#p"]` - the publisher thinks the given entity is related to `<pubkey>` | 24 | ("user generated content") namespace MAY be used when the label content is provided by an end user. |
| 34 | - `["l", "IT-MI", "ISO-3166-2"]` - Milano, Italy using ISO 3166-2. | ||
| 35 | - `["l", "VI-hum", "com.example.ontology"]` - Violence toward a human being as defined by ontology.example.com. | ||
| 36 | 25 | ||
| 37 | `L` tags containing the label namespaces MUST be included in order to support searching by | 26 | `L` tags starting with `#` indicate that the label target should be associated with the label's value. |
| 38 | namespace rather than by a specific tag. The special `ugc` ("user generated content") namespace | 27 | This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc. |
| 39 | MAY be used when the label content is provided by an end user. | ||
| 40 | 28 | ||
| 41 | `l` and `L` tags MAY be added to other event kinds to support self-reporting. For events | 29 | Label Tag |
| 42 | with a kind other than 1985, labels refer to the event itself. | 30 | ---- |
| 43 | 31 | ||
| 44 | Label Annotations | 32 | An `l` tag's value can be any string. `l` tags MUST include a `mark` matching an `L` tag value in the same event. |
| 45 | ----- | ||
| 46 | 33 | ||
| 47 | A label tag MAY include a 4th positional element detailing extra metadata about the label in question. This string | 34 | Label Target |
| 48 | should be a json-encoded object. Any key MAY be used, but the following are recommended: | 35 | ---- |
| 49 | 36 | ||
| 50 | - `quality` may have a value of 0 to 1. This allows for an absolute, granular scale that can be represented in any way (5 stars, color scale, etc). | 37 | The label event MUST include one or more tags representing the object or objects being |
| 51 | - `confidence` may have a value of 0 to 1. This indicates the certainty which the author has about their rating. | 38 | labeled: `e`, `p`, `a`, `r`, or `t` tags. This allows for labeling of events, people, relays, |
| 52 | - `context` may be an array of urls (including NIP-21 urls) indicating other context that should be considered when interpreting labels. | 39 | or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and |
| 40 | `p` tags. | ||
| 53 | 41 | ||
| 54 | Content | 42 | Content |
| 55 | ------- | 43 | ------- |
| @@ -57,6 +45,12 @@ Content | |||
| 57 | Labels should be short, meaningful strings. Longer discussions, such as for a review, or an | 45 | Labels should be short, meaningful strings. Longer discussions, such as for a review, or an |
| 58 | explanation of why something was labeled the way it was, should go in the event's `content` field. | 46 | explanation of why something was labeled the way it was, should go in the event's `content` field. |
| 59 | 47 | ||
| 48 | Self-Reporting | ||
| 49 | ------- | ||
| 50 | |||
| 51 | `l` and `L` tags MAY be added to other event kinds to support self-reporting. For events | ||
| 52 | with a kind other than 1985, labels refer to the event itself. | ||
| 53 | |||
| 60 | Example events | 54 | Example events |
| 61 | -------------- | 55 | -------------- |
| 62 | 56 | ||
| @@ -70,38 +64,61 @@ A suggestion that multiple pubkeys be associated with the `permies` topic. | |||
| 70 | ["l", "permies", "#t"], | 64 | ["l", "permies", "#t"], |
| 71 | ["p", <pubkey1>, <relay_url>], | 65 | ["p", <pubkey1>, <relay_url>], |
| 72 | ["p", <pubkey2>, <relay_url>] | 66 | ["p", <pubkey2>, <relay_url>] |
| 73 | ], | 67 | ] |
| 74 | "content": "", | ||
| 75 | ... | ||
| 76 | } | 68 | } |
| 77 | ``` | 69 | ``` |
| 78 | 70 | ||
| 79 | A review of a relay. | 71 | A report flagging violence toward a human being as defined by ontology.example.com. |
| 80 | 72 | ||
| 81 | ```json | 73 | ```json |
| 82 | { | 74 | { |
| 83 | "kind": 1985, | 75 | "kind": 1985, |
| 84 | "tags": [ | 76 | "tags": [ |
| 85 | ["L", "com.example.ontology"], | 77 | ["L", "com.example.ontology"], |
| 86 | ["l", "relay/review", "com.example.ontology", "{\"quality\": 0.1}"], | 78 | ["l", "VI-hum", "com.example.ontology"], |
| 87 | ["r", <relay_url>] | 79 | ["p", <pubkey1>, <relay_url>], |
| 80 | ["p", <pubkey2>, <relay_url>] | ||
| 81 | ] | ||
| 82 | } | ||
| 83 | ``` | ||
| 84 | |||
| 85 | A moderation suggestion for a chat event. | ||
| 86 | |||
| 87 | ```json | ||
| 88 | { | ||
| 89 | "kind": 1985, | ||
| 90 | "tags": [ | ||
| 91 | ["L", "nip28.moderation"], | ||
| 92 | ["l", "approve", "nip28.moderation"], | ||
| 93 | ["e", <kind40_event_id>, <relay_url>] | ||
| 94 | ], | ||
| 95 | } | ||
| 96 | ``` | ||
| 97 | |||
| 98 | Assignment of a license to an event. | ||
| 99 | |||
| 100 | ```json | ||
| 101 | { | ||
| 102 | "kind": 1985, | ||
| 103 | "tags": [ | ||
| 104 | ["L", "license"], | ||
| 105 | ["l", "MIT", "license"], | ||
| 106 | ["e", <event_id>, <relay_url>] | ||
| 88 | ], | 107 | ], |
| 89 | "content": "This relay is full of mean people.", | ||
| 90 | ... | ||
| 91 | } | 108 | } |
| 92 | ``` | 109 | ``` |
| 93 | 110 | ||
| 94 | Publishers can self-label by adding `l` tags to their own non-1985 events. | 111 | Publishers can self-label by adding `l` tags to their own non-1985 events. In this case, the kind 1 event's author |
| 112 | is labeling their note as being related to Milan, Italy using ISO 3166-2. | ||
| 95 | 113 | ||
| 96 | ```json | 114 | ```json |
| 97 | { | 115 | { |
| 98 | "kind": 1, | 116 | "kind": 1, |
| 99 | "tags": [ | 117 | "tags": [ |
| 100 | ["L", "com.example.ontology"], | 118 | ["L", "ISO-3166-2"], |
| 101 | ["l", "IL-frd", "com.example.ontology"] | 119 | ["l", "IT-MI", "ISO-3166-2"] |
| 102 | ], | 120 | ], |
| 103 | "content": "Send me 100 sats and I'll send you 200 back", | 121 | "content": "It's beautiful here in Milan!", |
| 104 | ... | ||
| 105 | } | 122 | } |
| 106 | ``` | 123 | ``` |
| 107 | 124 | ||
| @@ -124,3 +141,8 @@ Vocabularies MAY choose to fully qualify all labels within a namespace (for exam | |||
| 124 | formal vocabularies that should not be confused with another namespace when querying | 141 | formal vocabularies that should not be confused with another namespace when querying |
| 125 | without an `L` tag. For these vocabularies, all labels SHOULD include the namespace | 142 | without an `L` tag. For these vocabularies, all labels SHOULD include the namespace |
| 126 | (rather than mixing qualified and unqualified labels). | 143 | (rather than mixing qualified and unqualified labels). |
| 144 | |||
| 145 | A good heuristic for whether a use case fits this NIP is whether labels would ever be unique. | ||
| 146 | For example, many events might be labeled with a particular place, topic, or pubkey, but labels | ||
| 147 | with specific values like "John Doe" or "3.18743" are not labels, they are values, and should | ||
| 148 | be handled in some other way. | ||