Introduction
nostralink is a Rust crate to write nostr events as linked data (using JSON-LD) and serialize incoming events to an RDF store.
Transforming Nostr events (which are formatted in JSON) to RDF has a few advantages:
-
Meaning: linked data is structured meaningful data. With the rapidly growing Nostr protocol, new event types are regularly added. Maintaining a vocabulary (using JSON-LD contexts) of all the official semantic properties of commonly used Nostr events helps with the interpretation of the information they contain.
-
Querying: By leveraging the power of SparQL, it becomes trivial to write queries to interpret the data contained in events. Consider this simple query, which extracts the user's information contained in metadata (kind 0) events, allowing us to also find the metadata for people we follow (w3nostr:follows) by passing the nip21 URI of our public key as a SparQL variable.
This book will document how nostralink works and how to use it to write linked-data aware nostr applications.
But first, let's have a look at what events look like when they're turned into linked data.