Version 8.8.0

All pages

Data model in the pod

Solid Memo keeps everything a learner makes and studies in their own Solid Pod, as linked data files in one folder, the instance. This page says which file holds what, how the app finds the files after a login, and how it writes them without losing a change made on another device.

The code is in packages/adapters/solid/src/: the vocabulary in vocab.ts, discovery in typeIndex.ts. The app reads and writes the pod by the Solid Protocol, and finds Solid Memo's data through the type indexes, an editor's draft (standards.md).

Vocabulary and shapes

Solid Memo mints its own terms under https://solid-memo.com/ns/vocab/v1.ttl# (prefix sm: below); no existing RDF vocabulary covers spaced repetition. ns/vocab/v1.ttl defines them (vocab.md), and a SHACL shape under ns/shapes/ says what a valid subject of each class looks like, version by version (shapes.md). The site publishes both, and the app's constants, record types and descriptors are generated from them. Readers ignore unknown triples, and writers never delete triples they don't understand.

Every subject Solid Memo writes carries sm:formatVersion. A subject with neither that stamp nor a Solid Memo class is another app's, unless it's the catalog or a subject of Solid Memo's names it as its creator, publisher or distribution. Another scheduler's review state is another app's too. The data check only warns about them (validation.md).

From pod data to the domain model
A subject is read as a versioned shape record, migrated to the latest record and mapped to the domain model, and a model is written back the same way in reverse.
The diagram's source
flowchart LR
    accTitle: From pod data to the domain model
    accDescr: A subject is read as a versioned shape record, migrated to the latest record and mapped to the domain model, and a model is written back the same way in reverse.
    thing["Subject<br/>(client/rdf.ts)"] -->|readVersioned| record["shape record<br/>e.g. CardV1"]
    record -->|migrate| latest["latest record<br/>CardV2"]
    latest -->|cardFromRecord| model["domain model<br/>Card"]
    model -->|cardToRecord| latest
    latest -->|recordThing| thing

Discovery chain

The discovery chain
From the WebID, the app follows the storage and the private and public type indexes to the instance container, and from the instance's folder to the rest of its data.
The diagram's source
flowchart LR
    accTitle: The discovery chain
    accDescr: From the WebID, the app follows the storage and the private and public type indexes to the instance container, and from the instance's folder to the rest of its data.
    W[WebID] -->|pim:storage| S[Storage root]
    W -->|solid:privateTypeIndex<br/>directly and via pim:preferencesFile| PTI[Private type indexes]
    W -->|solid:publicTypeIndex| PUB[Public type indexes]
    PTI -->|solid:TypeRegistration<br/>forClass sm:Instance| I1[Instance container]
    PUB -->|solid:TypeRegistration<br/>forClass sm:Instance| I2[Instance container]
    I1 -->|the folder's layout| D1["catalog.ttl, decks/, reviews/,<br/>history/, drafts/"]
    I2 -->|the folder's layout| D1

Choosing a type index

Creating an instance, adding one by its address or moving a guest's study offers every type index of the user's they can read now (getRegistrationOptions, readTypeIndexChoices in typeIndex.ts), ranked (rankedFor in typeIndexChoice.ts). One that isn't there, or that the user may not read (401, 403), isn't offered. Any other failed read (a timeout, a server error) fails the choices, as it may work when tried again: an index left out for it would be offered as one to create. Each index of a kind is ranked in this order:

  1. one that already holds a Solid Memo instance;
  2. the one the preferences file links (private only);
  3. one typed as its kind (solid:UnlistedDocument for private, solid:ListedDocument for public) before one that says neither;
  4. otherwise by address, never by the order of a profile's triples.

Three things move an index to the end of its kind. From last: a type that says it's the other kind, a document linked as both kinds, and a public index no one else can read. The best private index is preselected as Recommended (RegistrationTargetChooser.tsx). A kind the user has none of is offered as one to create. The user may enter any other type index of theirs by its address (above). A target of a kind alone ("private", "public") registers in the best index of that kind, or creates one (ensureTypeIndex).

Each index is also read as no one (HEAD, readableByAnyone), and the chooser says what may make it the wrong one:

Each public choice says what public means: anyone can see that the instance exists, its name and where it is, and who can open it is still decided by its access settings.

Registrations

In the type index, the instance's one registration, by which Solid Memo finds it:

<#sm-inst-9f3c1a> a solid:TypeRegistration ;
    solid:forClass sm:Instance ;
    solid:instanceContainer <https://pod.example/solid-memo/main/> ;
    dcterms:title "Japanese study" .

Earlier versions of the app wrote one more for each class of the instance's data, titled with the instance's name, so a pod may still hold them. Each index that registered the instance got dcat:Catalog naming catalog.ttl#catalog, sm:Deck naming catalog.ttl (both with solid:instance) and sm:Card naming decks/ (with solid:instanceContainer). The private index alone got sm:ReviewState naming reviews/, sm:Answer naming history/ and sm:Deck naming drafts/. Their ids start #sm-cat-, #sm-deck-, #sm-card-, #sm-review-, #sm-answer- and #sm-draft-:

<#sm-card-7a21d9> a solid:TypeRegistration ;
    solid:forClass sm:Card ;
    solid:instanceContainer <https://pod.example/solid-memo/main/decks/> ;
    dcterms:title "Japanese study" .

meta.ttl makes a container self-describing: attach-by-URL reads it to recover an instance that lost its registration. Deleting an instance, or removing it from the list, removes the sm:Instance registration by its container, and each one an earlier version wrote by the exact IRI it names (<container>catalog.ttl#catalog, <container>catalog.ttl, <container>decks/, <container>reviews/, <container>history/, <container>drafts/). None is removed by what lies under the container, where another app may have registered its own data. A registration that registers something else too keeps it, and loses only the link to the instance's data. A registration is removed whole only when the app named it and it says nothing but what the app writes of one. The app named it when its id is in the index document, with a fragment that starts with the prefix of a class it was found under and a dash. Every version of the app named them so: #sm-inst- for sm:Instance, and the prefixes listed below for the others. It says nothing but what the app writes when it has its type solid:TypeRegistration, solid:forClass for the class it was found under and no other, the links, each an IRI, and a dcterms:title literal. The index's own subject is never removed. Any other registration loses only the links to the instance's data. Every other statement stays, its type, classes and title among them, so a registration a later version gave more statements than these stays too, without the links. With no link left, it no longer registers the instance's data. Renaming an instance retitles only a registration the app named, that says nothing but what the app writes and names nothing but the instance's data, so it never changes another app's title, nor another instance's. Those an earlier version wrote for an instance whose sm:Instance registration went some other way stay, as the app no longer lists that instance to remove.

From Preferences, the user can remove those an earlier version wrote for the open instance on the list, keeping the instance. "Old registrations" is offered when an index holds any, never to a guest and never on its own (removeOldRegistrations in typeIndex.ts). It reads and writes only the user's own type indexes, and takes a registration for one of the app's old ones only when all of these hold:

A registration that names the same IRI under another id stays: it may be another app's. An sm:Instance registration is never removed or changed, even one that also registers a class above. A registration that names something else too loses only the link to the instance's data, and one that says more than the app writes keeps the rest, as above. Each index is written once, with If-Match as above, and only when it holds one. An index that can't be read is said to be so, and isn't written.

Instance layout

<storage>solid-memo/<name>/          (default path; user-editable)
├── meta.ttl        #it: a sm:Instance; dcterms:title; dcterms:created;
│                        on an instance an earlier version's format
│                        update made, dcterms:replaces and
│                        dcterms:modified, ignored and kept;
│                        sm:formatVersion 2
├── preferences.ttl #it: a sm:Preferences (created with the instance,
│                        FSRS-6 its scheduler; an instance made before
│                        has none until its first save, and reads as
│                        SM-2): study caps, sm:answerScale,
│                        sm:developerMode, sm:invalidDataPolicy, sm:theme,
│                        sm:studyScheduler (sm:sm2 or sm:fsrs6),
│                        sm:desiredRetention,
│                        sm:schedulerInvitationDismissed, sm:palette
│                        (a concept of sm:Palettes, or another IRI,
│                        kept), sm:textSize, sm:formatVersion 6;
│                        whether logging in skips the Connected
│                        screen (sm:connectedScreenSkipped true,
│                        outside the shape)
├── palettes.ttl    the palettes the user designed, if any: one
│                        sm:Palette per palette (#palette-<id>),
│                        dcterms:title, sm:basedOn, sm:lightColors and
│                        sm:darkColors, its sm:ColorSet subjects beside
│                        it (#palette-<id>-light, #palette-<id>-dark),
│                        a #rrggbb color for each role it sets;
│                        sm:formatVersion 1; the app reads the first
│                        MAX_PALETTES (100) (docs/theme.md)
├── catalog.ttl     one subject per deck (titles live ONLY here), a
│                        sm:Deck and dcat:Dataset: sm:formatVersion 6,
│                        dcterms:description, sm:studyDirection, optional
│                        dcterms:creator/license, dcat:theme,
│                        dcat:keyword (language-tagged),
│                        prov:wasDerivedFrom, the deck's own study caps
│                        (sm:deckNewCardsPerDay/MaxReviewsPerDay), and
│                        for a course the chapters completed
│                        (sm:completedChapter); the language its
│                        card text (and a course's text) is shown
│                        in first (sm:deckCardLanguage, outside the
│                        shape); the hosts whose pictures it shows
│                        (sm:deckPictureHost, outside the shape);
│                        a pause (sm:deckPausedAt, sm:deckResumesOn,
│                        outside the shape);
│                        beside each deck its
│                        dcat:Distribution (#deck-X-cards) and the
│                        foaf:Agent nodes of its creators (#agent-…);
│                        and the deck groups (#group-…), a sm:DeckGroup
│                        and dcat:Catalog each: sm:formatVersion 1;
│                        on the catalog, its drafts (sm:releaseDraft)
├── decks/<deckId>.ttl    card corpus: one sm:Card per fragment (slow churn),
│                        sm:front/back text and/or sm:frontImage/backImage
│                        IRIs, optional sm:frontImageDescription/
│                        backImageDescription (a picture's alt text),
│                        sm:frontNote/backNote under each
│                        side and sm:frontLabel/backLabel above it,
│                        dcterms:subject (what it is about), the
│                        release it was taken from (sm:fromRelease,
│                        outside the card format), each
│                        with sm:formatVersion; a retired card
│                        (owl:deprecated true) is kept but not studied;
│                        a card names its wrong options
│                        (sm:distractor, and schema:suggestedAnswer),
│                        sm:Distractor subjects beside it; a retired
│                        one (owl:deprecated true) is kept but never
│                        offered; the document itself (<>)
│                        dcterms:isPartOf the deck's entry
├── reviews/<deckId>.ttl  SM-2 state: one sm:ReviewState per card and
│                        direction (fast churn) — #<cardId> front→back,
│                        #<cardId>@back-to-front the other way — naming
│                        its card (sm:reviewOf), its direction
│                        (sm:reviewDirection) and sm:scheduler sm:sm2;
│                        optional sm:previous* snapshot = state before
│                        the day's first review (restored by "reset the
│                        day"); sm:formatVersion 2. Beside it, once FSRS-6
│                        has scheduled the prompt, its FSRS-6 state:
│                        sm:scheduler sm:fsrs6, #<cardId>@fsrs6 or
│                        #<cardId>@back-to-front@fsrs6, stability,
│                        difficulty, due day, its own snapshot;
│                        sm:formatVersion 1; the document itself (<>)
│                        dcterms:isPartOf the deck's entry
├── history/<YYYY-MM>.ttl  the answer log (below): one sm:Answer per grade
│                        given in study or a course that month,
│                        appended, never edited; sm:formatVersion 1
├── drafts/<name>/v<N>/   a draft of a release, linked from the catalog
│                        (sm:releaseDraft): release.ttl, its root (the
│                        draft deck, sm:formatVersion 1), agents, sources
│                        and how it was made; chapter-<id>.ttl per
│                        chapter; cards.ttl, the cards no chapter asks
│                        ([below](#drafts-and-releases))
├── releases/<name>/v<N>.ttl  a release published from a draft, linked
│                        from the catalog (sm:publishedRelease): one
│                        document, readable by everyone, never written
│                        again (the user may publish elsewhere instead)
└── digest.ttl      derived data (below): a sm:DocumentReceipt per document
                         (#receipt-<path>), a sm:DeckSchedule per deck
                         (#schedule-<path>) and a sm:MonthSummary per past
                         month of the answer log (#month-<path>), each
                         stamped with the versions it was learned from;
                         a path past 256 characters is named by its
                         hash instead, #<kind>~sha256-<hash>;
                         sm:formatVersion 1 (a receipt or a month
                         summary), 2 (a schedule)

A deck's documents are found through its catalog entry (sm:cardsDocument, sm:reviewsDocument), never by name: an earlier version's library upgrade moved them to decks/<deckId>-<uuid>.ttl and reviews/<deckId>-<uuid>.ttl. Today's upgrade writes them where they are (migrations).

Where an instance's documents are

A catalog, a type index and every link in them are untrusted data (markdown.md). An address they name is used only where Solid Memo keeps such documents, or, for a deck's documents, only as they allow (below). The address and the folder are first taken as a request sends them (new URL(…).href, canonicalUrlOf), which resolves a dot segment (.., %2e%2e in any case) and spells the host and any character outside ASCII one way. Then the address is checked to be in the folder (isDocumentIn in instanceLayout.ts; the graph does the same). An instance written otherwise, https://Pod.example/kortlekar-å/, keeps its decks, and a link that climbs out of it doesn't lead there.

After the folder, an address may hold nothing a server might read as a step out of it, though a request leaves it as it is:

No document Solid Memo names has any.

Decks and cards

Reading a whole deck is one GET (the N+1 problem: Solid servers have no batch requests or SPARQL), and a study session never rewrites card content.

An instance's documents
A deck in the catalog links its creator, its distribution, its cards document and its reviews document, and each review state points to its card.
The diagram's source
graph LR
    accTitle: An instance's documents
    accDescr: A deck in the catalog links its creator, its distribution, its cards document and its reviews document, and each review state points to its card.
    C["catalog.ttl#deck-X<br/>a sm:Deck, dcat:Dataset<br/>dcterms:title, dcterms:description<br/>sm:formatVersion<br/>sm:studyDirection<br/>sm:cardsDocument<br/>sm:reviewsDocument"]
    A["catalog.ttl#agent-…<br/>a foaf:Agent<br/>foaf:name, foaf:mbox"]
    X["catalog.ttl#deck-X-cards<br/>a dcat:Distribution<br/>dcat:accessURL"]
    C -->|dcterms:creator| A
    C -->|dcat:distribution| X
    D["decks/deck-X.ttl#card-N<br/>a sm:Card<br/>sm:front / sm:back<br/>sm:frontImage / sm:backImage<br/>sm:formatVersion<br/>owl:deprecated (retired)"]
    R["reviews/deck-X.ttl#card-N<br/>reviews/deck-X.ttl#card-N@back-to-front<br/>a sm:ReviewState<br/>SM-2 fields<br/>sm:reviewDirection, sm:scheduler"]
    C -->|sm:cardsDocument| D
    C -->|sm:reviewsDocument| R
    D -.->|the document: dcterms:isPartOf| C
    R -->|sm:reviewOf, else the same fragment id| D

An instance's URL is permanent, and so is every document's and subject's in it: the format update and the library upgrade write the documents where they are, and change no registration: the format update writes nothing outside the instance. Another app may keep a link to the instance, a deck, a card or a review state.

The catalog

catalog.ttl#catalog is a dcat:Catalog (shape CatalogV1) of the instance's decks. It has a dcterms:title (the instance's name), a dcterms:description and a dcterms:publisher: the pod owner's WebID, described in the same document as a foaf:Agent with their profile's foaf:name. Its dcat:themeTaxonomy names the topics scheme and the EU data themes, and its dcat:dataset each deck. It may state a license (dcterms:license), which the document then types a dcterms:LicenseDocument, as DCAT-AP asks; a license it no longer states loses that type.

Saving a deck adds only that deck's link, and removing a deck removes only its own. A dataset another app listed in the catalog stays listed through every deck save and every write of the whole catalog. The one link a whole write drops is one to a subject of the catalog's own document that's no dcat:Dataset, left by a deck removed some other way (it would fail DCAT-AP's class check). A member another app described in the document keeps its link whatever its class; the check only warns about it (validation.md). A dataset in another document isn't held to its class (validation.md), and an instance listing one stays valid on real servers (foreignData.integration.test.ts).

A catalog is data anyone may have written, so the app reads at most MAX_CATALOG_LINKS (1,000) decks of it, in the deck list and its arrangement, the statistics and the format update as in the Studio (catalogLinks.ts). Past that, it reads none of them and says why (catalogTooManyLinks). So no deck is added past it. A new deck, a copy from a link or a course, or a deck file is refused before anything is written once the catalog has that many (catalogFull). A guest's decks that would take it past them are refused too (guestMergeTooManyDecks). The same limit holds for its links to drafts and releases (Drafts and releases). The deck list works out the study counts of three decks at a time (getStudyCounts in study.ts), each reading the deck's two documents, so a long list never reads all of them at once. The statistics' card progress (getCardProgress in statistics.ts) reads its decks in turns of the same size, three decks at a time, in a queue of its own; the Studio's schedule screen reads its one deck outside it. A deck's turn ends only once both its reads have, even when one of them fails first. The Studio's deck checks (checkDeck in instanceChecks.ts) take turns of the same size in a queue of their own. The Studio's Home reads its decks' cards in turns too, six decks at a time (listCardsInTurn in cards.ts), and its library copies' plans (planLibraryUpgrade) read their cards in the same turns. A screen of one deck reads its cards outside them, and Home keeps its reads under a key of its own, so that screen never waits for one Home has queued.

The catalog is written when an instance is created, and by the format update for an instance made before there were catalogs; it has no registration of its own (Discovery chain). A catalog that doesn't fit its shape is invalid data, which no write replaces with another. The whole document conforms to DCAT-AP, a course's deck typed schema:Course too (Courses), and a test holds what the app writes to it.

The instance's name is in the meta document's dcterms:title, the catalog's dcterms:title, and the dcterms:title of its registrations in each type index. Its sm:Instance one names it in the instance list, beside any an earlier version wrote for its data. Renaming it in the Studio (renameInstance, studio.md) writes them all, each document read and written again on a 412. It checks the catalog's write before writing anything, so a catalog a newer version of the app wrote refuses the rename with nothing written. A catalog description the old name gave (defaultCatalogDescription) follows the new name; one the user wrote stays. A name too long for that description to fit the bound on a term is cut short in it, with an ellipsis after it.

A deck's description, topics and keywords are edited in its Browser ("Describe deck") and on its about screen in the Studio, the keywords as one comma-separated list per language the user states. The description is required, as DCAT-AP asks. Only the keyword languages the user states in an edit are checked and stored in their canonical form ("iw" → "he"). A tag the deck already has is kept as stored, even one another app wrote that the app wouldn't accept from the user.

Deck groups

The user arranges the deck list into named groups that can nest. A group is a subject of catalog.ttl beside the decks, a sm:DeckGroup and a dcat:Catalog (shape DeckGroupV1), never a dcat:Dataset, listing sub-catalogs with dcat:catalog and datasets with dcat:dataset, as DCAT-AP allows. The order is Solid Memo's own sm:position (DCAT's dcat:prev/next are series versions, and the library uses them as such).

<#catalog> a dcat:Catalog ; …
    dcat:dataset <#deck-a>, <#deck-b>, <#deck-c> ;   # still every deck
    dcat:catalog <#group-x1> .                       # the top-level groups
<#group-x1> a sm:DeckGroup, dcat:Catalog ;
    sm:formatVersion 1 ;
    dcterms:title "Languages"@en ;                   # one name, in the UI's language
    dcterms:description "Deck group: Languages."@en, "Kortleksgrupp: Languages."@sv ;   # generated
    dcterms:publisher <https://alice.example/profile/card#me> ;   # the catalog's
    dcat:dataset <#deck-a>, <#deck-b> ;
    dcat:catalog <#group-y2> ;
    sm:position 0 .
<#deck-a> sm:position 0 .

What isn't one valid tree is read as one, not refused. A link to nothing, from a group to itself, or of the wrong kind (a dcat:dataset link to a group, a dcat:catalog link to a deck) is ignored. A subject the app reads as a deck is a deck only, even when it's also typed as a group: it's never a group too, and its own links to members are ignored. A node several parents list goes to the group with the lowest URL, except a group the catalog's dcat:catalog lists, which stays at the top level. A cycle is broken by moving its lowest-URL group to the top level. A group nested deeper than 16 groups (MAX_GROUP_DEPTH) is read at the top level, with the groups it holds counting their depth from there. The editor doesn't stop a move that nests a group deeper, so the next read shows that group at the top level. A negative position counts as none, and so does one larger than the app holds exactly (2^53 − 1): the node sorts last, and a group written again is written without it, or renumbered when its level is reordered. On a tie of positions, decks come before groups, each kind in document order. A group in a format newer than the app's makes the arrangement read-only. So does, under the "Set invalid data aside" policy (sm:blockSubject, the default), a catalog or group that doesn't conform, or that check still running (validation.md). A group the app can't read is never edited: its members show at the top level, and the catalog's dcat:catalog keeps its link.

A catalog is data anyone may have written, and the deck list draws a row for every group, so the app reads at most 1,000 groups of it (MAX_DECK_GROUPS in deck.ts), as it reads at most MAX_CATALOG_LINKS decks (The catalog). Past that, it reads none of the catalog's arrangement, so the deck list and every screen built on it (the Studio's Groups, Decks table, Transfer and Drafts) show none of its decks, and it says why (catalogTooManyLinks). An edit that would make one group more is refused before anything is written (catalogFull), as is adding a guest's study whose groups would. The deck list draws what a group holds only while the group is open: once a group has folded shut, its rows are gone from the page.

Writing an arrangement. The screen sends an edit, not a finished layout (DeckTreeEdit in deckTree.ts). An edit moves a node after a sibling, combines two into a new group, renames or removes a group, or gathers decks at the end of a group (the Studio's bulk move). Keeping a guest's study grafts new groups around decks the tree has at the end of the top level, a no-op once one of its groups is there. The repository (editDeckTree in solidDeckRepository.ts) applies the edit to catalog.ttl as the pod holds it then:

Several decks at once. The Studio changes several decks in one write of catalog.ttl (studio.md). A move into a group is one gather edit, which leaves a deck already in the group where it is, so a retry changes nothing. A pace or a direction is one edit of every entry as it is now (editDecks), read and made again on a 412. Removing decks first removes their cards and review states from their documents, deleting each document that then holds nothing else (one holding another app's data too is kept, keptDocuments), then their entries in one save (removeDecks). A document another deck still names, in any spelling a server may read as its address, in any case too, as a file system that ignores case stores it (documentKeyOf), is kept. Either way the catalog document is rewritten once for all the decks (withDecks, withoutDecks), not once per deck, so a change to many decks takes time that grows with them, not their square. A link of the catalog or of a deck group that is no URL the app can write (another app may have written one) stays as it is, and the rest of the links are changed around it. The same holds when the deck list is rearranged: such a link is no member of the arrangement, and renaming, moving or combining groups keeps it.

Wrong options

Any card may have wrong options, shown beside its back in a multiple-choice question (courses.md). Each is an sm:Distractor subject of the card's document, typed schema:Answer too, with sm:formatVersion 1, its text (sm:distractorText) and, optionally, why it's wrong (sm:distractorNote). The card names each with sm:distractor and, since vocabulary 1.16, schema:suggestedAnswer (below), in step through every write of a card (bulk edits, moves, copies and imports, a course's question joining the deck included). Solid Memo's card editor and the Studio's card inspector edit them (studio.md; the domain is distractors.ts):

Courses

A course is a library release with an outline of chapters and steps. Its state uses the documents above and no new type-index entries:

# catalog.ttl
<#deck-x> a solid-memo:Deck , dcat:Dataset ; …
    prov:wasDerivedFrom <https://solid-memo.com/decks/solid-fundamentals/v1.ttl> ;
    solid-memo:completedChapter <https://solid-memo.com/decks/solid-fundamentals/v1.ttl#ch-why-solid> .

Drafts and releases

Vocabulary 1.18 and its shapes let a creator write a release in their own pod, as a draft, before publishing it (vocab.md, studio.md):

The answer log

Every grade given in study is kept for the statistics (statistics.ts): activity by study day, streaks, how well reviews were remembered, in all and month by month (monthlyRetention), and the running total of prompts introduced (introducedOverTime). How many prompts are new, young and mature, and the reviews due ahead, come from the review states, not the log (srs.md): a review state says only where a card stands now, and the log is the history. Once a day has answers, a strip above the deck list says what the day came to (todayOf, statistics.md). The log is source data: nothing could rebuild it.

The digest

digest.ttl lets a visit skip what hasn't changed. It holds only what Solid Memo learned of the other documents, each fact stamped with the version (ETag) of the document it was learned from (studyDigest.ts):

Counting a deck through the digest
The app reads the digest, then asks for each deck's cards with the version the digest holds, and the pod answers 304 when nothing changed or 200 with the document when it did.
The diagram's source
sequenceDiagram
    accTitle: Counting a deck through the digest
    accDescr: The app reads the digest, then asks for each deck's cards with the version the digest holds, and the pod answers 304 when nothing changed or 200 with the document when it did.
    participant App
    participant Pod
    App->>Pod: GET digest.ttl
    App->>Pod: GET decks/d.ttl If-None-Match: <its version in the digest>
    alt unchanged
        Pod-->>App: 304 — counts from the schedule, no check
    else changed (or no digest yet)
        Pod-->>App: 200 + the document — counts and check from it
        App->>Pod: PATCH digest.ttl (in the background)
    end

Decks as files

The Studio saves a deck as a file, and makes a deck of a file (studio.md): Turtle or JSON-LD, one deck to a file. The domain names its parts (deckFile.ts), and the DeckArchive port reads and writes it (solidDeckArchive.ts).

An export holds triples as the pod has them, at the pod's IRIs:

Nothing else of either document goes: a deck may name a document that holds more than the deck. Each of the two documents is read as the user only when it's the instance's (ReadScope.isInstances), as a move or copy of cards reads its source. An instance attached from someone else's pod may name a document of the user's own. Any other is read as no one.

Nothing is rewritten: a deck still at an older format is exported at it. A JSON-LD file is flattened: every subject is a node of its @graph, and its @context is the prefixes the Turtle uses too (sm, dcterms, dcat and so on), written in full.

An export is refused (unwritableTerm) when it names an IRI whose scheme is one of those prefixes, such as <sm:Deck>, which names no term of the app. The Turtle writer would write it as the prefixed name it looks like, and JSON-LD reads it as one, so the file would read back as other triples; neither format can escape it. So is an IRI whose scheme is _, or that starts with @, which JSON-LD reads as a blank node or a keyword (isPrefixedLookalike in writableTerms.ts). An import refuses a file that names such an IRI the same way (unwritableTerm), so no deck it imports has one its export refuses.

A new Studio draft is refused the same way (unwritableTerm), with nothing written, whether it's made from a release file, as the next version of a release, from a deck or as a copy. The prefixes are those a Solid client library commonly writes a document with (dc, ldp, vcard and so on), a release's and a deck file's. The app writes each document with every IRI in full, so none would be saved as another term. Still, a draft holds none that another tool, or the deck's export, would write as a prefixed name. It's refused when it's made, not later when it's exported as a deck (studio.md).

An import reads the file as the pod is read, with the same mappers:

The deck is then written as a new deck of the instance (importedDeck). It keeps the file's deck id, so a deck exported, removed and imported again comes back at its URLs, and the log's answers name it again. It takes a fresh id when the instance has a deck by that id or one using a document of that name, or when the id or its distribution's (<id>-cards) is already a subject of the catalog. So does an id the app wouldn't give (deck-…), so no deck lands on #catalog, a group or an agent. Its cards keep their ids.

Only what Solid Memo knows of the deck and its cards is written, as any deck: triples another app put there are in the file, but not imported. Each card names its wrong options with sm:distractor and schema:suggestedAnswer, each typed sm:Distractor and schema:Answer. Each review state names its card in the new cards document (sm:reviewOf), its direction and sm:sm2. Its FSRS-6 states come too, as the app's own; a state of another scheduler isn't imported. The deck needs no type-index registration of its own (Registrations). The writes follow the write discipline: the cards document is created (If-None-Match), the reviews document written, and then the deck's entry added to the catalog, each checked against the shapes.

UI gaps

What the data model holds that Solid Memo's screens don't edit. Most of it's shown in Solid Memo; the Studio closes the gaps one by one.

Write discipline