nostra
You can use the command-line tool nostra to create events and show their RDF representation.
Create a note
Usage: nostra note <TEXT>
Arguments:
<TEXT>
<urn:nostr-event:ee8ed388a5707b6e98473d43417672f5f9ef35fb874c99cda17904540efc7ba6> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/nostr#Event> ;
<https://w3id.org/nostr#created_at> "1743647753"^^<http://www.w3.org/2001/XMLSchema#integer> ;
<https://w3id.org/nostr#id> "ee8ed388a5707b6e98473d43417672f5f9ef35fb874c99cda17904540efc7ba6" ;
<https://w3id.org/nostr#nip21> <nostr:npub1kjmt7sfn8xzxjvegf9m0fu7mcwt6292kqprh38qj7l5g5vut53nq99h50f> ;
<https://w3id.org/nostr#content> "Hello" ;
<https://w3id.org/nostr#kind> "1"^^<http://www.w3.org/2001/XMLSchema#integer> ;
<https://w3id.org/nostr#pubkey> "b4b6bf413339846933284976f4f3dbc397a515560047789c12f7e88a338ba466" ;
<https://w3id.org/nostr#sig> "e8e178caa6354be58a09ee991dc94b76dddd92fb434b38a17f6e527349219ca5817c85231eb87202240f7582b934ce261fd15f529656fab6f604d36e05833eea" .
Create a metadata event
Usage: nostra metadata -n <NAME> -d <DISPLAY_NAME> -a <ABOUT> -n <NIP05>
Options:
-n <NAME> Name
-d <DISPLAY_NAME> Display name
-a <ABOUT> About
-n <NIP05> NIP05
-h, --help Print help
<urn:nostr-event:8b35c8b00938d38ae5503e2814a64ab829d292bbc47de1c149afc8e73413107a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/nostr#Event> ;
<https://w3id.org/nostr#created_at> "1743651766"^^<http://www.w3.org/2001/XMLSchema#integer> ;
<https://w3id.org/nostr#id> "8b35c8b00938d38ae5503e2814a64ab829d292bbc47de1c149afc8e73413107a" ;
<https://w3id.org/nostr#nip21> <nostr:npub1kjmt7sfn8xzxjvegf9m0fu7mcwt6292kqprh38qj7l5g5vut53nq99h50f> ;
<https://w3id.org/nostr#content> <urn:nostr-content:4e606eacec8a15c65ec9985e2f37a42e9fa8c9a7fd288fb09dfc2e8e72f95306> ;
<https://w3id.org/nostr#kind> "0"^^<http://www.w3.org/2001/XMLSchema#integer> ;
<https://w3id.org/nostr#pubkey> "b4b6bf413339846933284976f4f3dbc397a515560047789c12f7e88a338ba466" ;
<https://w3id.org/nostr#sig> "dfeee365fdeefe1cb80f11eb24855df9855d6c2ea0c3fe21cb380e17721b22f03ef12669e69499b3ac6b1f97e14b507297dd9a3b90e9511789a3fb61f5ad1dea" .
<urn:nostr-content:4e606eacec8a15c65ec9985e2f37a42e9fa8c9a7fd288fb09dfc2e8e72f95306> <https://w3id.org/nostr#name> "nostralink" ;
<https://w3id.org/nostr#display_name> "Nostralink" ;
<https://w3id.org/nostr#nip05> "nip05@domain.org" ;
<https://w3id.org/nostr#about> "Linked data for nostr" .
LD note
A JSON-LD note with a headline, language and a body (in CommonMark).
Usage: nostra ld-note [OPTIONS] <TEXT>
Arguments:
<TEXT>
Options:
-l <LANG_TAG> Language
-h <HEADLINE> Headline
-h, --help Print help
With a en-GB language tag:
{
"content": "{\"@context\":\"http://nostralink.org/Note\",\"@id\":\"urn:nostr-content:bc9d24643ecd191c73aec42e123fb0477063f7d921031060ca3578128a772f6c\",\"@type\":\"nostralink:Note\",\"body\":\"My note\",\"headline\":\"Watch out!\",\"inLanguage\":{\"@context\":\"http://nostralink.org/Language\",\"@id\":\"urn:nostr-lang:en-GB\",\"@type\":\"nostralink:Language\",\"alternateName\":\"en-GB\",\"bcp47\":\"en-GB\",\"name\":\"English (United Kingdom)\"}}",
"created_at": 1743944968,
"id": "5e3987828c1ae2fc3c62e216fa59aab6097408594839934a1e647979b8a4679a",
"kind": 7101,
"pubkey": "b4b6bf413339846933284976f4f3dbc397a515560047789c12f7e88a338ba466",
"sig": "7cb2511785dbb0d80b909f0f0856d4ee507c30f8edd550ab4b4a008df1bc44101d3c01212bd0fe95a1e4ff5d4d95897b87087388146a93a61fd7250fac3f8e37",
"tags": []
}
<urn:nostr-event:5e3987828c1ae2fc3c62e216fa59aab6097408594839934a1e647979b8a4679a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/nostr#Event> ;
<https://w3id.org/nostr#created_at> "1743944968"^^<http://www.w3.org/2001/XMLSchema#integer> ;
<https://w3id.org/nostr#id> "5e3987828c1ae2fc3c62e216fa59aab6097408594839934a1e647979b8a4679a" ;
<https://w3id.org/nostr#nip21> <nostr:npub1kjmt7sfn8xzxjvegf9m0fu7mcwt6292kqprh38qj7l5g5vut53nq99h50f> ;
<https://w3id.org/nostr#content> <urn:nostr-content:bc9d24643ecd191c73aec42e123fb0477063f7d921031060ca3578128a772f6c> ;
<https://w3id.org/nostr#kind> "7101"^^<http://www.w3.org/2001/XMLSchema#integer> ;
<https://w3id.org/nostr#pubkey> "b4b6bf413339846933284976f4f3dbc397a515560047789c12f7e88a338ba466" ;
<https://w3id.org/nostr#sig> "7cb2511785dbb0d80b909f0f0856d4ee507c30f8edd550ab4b4a008df1bc44101d3c01212bd0fe95a1e4ff5d4d95897b87087388146a93a61fd7250fac3f8e37" .
<urn:nostr-content:bc9d24643ecd191c73aec42e123fb0477063f7d921031060ca3578128a772f6c> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://nostralink.org/Note> ;
<http://nostralink.org/headline> "Watch out!" ;
<http://nostralink.org/inLanguage> <urn:nostr-lang:en-GB> ;
<http://nostralink.org/commonMarkBody> "My note" .
<urn:nostr-lang:en-GB> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://nostralink.org/Language> ;
<http://nostralink.org/name> "English (United Kingdom)" ;
<http://nostralink.org/alternateName> "en-GB" ;
<http://nostralink.org/bcp47> "en-GB" .
With a fr-FR language tag:
{
"content": "{\"@context\":\"http://nostralink.org/Note\",\"@id\":\"urn:nostr-content:a936e0a65c1d0d244d02f07b7f720ddf0910e253c219a7755bca3eff955d138a\",\"@type\":\"nostralink:Note\",\"body\":\"Une petite note\",\"headline\":\"Bonjour\",\"inLanguage\":{\"@context\":\"http://nostralink.org/Language\",\"@id\":\"urn:nostr-lang:fr-FR\",\"@type\":\"nostralink:Language\",\"alternateName\":\"fr-FR\",\"bcp47\":\"fr-FR\",\"name\":\"French (France)\"}}",
"created_at": 1743945094,
"id": "054503c0a685ce6a48bbb01817889610e96e44b121837ffd1edf57e28feb6e2b",
"kind": 7101,
"pubkey": "b4b6bf413339846933284976f4f3dbc397a515560047789c12f7e88a338ba466",
"sig": "ed2182a3cd1211a82c7481b5abd3689cdd7a43938c88e41dbc742920a25918b9962be48e6f6a4d6b47d655eda08bb73322644de02fdee00939f0c4bc2d8f5627",
"tags": []
}
<urn:nostr-event:054503c0a685ce6a48bbb01817889610e96e44b121837ffd1edf57e28feb6e2b> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/nostr#Event> ;
<https://w3id.org/nostr#created_at> "1743945094"^^<http://www.w3.org/2001/XMLSchema#integer> ;
<https://w3id.org/nostr#id> "054503c0a685ce6a48bbb01817889610e96e44b121837ffd1edf57e28feb6e2b" ;
<https://w3id.org/nostr#nip21> <nostr:npub1kjmt7sfn8xzxjvegf9m0fu7mcwt6292kqprh38qj7l5g5vut53nq99h50f> ;
<https://w3id.org/nostr#content> <urn:nostr-content:a936e0a65c1d0d244d02f07b7f720ddf0910e253c219a7755bca3eff955d138a> ;
<https://w3id.org/nostr#kind> "7101"^^<http://www.w3.org/2001/XMLSchema#integer> ;
<https://w3id.org/nostr#pubkey> "b4b6bf413339846933284976f4f3dbc397a515560047789c12f7e88a338ba466" ;
<https://w3id.org/nostr#sig> "ed2182a3cd1211a82c7481b5abd3689cdd7a43938c88e41dbc742920a25918b9962be48e6f6a4d6b47d655eda08bb73322644de02fdee00939f0c4bc2d8f5627" .
<urn:nostr-content:a936e0a65c1d0d244d02f07b7f720ddf0910e253c219a7755bca3eff955d138a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://nostralink.org/Note> ;
<http://nostralink.org/headline> "Bonjour" ;
<http://nostralink.org/inLanguage> <urn:nostr-lang:fr-FR> ;
<http://nostralink.org/commonMarkBody> "Une petite note" .
<urn:nostr-lang:fr-FR> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://nostralink.org/Language> ;
<http://nostralink.org/name> "French (France)" ;
<http://nostralink.org/alternateName> "fr-FR" ;
<http://nostralink.org/bcp47> "fr-FR" .
Convert an event from stdin
Use the convert command to read an event as JSON from stdin, and convert it to RDF.
cat event.json | nostra convert