Read-only mirror.
@jeswr/solid-bookmarkis developed in the jeswr/solid-sdk monorepo and published here byscripts/mirror-publish.mjssogithub:-pinned installs keep working — do not edit or PR this repo. File issues on the monorepo.
The RDF vocabulary + typed model for bookmarks / read-it-later — the data model for a Linkding→Solid fork.
It mints only the terms standard vocabularies lack and reuses dereferenceable
schema.org + Dublin Core for the rest, ships the ontology + a SHACL shape that
pin the contract, and gives you typed read/write accessors that never hand-build
a triple (parse via @jeswr/fetch-rdf,
serialise via n3.Writer).
GitHub-installable now (no build step — the built dist/ is committed and the
package sets ignore-scripts=true):
npm install github:jeswr/solid-bookmark#mainMinted here — exactly the three terms schema.org / Dublin Core / SKOS do not provide:
| Term | Kind | Meaning |
|---|---|---|
book:Bookmark |
class | A saved bookmark / read-it-later entry. Rooted rdfs:subClassOf core:InformationResource (the gUFO-rebased Solid Core, https://w3id.org/jeswr/core#). |
book:archived |
xsd:boolean |
Whether the bookmark is archived (Linkding is_archived). Absent reads as false. |
book:notes |
xsd:string |
The user's free-text markdown notes (Linkding notes). |
Reused (nothing minted):
| Predicate | Used for | Linkding field |
|---|---|---|
schema:url |
the bookmarked URL (an IRI) | url |
schema:keywords |
tags (one string literal per tag) | tag_names |
dct:title |
title | title |
dct:description |
short summary / blurb | description |
dct:created |
when added | date_added |
dct:modified |
when last changed | date_modified |
- Rooting —
core:InformationResource, notschema:BookmarkAction. Abook:Bookmarkis the saved thing (an information resource), whereas aschema:BookmarkActionis the act of bookmarking. Making the saved thing a subclass of the action is a category error, so the package roots in the suite core and carries only a thinskos:closeMatch schema:BookmarkActionannotation (discovery, no entailment). Seebookmark.ttl. - Tags —
schema:keywordsliterals, notskos:Concept. Linkding tags are a flat, free-text list with no hierarchy or stable concept IRIs — exactly whatschema:keywordsis for. A SKOS taxonomy can be layered on additively later without changing this wire format.
schema.org uses the canonical http://schema.org/ scheme, matching the
existing suite producers (@jeswr/solid-task-model).
import {
buildBookmark,
serializeBookmark,
parseBookmark,
parseBookmarkTtl,
bookmarkShapeTtl,
Bookmark,
} from "@jeswr/solid-bookmark";
// Build + serialise to Turtle (n3.Writer under the hood)
const ttl = await serializeBookmark("https://alice.example/bookmarks/1", {
url: "https://example.org/article",
title: "Great article",
notes: "## why I saved this",
archived: false,
tags: ["solid", "rdf"],
});
// Parse a fetched RDF document back (dispatches via @jeswr/fetch-rdf — any
// content-type it supports: Turtle, N-Triples, N-Quads, TriG, JSON-LD)
const data = await parseBookmarkTtl("https://alice.example/bookmarks/1", ttl, "text/turtle");
// → { url, title, notes, archived, tags, created, ... }
// Or work on an in-memory dataset directly with the typed accessor
import { Store } from "n3";
const store = new Store();
const doc = new Bookmark("https://alice.example/bookmarks/1#it", store).mark();
doc.url = "https://example.org/x";
doc.archived = true;
doc.tags.add("later");import { bookmarkShapeTtl } from "@jeswr/solid-bookmark";
import { Parser } from "n3";
import env from "@zazuko/env-node";
import SHACLValidator from "rdf-validate-shacl";
// feed bookmarkShapeTtl() as the shapes graph and your data as the data graphThe shape lives at bookmark.shacl.ttl (also a subpath export:
@jeswr/solid-bookmark/bookmark.shacl.ttl), the ontology at bookmark.ttl.
./ (main — browser-safe, no node:*): Bookmark, BookmarkData,
bookmarkSubject, buildBookmark, serializeBookmark, storeToTurtle,
parseBookmark, parseBookmarkTtl, isHttpIri; and the vocab
constants/builders (BOOK, BOOKMARK_CLASS, BOOK_ARCHIVED, BOOK_NOTES,
SCHEMA_URL, SCHEMA_KEYWORDS, DCT_*, PREFIXES, …).
./shape (Node-only — readFileSyncs the shipped .ttls):
bookmarkOntologyTtl, bookmarkShapeTtl, BOOKMARK_ONTOLOGY_PATH,
BOOKMARK_SHAPE_PATH. Kept off the root so a browser bundle importing
buildBookmark never pulls in node:fs.
Subpath exports: @jeswr/solid-bookmark/vocab, /shape, /bookmark.ttl,
/bookmark.shacl.ttl.
npm run gate # lint + typecheck + test + build + check:dist + check:lockfile-transportdist/ is committed and a check:dist gate fails if it drifts from a fresh
build — rebuild + commit dist/ alongside any src/ change.
MIT © Jesse Wright