Summary
When serving the HTML view of a stored resource, JSS embeds a JSON-LD data island
in the response. This works for resources stored as JSON-LD. For resources stored
in Turtle or N3, the data island is currently empty.
This issue tracks adding server-side format translation so all stored RDF formats
populate the data island uniformly.
Current Behavior
| Stored content type |
Data island populated? |
application/ld+json |
yes |
text/turtle |
no |
text/n3 |
no |
Proposed Behavior
In the HTML path of src/handlers/resource.js:
- If stored content is JSON-LD → embed as-is (current behavior).
- If stored content is Turtle / N3 → parse (n3.js) and serialize to JSON-LD,
then embed.
- If parse/serialize fails → omit the data island; existing fetch-based render
continues to work.
Scope
src/handlers/resource.js: select translation path by content type.
- Small helper, e.g.
src/rdf/toJsonLd.js.
- Tests:
- JSON-LD passthrough unchanged
- Turtle → JSON-LD embedded correctly
- N3 → JSON-LD embedded correctly
- Parse-failure falls back cleanly (no broken HTML)
Out of Scope
- Client-side consumption of the data island.
application/rdf+xml (rare; fall back to network fetch).
- Streaming for very large resources (already capped at 256 KB).
Acceptance
- HTML view of a Turtle-stored resource emits a non-empty
<script type="application/ld+json" id="dataisland">.
- Same for N3.
- JSON-LD passthrough behavior unchanged.
- Existing tests remain green; new tests cover the three cases above.
Summary
When serving the HTML view of a stored resource, JSS embeds a JSON-LD data island
in the response. This works for resources stored as JSON-LD. For resources stored
in Turtle or N3, the data island is currently empty.
This issue tracks adding server-side format translation so all stored RDF formats
populate the data island uniformly.
Current Behavior
application/ld+jsontext/turtletext/n3Proposed Behavior
In the HTML path of
src/handlers/resource.js:then embed.
continues to work.
Scope
src/handlers/resource.js: select translation path by content type.src/rdf/toJsonLd.js.Out of Scope
application/rdf+xml(rare; fall back to network fetch).Acceptance
<script type="application/ld+json" id="dataisland">.