trosel / reviews

GNU General Public License v3.0
0 stars 1 forks source link

Use NIP-32 for review events #4

Open trosel opened 1 year ago

trosel commented 1 year ago

eg.

{
  "kind": 1985,
  "tags": [
    ["r", "https://www.themoviedb.org/movie/197-braveheart"], 
    ["L", "review"], 
    ["l", "movie", "review", "{\"quality\": 0.9}"],
  ], 
  "content": "I like freedom"
}

This could be displayed as a 4.5 star review of Braveheart, searchable by namespace ("review") and label within that namespace ("movie").

Unsure if the json payload needs "kind": 1985, or "kind": 1, @staab

staab commented 1 year ago

This would be a 1985. Also, quality should be included in a json-serialized object in the l tag.

trosel commented 1 year ago

Updated the original example, thank you. I think the main thing that is left is what to do with the "r" tag exactly.

  1. Only reference the TMDB ID?
  2. Reference the database item's web page like above?
  3. Create a Nostr native format that uses Title + Year and only uses TMDB for the autocomplete?

Option 1 would marry us exclusively to one database in particular. Maybe not ideal, unless the API is totally open?

Option 2 would marry us not just to one database but also to that one database's website. Even more brittle?

Option 3 would advance the idea of "indexing everything on Nostr" (a movie itself would be a nostr profile or nostr event), however, I'm not sure if this is desirable considering that Nostr doesn't really make guarantees of data availability / permanence. Is anyone advancing this vision for Nostr? If we go with option 3, would the tag change to a #?

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.

staab commented 1 year ago

Really interesting dilemma, whatever way you go I would suggest using a more descriptive label/namespace. So if you decided to reference the TMDB ID (I would not reference their web page), you could do [["r", "129839327"], ["l", "tmdb.movie", "com.trosel.ontology.review", "{\"quality\": 0.9}"]]. If you wanted to go with #3, I would go with an established ontology. You can find well-defined semantic web ontologies here, and databases built based on those ontologies. The tradeoff would be that a semantic web ontology would be more durable and generic, but less usable, while something coupled to TMDB would be more useful, but may become useless someday when TMDB goes away.

trosel commented 1 year ago

For some reason, in my example above, I had both a capital L tag and a lowercase l tag. You only need one l tag, right?

Here is the format in the code now:

https://github.com/trosel/reviews/blob/main/src/pages/Review/SignPublishEvent.tsx#L15-L21

The second part of the "l" tag is meant to follow this schema: https://schema.org/review

Maybe that should more clearly show a schema. Something like schema:thing.creativework.movie.review

staab commented 1 year ago

The L tag is meant to reference the schema you're using with the l tag

trosel commented 1 year ago

So should the payload be something more like this?

{
  "kind": 1985,
  "tags": [
    ["r", "129839327"], // database ID
    ["L", "org.schema.thing.creativework.movie.review"], // the schema I am using
    [
      "l", 
      "org.themoviedb", // the database that the above ID belongs to
      "org.schema.thing.creativework.movie.review", // the part of the schema that I am using
      "{\"quality\": 0.9}" // the review rating
    ],
  ], 
  "content": "I like freedom"
}

Or should the L tag be the higher level schema and the l tag be the exact location within the schema like this:

{
  "kind": 1985,
  "tags": [
    ["r", "129839327"], // database ID
    ["L", "org.schema"], // the schema I am using
    [
      "l", 
      "org.themoviedb", // the database that the above ID belongs to
      "org.schema.thing.creativework.movie.review", // the part of the schema that I am using
      "{\"quality\": 0.9}" // the review rating
    ],
  ], 
  "content": "I like freedom"
}

Forgive me for being confused on these various tags. The doc is not clear to me on what each thing is for. Maybe because it's meant to be a generic NIP for many use cases.

I basically just need to know where to put:

  1. which schema I am using (schema.org in this case)
  2. what part of the schema I am using (org.schema.thing.creativework.movie.review in this case) (is it redundant if I include "org.schema" in this?)
  3. the specific database I am using in regards to the ID in the r tag
staab commented 1 year ago

L and the third part of l should match. Maybe something like this:

{
  "kind": 1985,
  "tags": [
    ["r", "129839327"],
    ["L", "org.schema"],
    ["l", "org.schema.thing.creativework.movie.review", "org.schema", "{\"quality\": 0.9}"],
  ], 
  "content": "I like freedom"
}

If r isn't specific enough, maybe you could do https://themoviedb.org/movies/129839327 or something instead. L is the top-level nomenclature you're using and l is the specific term you're applying.

trosel commented 1 year ago

If r isn't specific enough, maybe you could do https://themoviedb.org/movies/129839327 or something instead

In other NIPs, when I looked at how r tags are used, I saw that some had multiple r tags included. I don't know if this was for multiple different things, but it got me thinking that maybe we could have multiple ways of referencing the same thing? Like below?

["r", "https://www.themoviedb.org/movie/" + selectedMovie.id], 
["r",  selectedMovie.title + " " + selectedMovie.release_date],

Or like below?

["r", "{\"tmdb\": selectedMovie.id, \"title\": selectedMovie.title, \"release_date\": selectedMovie.release_date}"], 
staab commented 1 year ago

I think any of those would be fine. r tags seem sort of underspecified to me.