From a9f2c6a2f128e9dda70716ace7ba72c7a3c88c3f Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Mon, 15 May 2023 05:53:50 -0700 Subject: [PATCH 01/16] Add NIP-32 for labeling things in nostr --- 32.md | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 130 insertions(+) create mode 100644 32.md diff --git a/32.md b/32.md new file mode 100644 index 00000000..7bb51069 --- /dev/null +++ b/32.md @@ -0,0 +1,129 @@ +NIP-32 +====== + +Labeling +--------- + +`draft` `optional` `author:staab` `author:gruruya` + +A label is a `kind 1985` note that is used to label other entities. This supports a number of use cases: + +- Distributed moderation and content recommendations +- Reviews and ratings +- Definition of edges in a graph structure + +This NIP does not supersede NIP-56, which supports reporting content for the purpose of +direct moderation, in order to comply with laws or app store requirements. "Moderation" +as defined by this NIP is only relative to user preferences and should be interpreted +with the social graph in view to provide a better user experience. + +Label Target +---- + +The label event MUST include one or more tags representing the object or objects being +labeled: `e`, `p`, `r`, or `t` tags. This allows for labeling of events, people, relays, +or topics respectively. + +Label Tag +---- + +This NIP introduces a new tag `l` which denotes a label. A label MAY be an unqualified string indicating the type of content based on convention, a qualified string referring to a tag type within nostr, or a qualified string referring to a nomenclature external to nostr. Some examples: + +- `review` - the publisher is leaving a review about the given entity. +- `#t/footstr` - the publisher thinks the given entity should have the `footstr` topic applied. +- `#p/` - the publisher things the given entity should be tagged with with `` +- `MeSH/D005528` - ["Foot"](https://meshb.nlm.nih.gov/record/ui?ui=D005528) from NIH's Medical Subject Headings vocabulary +- `GeoNames/3173435` - [Milan, Italy](https://www.geonames.org/3173435/milan.html) using the GeoNames coding system +- `ISO-3166-2/IT-MI` - Milano, Italy using ISO 3166-2. + +As much as possible, fully-qualified labels should be used. + +Other Tags +----- + +The label event MAY include a `quality` tag with 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). + +The label event MAY include a `confidence` tag with a value of 0 to 1. This indicates the certainty which the author has about their rating. + +Example events +-------------- + +A report that an event contains nudity. + +```json +{ + "kind": 1985, + "tags": [ + ["e", ] + ["l", "nudity"], + ], + "content": "", + ... +} +``` + +A suggestion that multiple pubkeys be associated with the `permies` topic. + +```json +{ + "kind": 1985, + "tags": [ + ["l", "#t/permies"], + ["p", ], + ["p", ], + ], + "content": "", + ... +} +``` + +A review of a relay, as relates to certain topics, including additional dimensions. The author +is indicating here that `relay_url` is related to the bitcoin topic, but they're not very sure +that's the case. + +```json +{ + "kind": 1985, + "tags": [ + ["l", "#t/bitcoin"], + ["r", ], + ["quality", 0.7], + ["confidence", 0.2], + ], + "content": "I think this relay is mostly just bitcoiners.", + ... +} +``` + +A plain review of a relay. + +```json +{ + "kind": 1985, + "tags": [ + ["l", "review"], + ["r", ], + ["quality", 0.1], + ], + "content": "This relay is full of mean people.", + ... +} +``` + +A more abstract use case: defining an edge in a graph structure, in this case identifying +a lightning channel that is open between two pubkeys. This just demonstrates the flexibility +this spec provides for overlaying structured metadata on top of nostr. + +```json +{ + "kind": 1985, + "tags": [ + ["l", "lightning/channel"], + ["p", ], + ["p", ], + ], + "content": "", + ... +} +``` diff --git a/README.md b/README.md index a940ba60..b3b15502 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos - [NIP-28: Public Chat](28.md) - [NIP-30: Custom Emoji](30.md) - [NIP-31: Dealing with Unknown Events](31.md) +- [NIP-32: Labeling](32.md) - [NIP-33: Parameterized Replaceable Events](33.md) - [NIP-36: Sensitive Content](36.md) - [NIP-39: External Identities in Profiles](39.md) From 621340e26783511b311826c4555d40b5db902b58 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Mon, 15 May 2023 06:47:31 -0700 Subject: [PATCH 02/16] Add example to NIP-32 to support tagging multiple entities with multiple labels --- 32.md | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/32.md b/32.md index 7bb51069..253a5045 100644 --- a/32.md +++ b/32.md @@ -55,8 +55,26 @@ A report that an event contains nudity. { "kind": 1985, "tags": [ - ["e", ] - ["l", "nudity"], + ["e", ], + ["l", "nudity"] + ], + "content": "", + ... +} +``` + +A single event can apply multiple labels to multiple targets to support mass-tagging. + +```json +{ + "kind": 1985, + "tags": [ + ["e", ], + ["p", ], + ["t", "chickens"], + ["l", "permaculture"], + ["l", "permies"], + ["l", "farming"] ], "content": "", ... @@ -71,7 +89,7 @@ A suggestion that multiple pubkeys be associated with the `permies` topic. "tags": [ ["l", "#t/permies"], ["p", ], - ["p", ], + ["p", ] ], "content": "", ... @@ -89,7 +107,7 @@ that's the case. ["l", "#t/bitcoin"], ["r", ], ["quality", 0.7], - ["confidence", 0.2], + ["confidence", 0.2] ], "content": "I think this relay is mostly just bitcoiners.", ... @@ -104,7 +122,7 @@ A plain review of a relay. "tags": [ ["l", "review"], ["r", ], - ["quality", 0.1], + ["quality", 0.1] ], "content": "This relay is full of mean people.", ... @@ -121,7 +139,7 @@ this spec provides for overlaying structured metadata on top of nostr. "tags": [ ["l", "lightning/channel"], ["p", ], - ["p", ], + ["p", ] ], "content": "", ... From 68b9331b624c8fcaa584c8e4b113793981c9ff80 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Tue, 16 May 2023 06:18:01 -0700 Subject: [PATCH 03/16] Add L tag, allow self-labeling, split namespaces out --- 32.md | 56 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/32.md b/32.md index 253a5045..f5557ca9 100644 --- a/32.md +++ b/32.md @@ -27,16 +27,21 @@ or topics respectively. Label Tag ---- -This NIP introduces a new tag `l` which denotes a label. A label MAY be an unqualified string indicating the type of content based on convention, a qualified string referring to a tag type within nostr, or a qualified string referring to a nomenclature external to nostr. Some examples: +This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace. A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature external to nostr defined either formally or by convention. Some examples: -- `review` - the publisher is leaving a review about the given entity. -- `#t/footstr` - the publisher thinks the given entity should have the `footstr` topic applied. -- `#p/` - the publisher things the given entity should be tagged with with `` -- `MeSH/D005528` - ["Foot"](https://meshb.nlm.nih.gov/record/ui?ui=D005528) from NIH's Medical Subject Headings vocabulary -- `GeoNames/3173435` - [Milan, Italy](https://www.geonames.org/3173435/milan.html) using the GeoNames coding system -- `ISO-3166-2/IT-MI` - Milano, Italy using ISO 3166-2. +- `["l", "footstr", "#t"]` - the publisher thinks the given entity should have the `footstr` topic applied. +- `["l", "", "#p"]` - the publisher things the given entity should be tagged with with `` +- `["l", "D005528", "MeSH"]` - ["Foot"](https://meshb.nlm.nih.gov/record/ui?ui=D005528) from NIH's Medical Subject Headings vocabulary +- `["l", "3173435", "GeoNames"]` - [Milan, Italy](https://www.geonames.org/3173435/milan.html) using the GeoNames coding system +- `["l", "IT-MI", "ISO-3166-2"]` - Milano, Italy using ISO 3166-2. +- `["l", "relay", "review"]` - the publisher is leaving a review about a relay. -As much as possible, fully-qualified labels should be used. +`L` tags containing the label namespaces MUST be included in order to support searching by +namespace rather than by a specific tag. The special `ugc` ("user generated content") namespace +MAY be used when the label content is provided by an end user. + +`l` and `L` tags MAY be added to other event kinds to support self-reporting. For events +with a kind other than 1985, labels refer to the event itself. Other Tags ----- @@ -49,21 +54,25 @@ The label event MAY include a `confidence` tag with a value of 0 to 1. This indi Example events -------------- -A report that an event contains nudity. +A report that an event contains nudity. Note that NIP 56 is preferred for reporting content +to clients, while labels are recommended for supporting distributed content moderation use +cases. ```json { "kind": 1985, "tags": [ - ["e", ], - ["l", "nudity"] + ["L", "report"], + ["l", "nudity", "report"], + ["e", ] ], "content": "", ... } ``` -A single event can apply multiple labels to multiple targets to support mass-tagging. +A single event can apply multiple labels to multiple targets to support mass-tagging. Multiple +namespaces may be used at the same time. ```json { @@ -72,9 +81,14 @@ A single event can apply multiple labels to multiple targets to support mass-tag ["e", ], ["p", ], ["t", "chickens"], - ["l", "permaculture"], - ["l", "permies"], - ["l", "farming"] + ["L", "#t"] + ["L", "ugc"] + ["L", "com.example.labels"] + ["l", "chickens", "#t"], + ["l", "user generated content", "ugc"], + ["l", "permaculture", "com.example.labels"], + ["l", "permies", "com.example.labels"], + ["l", "farming", "com.example.labels"], ], "content": "", ... @@ -87,7 +101,8 @@ A suggestion that multiple pubkeys be associated with the `permies` topic. { "kind": 1985, "tags": [ - ["l", "#t/permies"], + ["L", "#t"], + ["l", "permies", "#t"], ["p", ], ["p", ] ], @@ -104,7 +119,8 @@ that's the case. { "kind": 1985, "tags": [ - ["l", "#t/bitcoin"], + ["L", "#t"], + ["l", "bitcoin", "#t"], ["r", ], ["quality", 0.7], ["confidence", 0.2] @@ -120,7 +136,8 @@ A plain review of a relay. { "kind": 1985, "tags": [ - ["l", "review"], + ["L", "review"], + ["l", "relay", "review"], ["r", ], ["quality", 0.1] ], @@ -137,7 +154,8 @@ this spec provides for overlaying structured metadata on top of nostr. { "kind": 1985, "tags": [ - ["l", "lightning/channel"], + ["L", "my-lightning-nomenclature"], + ["l", "channel", "my-lightning-nomenclature"], ["p", ], ["p", ] ], From 34910c8674917a687ed7a71bb4968d6a54ee3f55 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Tue, 16 May 2023 12:28:02 -0700 Subject: [PATCH 04/16] Add s3x-jay to author for NIP 32 --- 32.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/32.md b/32.md index f5557ca9..0180a233 100644 --- a/32.md +++ b/32.md @@ -4,7 +4,7 @@ NIP-32 Labeling --------- -`draft` `optional` `author:staab` `author:gruruya` +`draft` `optional` `author:staab` `author:gruruya` `author:s3x-jay` A label is a `kind 1985` note that is used to label other entities. This supports a number of use cases: From 95f537e90d568ff23e485f336d251b5d415e1191 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Wed, 17 May 2023 12:50:29 -0700 Subject: [PATCH 05/16] Add relay hints, replaceable events, and clarification about content to NIP 32 --- 32.md | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/32.md b/32.md index 0180a233..b84fc642 100644 --- a/32.md +++ b/32.md @@ -6,7 +6,7 @@ Labeling `draft` `optional` `author:staab` `author:gruruya` `author:s3x-jay` -A label is a `kind 1985` note that is used to label other entities. This supports a number of use cases: +A label is a `kind 1985` (regular) event or `kind 32144` (replaceable) event that is used to label other entities. This supports a number of use cases: - Distributed moderation and content recommendations - Reviews and ratings @@ -22,7 +22,12 @@ Label Target The label event MUST include one or more tags representing the object or objects being labeled: `e`, `p`, `r`, or `t` tags. This allows for labeling of events, people, relays, -or topics respectively. +or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and +`p` tags. + +Any number of targets may be included when using a kind `1985` non-replaceable event. If kind +`32144` is preferred, the event MUST have a single target tag, and its value MUST also be the +value of the `d` tag. Label Tag ---- @@ -51,6 +56,12 @@ absolute, granular scale that can be represented in any way (5 stars, color scal The label event MAY include a `confidence` tag with a value of 0 to 1. This indicates the certainty which the author has about their rating. +Content +------- + +`l` tags should be short, meaningful strings. Longer discussions, such as for a review, or an +explanation of why something was labeled the way it was should go in the event's `content` field. + Example events -------------- @@ -64,7 +75,7 @@ cases. "tags": [ ["L", "report"], ["l", "nudity", "report"], - ["e", ] + ["e", , ] ], "content": "", ... @@ -78,8 +89,8 @@ namespaces may be used at the same time. { "kind": 1985, "tags": [ - ["e", ], - ["p", ], + ["e", , ], + ["p", , ], ["t", "chickens"], ["L", "#t"] ["L", "ugc"] @@ -103,8 +114,8 @@ A suggestion that multiple pubkeys be associated with the `permies` topic. "tags": [ ["L", "#t"], ["l", "permies", "#t"], - ["p", ], - ["p", ] + ["p", , ], + ["p", , ] ], "content": "", ... @@ -156,8 +167,8 @@ this spec provides for overlaying structured metadata on top of nostr. "tags": [ ["L", "my-lightning-nomenclature"], ["l", "channel", "my-lightning-nomenclature"], - ["p", ], - ["p", ] + ["p", , ], + ["p", , ] ], "content": "", ... From 5b32def861fb114feb564ce2d089b7983639ada8 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Tue, 23 May 2023 14:33:27 -0700 Subject: [PATCH 06/16] Move annotations to the label tag for NIP-32. Remove replaceable events --- 32.md | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/32.md b/32.md index b84fc642..a16ddf7a 100644 --- a/32.md +++ b/32.md @@ -6,7 +6,7 @@ Labeling `draft` `optional` `author:staab` `author:gruruya` `author:s3x-jay` -A label is a `kind 1985` (regular) event or `kind 32144` (replaceable) event that is used to label other entities. This supports a number of use cases: +A label is a `kind 1985` event that is used to label other entities. This supports a number of use cases: - Distributed moderation and content recommendations - Reviews and ratings @@ -25,10 +25,6 @@ labeled: `e`, `p`, `r`, or `t` tags. This allows for labeling of events, people, or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and `p` tags. -Any number of targets may be included when using a kind `1985` non-replaceable event. If kind -`32144` is preferred, the event MUST have a single target tag, and its value MUST also be the -value of the `d` tag. - Label Tag ---- @@ -48,18 +44,21 @@ MAY be used when the label content is provided by an end user. `l` and `L` tags MAY be added to other event kinds to support self-reporting. For events with a kind other than 1985, labels refer to the event itself. -Other Tags +Label Annotations ----- -The label event MAY include a `quality` tag with 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). +A label tag MAY include a 4th positional element detailing extra information about the label in question. This string +should be a url-encoded list of key/value pairs, for example `quality=1&confidence=1`. Any key MAY be used, but the +following are recommended: -The label event MAY include a `confidence` tag with a value of 0 to 1. This indicates the certainty which the author has about their rating. +- `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). +- `confidence` may have a value of 0 to 1. This indicates the certainty which the author has about their rating. +- `context` may be a comma-separated list of urls (including NIP-21 urls) indicating other context that should be considered when interpreting labels. Content ------- -`l` tags should be short, meaningful strings. Longer discussions, such as for a review, or an +Labels should be short, meaningful strings. Longer discussions, such as for a review, or an explanation of why something was labeled the way it was should go in the event's `content` field. Example events @@ -131,10 +130,8 @@ that's the case. "kind": 1985, "tags": [ ["L", "#t"], - ["l", "bitcoin", "#t"], - ["r", ], - ["quality", 0.7], - ["confidence", 0.2] + ["l", "bitcoin", "#t", "quality=0.7&confidence=0.2"], + ["r", ] ], "content": "I think this relay is mostly just bitcoiners.", ... @@ -148,9 +145,8 @@ A plain review of a relay. "kind": 1985, "tags": [ ["L", "review"], - ["l", "relay", "review"], - ["r", ], - ["quality", 0.1] + ["l", "relay", "review", "quality=0.1"], + ["r", ] ], "content": "This relay is full of mean people.", ... From 2372874b98fd109cfa517532a276cec456e738f8 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Tue, 23 May 2023 14:47:56 -0700 Subject: [PATCH 07/16] Use JSON for label metadata in NIP-32 --- 32.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/32.md b/32.md index a16ddf7a..161af537 100644 --- a/32.md +++ b/32.md @@ -21,7 +21,7 @@ Label Target ---- The label event MUST include one or more tags representing the object or objects being -labeled: `e`, `p`, `r`, or `t` tags. This allows for labeling of events, people, relays, +labeled: `e`, `p`, `a`, `r`, or `t` tags. This allows for labeling of events, people, relays, or topics respectively. As with NIP-01, a relay hint SHOULD be included when using `e` and `p` tags. @@ -47,9 +47,8 @@ with a kind other than 1985, labels refer to the event itself. Label Annotations ----- -A label tag MAY include a 4th positional element detailing extra information about the label in question. This string -should be a url-encoded list of key/value pairs, for example `quality=1&confidence=1`. Any key MAY be used, but the -following are recommended: +A label tag MAY include a 4th positional element detailing extra metadata about the label in question. This string +should be a json-encoded object. Any key MAY be used, but the following are recommended: - `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). - `confidence` may have a value of 0 to 1. This indicates the certainty which the author has about their rating. @@ -130,7 +129,7 @@ that's the case. "kind": 1985, "tags": [ ["L", "#t"], - ["l", "bitcoin", "#t", "quality=0.7&confidence=0.2"], + ["l", "bitcoin", "#t", "{\"quality\": 0.7, \"confidence\": 0.2}"], ["r", ] ], "content": "I think this relay is mostly just bitcoiners.", @@ -145,7 +144,7 @@ A plain review of a relay. "kind": 1985, "tags": [ ["L", "review"], - ["l", "relay", "review", "quality=0.1"], + ["l", "relay", "review", "{\"quality\": 0.1}"], ["r", ] ], "content": "This relay is full of mean people.", From 4e8f3adf43afae1944ade2a5031eebf5de0e1fd2 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Wed, 24 May 2023 12:42:26 -0700 Subject: [PATCH 08/16] Recommend qualified names for label namespaces --- 32.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/32.md b/32.md index 161af537..858e6371 100644 --- a/32.md +++ b/32.md @@ -28,14 +28,15 @@ or topics respectively. As with NIP-01, a relay hint SHOULD be included when usi Label Tag ---- -This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace. A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature external to nostr defined either formally or by convention. Some examples: +This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace. A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature external to nostr defined either formally or by convention. Any string can be a namespace, but publishers SHOULD ensure they are unambiguous by using a well-defined ISO standard or reverse domain name notation. Some examples: - `["l", "footstr", "#t"]` - the publisher thinks the given entity should have the `footstr` topic applied. - `["l", "", "#p"]` - the publisher things the given entity should be tagged with with `` - `["l", "D005528", "MeSH"]` - ["Foot"](https://meshb.nlm.nih.gov/record/ui?ui=D005528) from NIH's Medical Subject Headings vocabulary - `["l", "3173435", "GeoNames"]` - [Milan, Italy](https://www.geonames.org/3173435/milan.html) using the GeoNames coding system - `["l", "IT-MI", "ISO-3166-2"]` - Milano, Italy using ISO 3166-2. -- `["l", "relay", "review"]` - the publisher is leaving a review about a relay. +- `["l", "VI-hum", "social.nos.ontology"]` - Violence toward a human being as defined by ontology.nos.social. +- `["l", "review", "social.coracle.ontology"]` - the publisher is leaving a review about the target, as defined by ontology.coracle.social. `L` tags containing the label namespaces MUST be included in order to support searching by namespace rather than by a specific tag. The special `ugc` ("user generated content") namespace @@ -58,7 +59,7 @@ Content ------- Labels should be short, meaningful strings. Longer discussions, such as for a review, or an -explanation of why something was labeled the way it was should go in the event's `content` field. +explanation of why something was labeled the way it was, should go in the event's `content` field. Example events -------------- @@ -143,8 +144,8 @@ A plain review of a relay. { "kind": 1985, "tags": [ - ["L", "review"], - ["l", "relay", "review", "{\"quality\": 0.1}"], + ["L", "social.coracle.ontology"], + ["l", "review", "social.coracle.ontology", "{\"quality\": 0.1}"], ["r", ] ], "content": "This relay is full of mean people.", From 057d097e741453895164590d1c56fe87703c2c97 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Thu, 25 May 2023 10:22:35 -0700 Subject: [PATCH 09/16] Add an example for self-tagging, clarify # labels --- 32.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/32.md b/32.md index 858e6371..dd2f50ca 100644 --- a/32.md +++ b/32.md @@ -30,8 +30,10 @@ Label Tag This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace. A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature external to nostr defined either formally or by convention. Any string can be a namespace, but publishers SHOULD ensure they are unambiguous by using a well-defined ISO standard or reverse domain name notation. Some examples: +Namespaces starting with `#` indicate that the label target should be associated with the label's value. This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc. + - `["l", "footstr", "#t"]` - the publisher thinks the given entity should have the `footstr` topic applied. -- `["l", "", "#p"]` - the publisher things the given entity should be tagged with with `` +- `["l", "", "#p"]` - the publisher thinks the given entity is related to `` - `["l", "D005528", "MeSH"]` - ["Foot"](https://meshb.nlm.nih.gov/record/ui?ui=D005528) from NIH's Medical Subject Headings vocabulary - `["l", "3173435", "GeoNames"]` - [Milan, Italy](https://www.geonames.org/3173435/milan.html) using the GeoNames coding system - `["l", "IT-MI", "ISO-3166-2"]` - Milano, Italy using ISO 3166-2. @@ -170,3 +172,17 @@ this spec provides for overlaying structured metadata on top of nostr. ... } ``` + +Publishers can self-label by adding `l` tags to their own non-1985 events. + +```json +{ + "kind": 1, + "tags": [ + ["L", "social.nos.ontology"], + ["l", "IL-frd", "social.nos.ontology"] + ], + "content": "Send me 100 sats and I'll send you 200 back", + ... +} +``` From 114302517fa5b4ea499c5725f8a6aab675c36e24 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Sat, 27 May 2023 09:03:48 -0700 Subject: [PATCH 10/16] remove references to nip 56 in nip 32 --- 32.md | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/32.md b/32.md index dd2f50ca..1939555c 100644 --- a/32.md +++ b/32.md @@ -12,11 +12,6 @@ A label is a `kind 1985` event that is used to label other entities. This suppor - Reviews and ratings - Definition of edges in a graph structure -This NIP does not supersede NIP-56, which supports reporting content for the purpose of -direct moderation, in order to comply with laws or app store requirements. "Moderation" -as defined by this NIP is only relative to user preferences and should be interpreted -with the social graph in view to provide a better user experience. - Label Target ---- @@ -66,23 +61,6 @@ explanation of why something was labeled the way it was, should go in the event' Example events -------------- -A report that an event contains nudity. Note that NIP 56 is preferred for reporting content -to clients, while labels are recommended for supporting distributed content moderation use -cases. - -```json -{ - "kind": 1985, - "tags": [ - ["L", "report"], - ["l", "nudity", "report"], - ["e", , ] - ], - "content": "", - ... -} -``` - A single event can apply multiple labels to multiple targets to support mass-tagging. Multiple namespaces may be used at the same time. From 363d112e335c13f4fa1c113e2418db1102c58ed5 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Wed, 7 Jun 2023 16:03:05 -0700 Subject: [PATCH 11/16] Add a note about PREs, update NIP 36 to point to NIP 32 --- 32.md | 15 +++++++++++++-- 36.md | 7 ++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/32.md b/32.md index 1939555c..b572c132 100644 --- a/32.md +++ b/32.md @@ -23,9 +23,13 @@ or topics respectively. As with NIP-01, a relay hint SHOULD be included when usi Label Tag ---- -This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace. A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature external to nostr defined either formally or by convention. Any string can be a namespace, but publishers SHOULD ensure they are unambiguous by using a well-defined ISO standard or reverse domain name notation. Some examples: +This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace. +A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature +external to nostr defined either formally or by convention. Any string can be a namespace, but publishers SHOULD +ensure they are unambiguous by using a well-defined ISO standard or reverse domain name notation. Some examples: -Namespaces starting with `#` indicate that the label target should be associated with the label's value. This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc. +Namespaces starting with `#` indicate that the label target should be associated with the label's value. +This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc. - `["l", "footstr", "#t"]` - the publisher thinks the given entity should have the `footstr` topic applied. - `["l", "", "#p"]` - the publisher thinks the given entity is related to `` @@ -164,3 +168,10 @@ Publishers can self-label by adding `l` tags to their own non-1985 events. ... } ``` + +Other Notes +----------- + +When using this NIP to bulk-label many targets at once, events may be deleted and a replacement +may be published. We have opted not to use parameterizable/replaceable events for this due to the +complexity in coming up with a standard `d` tag. diff --git a/36.md b/36.md index 1223e53c..379d40a4 100644 --- a/36.md +++ b/36.md @@ -9,12 +9,15 @@ Sensitive Content / Content Warning The `content-warning` tag enables users to specify if the event's content needs to be approved by readers to be shown. Clients can hide the content until the user acts on it. +`l` and `L` tags MAY be also be used as defined in [NIP-32](32.md) with the `content-warning` namespace to support +further qualification and querying. + #### Spec ``` tag: content-warning options: - - [reason]: optional + - [reason]: optional ``` #### Example @@ -26,6 +29,8 @@ options: "kind": 1, "tags": [ ["t", "hastag"], + ["L", "content-warning"], + ["l", "reason", "content-warning"], ["content-warning", "reason"] /* reason is optional */ ], "content": "sensitive content with #hastag\n", From 92ce49dda0acce1f661868316a9858521d4bc974 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Wed, 7 Jun 2023 16:09:26 -0700 Subject: [PATCH 12/16] Add labeling to nip 56 as well --- 36.md | 4 +++- 56.md | 15 ++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/36.md b/36.md index 379d40a4..6d1cf639 100644 --- a/36.md +++ b/36.md @@ -9,7 +9,7 @@ Sensitive Content / Content Warning The `content-warning` tag enables users to specify if the event's content needs to be approved by readers to be shown. Clients can hide the content until the user acts on it. -`l` and `L` tags MAY be also be used as defined in [NIP-32](32.md) with the `content-warning` namespace to support +`l` and `L` tags MAY be also be used as defined in [NIP-32](32.md) with the `content-warning` or other namespace to support further qualification and querying. #### Spec @@ -31,6 +31,8 @@ options: ["t", "hastag"], ["L", "content-warning"], ["l", "reason", "content-warning"], + ["L", "social.nos.ontology"], + ["l", "NS-nud", "social.nos.ontology"], ["content-warning", "reason"] /* reason is optional */ ], "content": "sensitive content with #hastag\n", diff --git a/56.md b/56.md index 55ee1a2e..42174fb2 100644 --- a/56.md +++ b/56.md @@ -32,6 +32,9 @@ being reported, which consists of the following report types: Some report tags only make sense for profile reports, such as `impersonation` +`l` and `L` tags MAY be also be used as defined in [NIP-32](32.md) to support +further qualification and querying. + Example events -------------- @@ -39,7 +42,9 @@ Example events { "kind": 1984, "tags": [ - [ "p", , "nudity"] + ["p", , "nudity"] + ["L", "social.nos.ontology"], + ["l", "NS-nud", "social.nos.ontology"], ], "content": "", ... @@ -48,8 +53,8 @@ Example events { "kind": 1984, "tags": [ - [ "e", , "illegal"], - [ "p", ] + ["e", , "illegal"], + ["p", ] ], "content": "He's insulting the king!", ... @@ -58,8 +63,8 @@ Example events { "kind": 1984, "tags": [ - [ "p", , "impersonation"], - [ "p", ] + ["p", , "impersonation"], + ["p", ] ], "content": "Profile is imitating #[1]", ... From 61849b5a6bd1171a4c661c5c0531984a7b3db993 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Tue, 13 Jun 2023 09:34:24 -0700 Subject: [PATCH 13/16] Small wording changes --- 32.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/32.md b/32.md index b572c132..fcf6082c 100644 --- a/32.md +++ b/32.md @@ -37,7 +37,7 @@ This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, - `["l", "3173435", "GeoNames"]` - [Milan, Italy](https://www.geonames.org/3173435/milan.html) using the GeoNames coding system - `["l", "IT-MI", "ISO-3166-2"]` - Milano, Italy using ISO 3166-2. - `["l", "VI-hum", "social.nos.ontology"]` - Violence toward a human being as defined by ontology.nos.social. -- `["l", "review", "social.coracle.ontology"]` - the publisher is leaving a review about the target, as defined by ontology.coracle.social. +- `["l", "relay/review", "social.coracle.ontology"]` - the publisher is leaving a review about a relay, as defined by ontology.coracle.social. `L` tags containing the label namespaces MUST be included in order to support searching by namespace rather than by a specific tag. The special `ugc` ("user generated content") namespace @@ -54,7 +54,7 @@ should be a json-encoded object. Any key MAY be used, but the following are reco - `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). - `confidence` may have a value of 0 to 1. This indicates the certainty which the author has about their rating. -- `context` may be a comma-separated list of urls (including NIP-21 urls) indicating other context that should be considered when interpreting labels. +- `context` may be an array of urls (including NIP-21 urls) indicating other context that should be considered when interpreting labels. Content ------- @@ -129,7 +129,7 @@ A plain review of a relay. "kind": 1985, "tags": [ ["L", "social.coracle.ontology"], - ["l", "review", "social.coracle.ontology", "{\"quality\": 0.1}"], + ["l", "relay/review", "social.coracle.ontology", "{\"quality\": 0.1}"], ["r", ] ], "content": "This relay is full of mean people.", From bef3e6c941c80114c1a040d42317c8fef4a74e7d Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Tue, 13 Jun 2023 17:30:26 -0700 Subject: [PATCH 14/16] Add a few more notes to nip 32 --- 32.md | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/32.md b/32.md index fcf6082c..45cadbe7 100644 --- a/32.md +++ b/32.md @@ -26,7 +26,7 @@ Label Tag This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace. A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature external to nostr defined either formally or by convention. Any string can be a namespace, but publishers SHOULD -ensure they are unambiguous by using a well-defined ISO standard or reverse domain name notation. Some examples: +ensure they are unambiguous by using a well-defined namespace (such as an ISO standard) or reverse domain name notation. Some examples: Namespaces starting with `#` indicate that the label target should be associated with the label's value. This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc. @@ -36,8 +36,8 @@ This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, - `["l", "D005528", "MeSH"]` - ["Foot"](https://meshb.nlm.nih.gov/record/ui?ui=D005528) from NIH's Medical Subject Headings vocabulary - `["l", "3173435", "GeoNames"]` - [Milan, Italy](https://www.geonames.org/3173435/milan.html) using the GeoNames coding system - `["l", "IT-MI", "ISO-3166-2"]` - Milano, Italy using ISO 3166-2. -- `["l", "VI-hum", "social.nos.ontology"]` - Violence toward a human being as defined by ontology.nos.social. -- `["l", "relay/review", "social.coracle.ontology"]` - the publisher is leaving a review about a relay, as defined by ontology.coracle.social. +- `["l", "VI-hum", "com.example.ontology"]` - Violence toward a human being as defined by ontology.example.com. +- `["l", "relay/review", "com.example.ontology"]` - the publisher is leaving a review about a relay, as defined by ontology.example.com. `L` tags containing the label namespaces MUST be included in order to support searching by namespace rather than by a specific tag. The special `ugc` ("user generated content") namespace @@ -128,8 +128,8 @@ A plain review of a relay. { "kind": 1985, "tags": [ - ["L", "social.coracle.ontology"], - ["l", "relay/review", "social.coracle.ontology", "{\"quality\": 0.1}"], + ["L", "com.example.ontology"], + ["l", "relay/review", "com.example.ontology", "{\"quality\": 0.1}"], ["r", ] ], "content": "This relay is full of mean people.", @@ -161,8 +161,8 @@ Publishers can self-label by adding `l` tags to their own non-1985 events. { "kind": 1, "tags": [ - ["L", "social.nos.ontology"], - ["l", "IL-frd", "social.nos.ontology"] + ["L", "com.example.ontology"], + ["l", "IL-frd", "com.example.ontology"] ], "content": "Send me 100 sats and I'll send you 200 back", ... @@ -175,3 +175,14 @@ Other Notes When using this NIP to bulk-label many targets at once, events may be deleted and a replacement may be published. We have opted not to use parameterizable/replaceable events for this due to the complexity in coming up with a standard `d` tag. + +Before creating a vocabulary, explore how your use case may have already been designed and +imitate that design if possible. Reverse domain name notation is encouraged to avoid +namespace clashes, but for the sake of interoperability all namespaces should be +considered open for public use, and not proprietary. In other words, if there is a +namespace that fits your use case, use it even if it points to someone else's domain name. + +Vocabularies MAY choose to include the namespace in the label, delimited by a `:` character. +This may be preferred when defining more formal vocabularies that should not be confused with +another namespace when querying without an `L` tag. For these vocabularies, all labels +SHOULD include the namespace (rather than mixing qualified and unqualified labels). From 992b045aa7b7610d1c492dab717eb183094fec39 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Wed, 14 Jun 2023 09:43:03 -0700 Subject: [PATCH 15/16] remove delimiter recommendation --- 32.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/32.md b/32.md index 45cadbe7..b1473859 100644 --- a/32.md +++ b/32.md @@ -182,7 +182,8 @@ namespace clashes, but for the sake of interoperability all namespaces should be considered open for public use, and not proprietary. In other words, if there is a namespace that fits your use case, use it even if it points to someone else's domain name. -Vocabularies MAY choose to include the namespace in the label, delimited by a `:` character. -This may be preferred when defining more formal vocabularies that should not be confused with -another namespace when querying without an `L` tag. For these vocabularies, all labels -SHOULD include the namespace (rather than mixing qualified and unqualified labels). +Vocabularies MAY choose to fully qualify all labels within a namespace (for example, +`["l", "com.example.vocabulary:my-label"]`. This may be preferred when defining more +formal vocabularies that should not be confused with another namespace when querying +without an `L` tag. For these vocabularies, all labels SHOULD include the namespace +(rather than mixing qualified and unqualified labels). From ece0dda45be1053f673216edb9d6cd8a92035757 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Sat, 17 Jun 2023 09:07:08 -0700 Subject: [PATCH 16/16] Remove some examples from nip 32 to keep things concise --- 32.md | 77 ++++++----------------------------------------------------- 1 file changed, 7 insertions(+), 70 deletions(-) diff --git a/32.md b/32.md index b1473859..ddd364ae 100644 --- a/32.md +++ b/32.md @@ -6,11 +6,7 @@ Labeling `draft` `optional` `author:staab` `author:gruruya` `author:s3x-jay` -A label is a `kind 1985` event that is used to label other entities. This supports a number of use cases: - -- Distributed moderation and content recommendations -- Reviews and ratings -- Definition of edges in a graph structure +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. Label Target ---- @@ -26,18 +22,17 @@ Label Tag This NIP introduces a new tag `l` which denotes a label, and a new `L` tag which denotes a label namespace. A label MUST include a mark matching an `L` tag. `L` tags refer to a tag type within nostr, or a nomenclature external to nostr defined either formally or by convention. Any string can be a namespace, but publishers SHOULD -ensure they are unambiguous by using a well-defined namespace (such as an ISO standard) or reverse domain name notation. Some examples: +ensure they are unambiguous by using a well-defined namespace (such as an ISO standard) or reverse domain name notation. Namespaces starting with `#` indicate that the label target should be associated with the label's value. This is a way of attaching standard nostr tags to events, pubkeys, relays, urls, etc. +Some examples: + - `["l", "footstr", "#t"]` - the publisher thinks the given entity should have the `footstr` topic applied. - `["l", "", "#p"]` - the publisher thinks the given entity is related to `` -- `["l", "D005528", "MeSH"]` - ["Foot"](https://meshb.nlm.nih.gov/record/ui?ui=D005528) from NIH's Medical Subject Headings vocabulary -- `["l", "3173435", "GeoNames"]` - [Milan, Italy](https://www.geonames.org/3173435/milan.html) using the GeoNames coding system - `["l", "IT-MI", "ISO-3166-2"]` - Milano, Italy using ISO 3166-2. - `["l", "VI-hum", "com.example.ontology"]` - Violence toward a human being as defined by ontology.example.com. -- `["l", "relay/review", "com.example.ontology"]` - the publisher is leaving a review about a relay, as defined by ontology.example.com. `L` tags containing the label namespaces MUST be included in order to support searching by namespace rather than by a specific tag. The special `ugc` ("user generated content") namespace @@ -65,30 +60,6 @@ explanation of why something was labeled the way it was, should go in the event' Example events -------------- -A single event can apply multiple labels to multiple targets to support mass-tagging. Multiple -namespaces may be used at the same time. - -```json -{ - "kind": 1985, - "tags": [ - ["e", , ], - ["p", , ], - ["t", "chickens"], - ["L", "#t"] - ["L", "ugc"] - ["L", "com.example.labels"] - ["l", "chickens", "#t"], - ["l", "user generated content", "ugc"], - ["l", "permaculture", "com.example.labels"], - ["l", "permies", "com.example.labels"], - ["l", "farming", "com.example.labels"], - ], - "content": "", - ... -} -``` - A suggestion that multiple pubkeys be associated with the `permies` topic. ```json @@ -105,24 +76,7 @@ A suggestion that multiple pubkeys be associated with the `permies` topic. } ``` -A review of a relay, as relates to certain topics, including additional dimensions. The author -is indicating here that `relay_url` is related to the bitcoin topic, but they're not very sure -that's the case. - -```json -{ - "kind": 1985, - "tags": [ - ["L", "#t"], - ["l", "bitcoin", "#t", "{\"quality\": 0.7, \"confidence\": 0.2}"], - ["r", ] - ], - "content": "I think this relay is mostly just bitcoiners.", - ... -} -``` - -A plain review of a relay. +A review of a relay. ```json { @@ -137,24 +91,6 @@ A plain review of a relay. } ``` -A more abstract use case: defining an edge in a graph structure, in this case identifying -a lightning channel that is open between two pubkeys. This just demonstrates the flexibility -this spec provides for overlaying structured metadata on top of nostr. - -```json -{ - "kind": 1985, - "tags": [ - ["L", "my-lightning-nomenclature"], - ["l", "channel", "my-lightning-nomenclature"], - ["p", , ], - ["p", , ] - ], - "content": "", - ... -} -``` - Publishers can self-label by adding `l` tags to their own non-1985 events. ```json @@ -174,7 +110,8 @@ Other Notes When using this NIP to bulk-label many targets at once, events may be deleted and a replacement may be published. We have opted not to use parameterizable/replaceable events for this due to the -complexity in coming up with a standard `d` tag. +complexity in coming up with a standard `d` tag. In order to avoid ambiguity when querying, +publishers SHOULD limit labeling events to a single namespace. Before creating a vocabulary, explore how your use case may have already been designed and imitate that design if possible. Reverse domain name notation is encouraged to avoid