Skip to content

Commit 7a48acf

Browse files
committed
Gemtext as separate crate, with parser; RDF/XML support
1 parent 1a171ea commit 7a48acf

14 files changed

Lines changed: 1420 additions & 338 deletions

File tree

Cargo.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[workspace]
22
resolver = "2"
33
members = [
4+
"gemtext-rdf",
45
"server",
56
"sandbox",
67
]

README.gmi

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ More on this in docs/about.gmi
1313
## Features
1414

1515
* Multi-Protocol Server: Custom Tokio+Rustls implementation handling Gemini and Titan natively over TLS, alongside plaintext Spartan and Nex/NPS TCP listeners. Enabled protocols and ports can be configured.
16-
* Linked Data Store: Consumes RDF data in Turtle via rio_turtle and holds them into an in-memory store.
16+
* Linked Data Store: Consumes RDF data in Turtle or RDF/XML via rio and holds them into an in-memory store.
1717
* Gemtext Mapping: A proposed serialization of RDF to the hypertext format of Gemini, offering a recursively browsable knowledge graph. A condensed syntax, which groups predicates by property, is also supported. The specification is documented in the `docs` directory.
1818
* External Proxy: Acts as a browser for all the Linked Open Data out there.
1919

2020
### External Proxy Features
21-
* Encoded URLs in the request path are fetched via reqwest.
22-
* Accept: text/turtle is used for Content Negotiation.
23-
* Fetched RDF is parsed and rendered.
24-
* Links to other external resources are re-encoded to point back to the proxy.
25-
* You can provide a custom TLS certificate via the --cert flag.
21+
* Encoded URLs in the request path are fetched via reqwest.
22+
* Accept: text/turtle is used for Content Negotiation.
23+
* Fetched RDF is parsed and rendered.
24+
* Links to other external resources are re-encoded to point back to the proxy.
25+
* You can provide a custom TLS certificate via the --cert flag.
2626

2727
## Setup & Running
2828

2929
Pretty standard stuff:
3030

31-
1. Dependencies: Rust/Cargo>1.78; Mainly tokio, rustls, rcgen, rio_turtle, rio_api, and reqwest.
31+
1. Dependencies: Rust/Cargo>1.78; Mainly tokio, rustls, rcgen, rio_turtle, rio_xml, rio_api, and reqwest.
3232
2. Build:
3333

3434
```sh
@@ -51,7 +51,7 @@ cargo run
5151
```
5252

5353
The server listens on `127.0.0.1:1965` by default (for Gemini/Titan). Go there with your favourite Gemini client, like
54-
=> gemini://skyjake.fi/lagrange/ Lagrange (simple, stylish, with support for Spartan but not Titan)
54+
=> gemini://skyjake.fi/lagrange/ Lagrange (simple, stylish, with support for Spartan and, recently, for Titan as well)
5555
=> http://metaloupe.com/alhena/alhena.html Alhena (not as fancy, but flexible and multi-protocol) [http]
5656

5757
To run it in a Docker container (mapping the Spartan port to one that doesn't require a super user):
@@ -132,10 +132,10 @@ T=`mktemp` && $EDITOR $T && echo "." >> $T && nc localhost 1915 < $T
132132
Lots and lots, but mainly:
133133
* Move to RDF support via Sophia and access existing triple stores.
134134
* SPARQL API? Only if it can be implemented without compromising the basic principles of the Small Web.
135-
* Gemtext: support for quads, blank node expansion, RDF-star.
135+
* Gemtext: also render statements for subjects other than the one in the request URI.
136136
* Gemtext: context-sensitive links in Gemtext: make them spartan:// or gemini:// depending on the client request.
137-
* Gemtext: where possible, add support for language-specific labels per client request (we don't have the luxury of an Accept-Language header here).
138-
* Not every Linked Data server offers Turtle: support negotiation of at least RDF/XML, too.
137+
* Gemtext: where possible, add support for language-specific labels per client request (we don't have the luxury of an Accept-Language header here, though there is a "lang" parameter in Gemini).
138+
* Gemtext: support for quads, blank node expansion, RDF-star.
139139
* Investigate whether it's worth supporting good old Gopher, too.
140140
* Consider Chaykin extensions to existing Small Web servers in Rust, like Agate.
141141

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ More on this in [docs/about.md](docs/about.md).
1111

1212
## Features
1313
- **Multi-Protocol Server**: Custom Tokio+Rustls implementation handling Gemini and Titan natively over TLS, alongside plaintext Spartan and Nex/NPS TCP listeners. Enabled protocols and ports can be configured.
14-
- **Linked Data Store**: Consumes RDF data in Turtle via `rio_turtle` and holds them into an in-memory store.
15-
- **Gemtext Mapping**: A proposed serialization of RDF to the hypertext format of Gemini, offering a recursively browsable knowledge graph. A condensed syntax, which groups predicates by property, is also supported. The specification is documented at [docs/rdf_gemtext_spec.md](docs/rdf_gemtext_spec.md).
14+
- **Linked Data Store**: Consumes RDF data in Turtle or RDF/XML via `rio` and holds them into an in-memory store.
15+
- **Gemtext Mapping**: A proposed serialization of RDF to the hypertext format of Gemini, offering a recursively browsable knowledge graph. A condensed syntax, which groups predicates by property, is also supported. The specification is documented at [gemtext-rdf/docs/rdf_gemtext_spec.md](gemtext-rdf/docs/rdf_gemtext_spec.md).
1616
- **External Proxy**: Acts as a browser for all the Linked Open Data out there.
1717
- Encoded URLs in the request path are fetched via `reqwest`.
1818
- `Accept: text/turtle` is used for Content Negotiation.
@@ -22,7 +22,7 @@ More on this in [docs/about.md](docs/about.md).
2222

2323
## Setup & Running
2424
Pretty standard stuff:
25-
1. **Dependencies**: Rust/Cargo>1.78; Mainly `tokio`, `rustls`, `rio_turtle`, `rio_api`, and `reqwest`.
25+
1. **Dependencies**: Rust/Cargo>1.78; Mainly `tokio`, `rustls`, `rio_turtle`, `rio_xml`, `rio_api`, and `reqwest`.
2626
2. **Build**:
2727
```bash
2828
cd server
@@ -39,7 +39,7 @@ Pretty standard stuff:
3939
```bash
4040
cargo run
4141
```
42-
The server listens on `127.0.0.1:1965` by default (for Gemini/Titan). Go there with your favourite Gemini client, like [Lagrange](https://gmi.skyjake.fi/lagrange/) (simple, stylish, with support for Spartan but not Titan) or [Alhena](https://metaloupe.com/alhena/alhena.html) (not as fancy, but flexible and multi-protocol).
42+
The server listens on `127.0.0.1:1965` by default (for Gemini/Titan). Go there with your favourite Gemini client, like [Lagrange](https://gmi.skyjake.fi/lagrange/) (simple, stylish, with support for Spartan and, recently, for Titan as well) or [Alhena](https://metaloupe.com/alhena/alhena.html) (not as fancy, but flexible and multi-protocol).
4343

4444
To run it in a Docker container (mapping the Spartan port to one that doesn't require a super user):
4545
```bash
@@ -115,10 +115,10 @@ Lots and lots, but mainly:
115115
- Move to RDF support via [Sophia](https://docs.rs/sophia/) and access existing triple stores.
116116
- SPARQL API? Only if it can be implemented without compromising the basic principles of the Small Web.
117117
- Gemtext serialization improvements:
118-
- Support for quads, blank node expansion, RDF-star.
118+
- Also render statements for subjects other than the one in the request URI.
119119
- Context-sensitive links in Gemtext: make them `spartan://` or `gemini://` depending on the client request.
120-
- Where possible, add support for language-specific labels per client request (we don't have the luxury of an `Accept-Language` header here).
121-
- Not every Linked Data server offers Turtle: support negotiation of at least RDF/XML, too.
120+
- Where possible, add support for language-specific labels per client request (we don't have the luxury of an `Accept-Language` header here, though there is a `lang` parameter in Gemini).
121+
- Support for quads, blank node expansion, RDF-star.
122122
- Investigate whether it's worth supporting good old Gopher, too.
123123
- Consider Chaykin extensions to existing Small Web servers in Rust, like [Agate](https://github.com/mbrubeck/agate).
124124

gemtext-rdf/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "gemtext-rdf"
3+
version = "0.1.0"
4+
edition = "2024"
5+
license = "MIT OR Apache-2.0"
6+
description = "RDF serialization and parsing for Gemtext format"
7+
8+
[dependencies]

0 commit comments

Comments
 (0)