Sign in

    okf

    Read, query, validate and edit Open Knowledge Format (OKF) bundles

    okf
    knowledge
    markdown
    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    1 hour ago
    Downloads
    2

    #OKF

    moonrockz/okf reads, queries, validates and edits knowledge bases in the Open Knowledge Format (OKF v0.2): directories of Markdown concepts with YAML frontmatter. It is built on moonrockz/mdc.

    OKF does not define how to store, index, search or extend a knowledge base, so this module keeps those concerns behind provider traits and a profile API.

    #Packages

    PackageContentsTargets
    moonrockz/okfDocument model, frontmatter, links, link graph, indexes, logs, queries, search, validation, profilesall
    moonrockz/okf/editText edits that keep every other byte, and edit plansall
    moonrockz/okf/providerAsync DocumentStore, IndexProvider and SearchProvider traits, loading and plan applicationall (async: native, wasm, js)
    moonrockz/okf/memoryIn-memory store, index and search providersall (async: native, wasm, js)
    moonrockz/okf/conformanceConformance checks for new providersnative, wasm, js
    moonrockz/okf/fsFile system storenative, wasm
    moonrockz/okf/fs/nodeFile system store over node:fs/promises (Node.js 20.16+, Bun, Deno)js
    moonrockz/okf/fs/browserStore over the File System Access APIjs
    moonrockz/okf/idbStore over IndexedDB, for pages and workers in every browserjs
    moonrockz/okf/openspecOpenSpec profile, structured view, import and exportall

    #Load and query

    The core is pure and synchronous. It works on a DocumentSet in memory, so it runs on every target, including wasm-gc.

    let set = @okf.DocumentSet::of_texts([
    ("kb/index.md", "---\nokf_version: \"0.2\"\n---\n"),
    ("kb/tables/orders.md", "---\ntype: BigQuery Table\ntitle: Orders\n---\nSee [customers](customers.md).\n"),
    ])
    let knowledge = @okf.discover(set) // every directory whose index.md has okf_version
    let bundle = knowledge.bundles()[0]
    let orders = bundle.concept(@okf.ConceptId("tables/orders")).unwrap()
    orders.concept_type() // Some(ConceptType "BigQuery Table")
    orders.links() // body links with their origin and kind
    let graph = @okf.Graph::build(knowledge) // outbound links, backlinks, orphans, broken links
    knowledge.filter([TypeIs(@okf.ConceptType("metric")), HasTag("finance")])
    knowledge.facet(Type) // or Tags, Bundles, Field(@okf.FieldKey("owner"))
    @okf.search_knowledge(knowledge, @okf.SearchRequest("revenue", limit=@okf.SearchLimit(10)))

    #Domain types

    Values with rules are types with smart constructors, so a value that breaks a rule cannot exist. Parse raw text once, where it enters, and then pass the type.

    TypeRule
    BundleLabelSegments joined with /; no segment is empty or has : or white space
    StoreDir, StorePath, BundlePath, EntryNameNo segment escapes the root; an entry name is one segment
    ConceptTypeNot blank; equal without letter case
    FieldKeyA plain frontmatter key that edits can write
    RuleNameLower-case kebab case
    SearchLimit1 to 1000
    LogDateA real calendar date, YYYY-MM-DD
    RegisterName, StateName, RecordId, IdWidthNot blank; an ID width is 1 to 9

    Each constructor raises a typed error (ValueError or PathError) that names the input. Values that are valid by construction have constructors that cannot fail, such as StoreDir::root(), SearchLimit::default() and LogDate::of_instant(instant). Fixed sets are enums: OkfVersion, Facet, ScanField, LinkOrigin, IndexHeading, LogHeading and FindingSubject. Free text, such as titles, descriptions and messages, stays a String.

    Typed accessors cover every OKF v0.2 field: sources, usage_window, generated, verified (a single mapping reads as a list), status, stale_after, and the Attested Computation fields. trust_tier() derives the tier from verified, and is_stale(now) compares stale_after with an instant that the caller supplies. Unknown keys keep their source order, and every scalar keeps its source text, so dates and timestamps stay as written.

    Options::default() follows OKF v0.2. Options::update changes each known difference between the specification and existing tools: the relative link base, the status default, nested logs, date-only instants, the v0.1 field forms, and whether index links count as backlinks.

    #Validate

    let report = @okf.validate(
    knowledge,
    [@okf.okf_v02_conformance(), @okf.advisory()],
    @okf.FixedClock::at("2026-10-23T00:00:00Z"),
    config=@okf.ValidationConfig(
    overrides=[(@okf.RuleName("link-broken"), Error)],
    disabled=[@okf.RuleName("duplicate-title")],
    ),
    )
    report.findings() // sorted by severity, subject, line and rule
    report.fails(strict=true)

    A config that names a rule that no active rule set defines gives a validation-config-unknown-rule warning, and a profile whose definitions break a rule gives a profile-invalid error.

    okf_v02_conformance() holds the OKF v0.2 section 11 rules. advisory() holds rules that OKF tolerates, such as missing titles, broken links, stale concepts, index coverage and description drift. The caller chooses their severities.

    #Edit

    Edits in moonrockz/okf/edit are pure: they take a text and return the new text and whether it changed. They keep line endings, comments, key order and quoting. Plans group edits until a caller applies them to a document set or a store.

    @edit.set_key(text, @okf.FieldKey("status"), "deprecated")
    @edit.add_index_entry(index_text, @edit.SectionName("Metric"), @edit.IndexEntryLine("Revenue", "/metrics/revenue.md"))
    @edit.add_log_entry(log_text, @okf.LogDate("2026-10-23"), "Added revenue.", label="Creation")
    let plan = @edit.plan_add_concept(
    bundle, "/metrics/revenue.md", @okf.ConceptType("Metric"), "Revenue",
    "Net revenue per day", @okf.LogDate("2026-10-23"),
    )
    plan.render() // a dry run

    Raw YAML values are RawYaml, built with RawYaml(text), RawYaml::scalar or RawYaml::list. The planners raise one PlanError with a case for a refused path, a failed edit and a refused transition.

    Storage, indexing and search are async traits in moonrockz/okf/provider. load(store) reads documents into memory and then runs the core; apply(plan,store) writes the changed documents.

    RuntimeStore
    Tests, wasm-gc, any target@memory.MemoryStore (its snapshot() is synchronous)
    Native and wasm@fs.FsStore(@provider.StoreRoot(root))
    Node.js, Bun, Deno@node.NodeStore(@provider.StoreRoot(root))
    Browser, origin private file system@browser.BrowserStore::origin_private(path=@okf.StoreDir("kb"))
    Browser, a directory that the user selects@browser.BrowserStore(@browser.pick_directory())
    Browser or worker, IndexedDB@idb.IdbStore::open(database=@idb.DatabaseName("kb"))

    MoonBit has one js target, so choose the Node.js or the browser store by the package you import. A StoreError names a location relative to the store root (FileAt(StorePath) or DirectoryAt(StoreDir)), never a host path, so every store gives the same error for the same failure.

    The browser store writes with one of three methods (writes=):

    • Writable uses FileSystemFileHandle.createWritable() on the page.
    • SyncAccessWorker sends each write to a dedicated worker that writes with createSyncAccessHandle(). The worker writes one file at a time, replaces the whole file in one session (truncate, write, flush, close), and closes the handle before it answers. When a step fails, it closes the handle and removes a file that it created. A failure after the truncate, such as a quota error during the write, can leave an existing file empty or partly written; createWritable() does not have this limit. The worker code is part of the package, so a page serves no extra file. One worker serves every store of the page. A worker that fails or does not answer within two minutes is stopped, and the next write starts a new one.
    • The worker opens the origin private file system by itself, so worker writes need a store in that file system: a store from origin_private, or a store over origin_private_root() or a directory below it. A store over a directory that the user selected refuses worker writes with InvalidPath.
    • Auto, the default, uses createWritable() when the browser has it, and the worker otherwise. The store chooses once, at its first write.

    Safari 15.2 to 18 has no createWritable(), so Auto writes through the worker there. Safari 26 has createWritable(); one report says that Safari 26.5 keeps a temporary copy of each file that it writes, so SyncAccessWorker is a choice there too. A page with a Content Security Policy needs worker-src blob: for the worker; without it, a worker write fails with a store error that names worker-src blob:. Reads, listings and deletes always run on the page.

    @idb.IdbStore keeps each file in one record of an IndexedDB object store, under its store path. A directory exists while a file is under it, and a file cannot have the path of a directory or be under another file. Each write and delete is one transaction, so a failed write, for example over the storage quota, keeps the earlier content. When another connection upgrades or deletes the database, the store opens its connection again at the next call. A browser can evict IndexedDB and origin private data under storage pressure; for data that must stay, the application can call navigator.storage.persist(). The library does not call it, because the browser can show a prompt. IdbStore::in_memory() runs the same logic over a map, for tests outside a browser.

    mise run test:browser runs the store checks in Chromium, WebKit and Firefox. WebKit in Playwright is close to Safari, but it is not the same browser.

    @memory.MemoryIndex implements IndexProvider and SearchProvider (BM25 over title, description, tags and body). A new provider, for example over SQLite or RocksDB, proves its contract with @conformance.check_store, check_index and check_search.

    #Profiles

    A profile adds conventions to OKF without changes to this module. Implement @okf.Profile; every method has a default.

    MethodAdds
    vocabulary, bundle_keysKnown frontmatter keys
    derive_metadataMetadata for a document without frontmatter
    registersTyped views of one concept type: record IDs, states, transitions with obligations, supersession
    reference_fieldsFields whose values name documents or records
    templatesBodies for new concepts
    rule_sets, severitiesValidation rules and their preferred severities
    relationsLinks that a document implies
    optionsPreferred options

    profile_conflicts reports two profiles that define one key or register differently. The tests hold a morphir reference profile, written with this API only, that reproduces morphir kb check and morphir kb decision list on a copy of the finos/morphir knowledge base.

    #OpenSpec

    @openspec.OpenSpecProfile reads an openspec/ tree as a bundle. It derives the types Specification, Change (the change's proposal.md), Design, Tasks and Spec Delta, links changes to their capabilities, and adds checks: the three that openspec validate --strict runs (a requirement without a scenario, without SHALL or MUST, or with a wrong scenario heading) and two that OpenSpec runs only at archive time (a MODIFIED or REMOVED requirement that matches nothing, and a delta for a capability that does not exist). Two more checks report content that the view leaves out: a rename with only a FROM: or a TO: line, and a capability, change or requirement value that is not a valid name, a requirement heading without a name, or a state that is not active or archived. Export refuses a name that is not valid. @openspec.view(bundle) gives requirements, scenarios, deltas and tasks with typed names (CapabilityPath, ChangeName, RequirementName, TaskNumber), types (OpenSpecType) and states (ChangeState). Native bundles can also use Requirement and Scenario concepts.

    The profile parses each requirement text as EARS with moonrockz/ears: the OpenSpec dialect (SHALL and MUST, the usual determiners, it and they, the lead-in otherwise), the project lexicon file, and a lexicon in code. The view gives each requirement its sentences and sentence_diagnostics, and a pronoun refers to the system of an earlier sentence of the requirement. OpenSpecProfile::of_tree(set, root) reads the project lexicon from ears.yaml at the root of the tree; OpenSpecProfile(lexicon=...) takes one in code. Pass the profile to view(bundle, profile~); without one, the view parses with the OpenSpec dialect alone. List markers and ** emphasis marks are removed before parsing, and a finding names the file line of its sentence.

    # openspec/ears.yaml name: my-project systems: [Mission Control, Text comparison] lead_ins: [for each]

    Two more checks cover EARS: openspec-requirement-not-ears (a warning) reports a requirement sentence that does not parse, with its line and the reason, and openspec-lexicon-invalid reports a lexicon file that does not parse; the profile then parses with the other dialects. Archived changes are history, so the EARS check skips them.

    import_openspec plans a native OKF bundle from a tree, and export_openspec plans the tree again; the round trip keeps every file.

    Clock

    pub(open) trait Clock {
    fn now(Self) -> Instant
    }

    Gives the current instant. The core never reads the system clock; callers supply a clock, so results are deterministic.

    LinkResolver

    pub(open) trait LinkResolver {
    fn exists(Self, StorePath) -> Bool
    }

    Tests whether a store path exists. The default resolver knows the loaded documents and assets; a caller can supply one that knows other files.

    Profile

    pub(open) trait Profile {
    fn name(Self) -> String
    fn vocabulary(Self) -> Array[KeyDefinition] raise ValueError = _
    fn bundle_keys(Self) -> Array[KeyDefinition] raise ValueError = _
    fn derive_metadata(Self, Document) -> Fields? = _
    fn registers(Self) -> Array[Register] raise ValueError = _
    fn reference_fields(Self) -> Array[ReferenceField] raise ValueError = _
    fn templates(Self) -> Array[Template] raise ValueError = _
    fn rule_sets(Self) -> Array[RuleSet] raise ValueError = _
    fn options(Self) -> Options? = _
    fn relations(Self, Bundle, Document) -> Array[Link] = _
    fn severities(Self) -> Array[(RuleName, Severity)] raise ValueError = _
    }

    A profile extends OKF with conventions: vocabulary, derived metadata, registers, references, templates and rules. Every method has a default, so a profile implements only what it adds. The methods that define keys, registers, references, templates, rules and severities can raise ValueError; validation then reports the profile as invalid.

    DocRefError

    pub(all) suberror DocRefError {
    NotADocRef(String)
    BadLabel(text~ : String, error~ : ValueError)
    BadPath(text~ : String, error~ : PathError)
    } derive(Eq,
    Debug
    )

    Raised when a document reference does not parse.

    DocRefError::equal

    fn DocRefError::equal(DocRefError, DocRefError) -> Bool

    DocRefError::not_equal

    fn DocRefError::not_equal(x : DocRefError, y : DocRefError) -> Bool

    GitHubUrlError

    pub(all) suberror GitHubUrlError {
    NotGitHub(String)
    MissingPart(String)
    NotACommit(String)
    } derive(Eq,
    Debug
    )

    Raised when a GitHub URL is not a commit-pinned file URL.

    GitHubUrlError::equal

    GitHubUrlError::not_equal

    fn GitHubUrlError::not_equal(x : GitHubUrlError, y : GitHubUrlError) -> Bool

    MetadataError

    pub(all) suberror MetadataError {
    InvalidYaml(line~ : Int, column~ : Int, message~ : String)
    Unterminated
    } derive(Eq,
    Debug
    )

    Raised when a frontmatter block cannot be read.

    MetadataError::equal

    MetadataError::not_equal

    fn MetadataError::not_equal(x : MetadataError, y : MetadataError) -> Bool

    PathError

    pub(all) suberror PathError {
    EscapesRoot(String)
    EmptyPath(String)
    } derive(Eq,
    Debug
    )

    Raised for a path that cannot name a file inside a root.

    PathError::equal

    fn PathError::equal(PathError, PathError) -> Bool

    PathError::not_equal

    fn PathError::not_equal(x : PathError, y : PathError) -> Bool

    ValueError

    pub(all) suberror ValueError {
    InvalidLabel(String)
    BlankConceptType(String)
    InvalidFieldKey(String)
    InvalidRuleName(String)
    InvalidSearchLimit(Int)
    InvalidDate(String)
    InvalidInstant(String)
    BlankName(String)
    InvalidIdWidth(Int)
    UnknownState(register~ : String, state~ : String)
    UnknownRegister(register~ : String)
    } derive(Eq,
    Debug
    )

    Raised when a text breaks the rules of an OKF value type. Each case names the input.

    ValueError::equal

    fn ValueError::equal(ValueError, ValueError) -> Bool

    ValueError::not_equal

    fn ValueError::not_equal(x : ValueError, y : ValueError) -> Bool

    Actor

    pub enum Actor {
    Producer(name~ : String, version~ : String)
    Human(String)
    Process(String)
    Other(String)
    } derive(Eq,
    Debug
    )

    Who produced or verified knowledge (OKF v0.2, section 7). Only Actor::parse makes one, so no case holds an empty ID.

    Actor::equal

    fn Actor::equal(Actor, Actor) -> Bool

    Actor::is_human

    fn Actor::is_human(self : Actor) -> Bool

    Actor::not_equal

    fn Actor::not_equal(x : Actor, y : Actor) -> Bool

    Actor::parse

    fn Actor::parse(text : String) -> Actor?

    Parses an actor. A blank text names no actor.

    Actor::to_repr

    Attribution

    pub(all) struct Attribution {
    by : Actor?
    at : String?
    } derive(Eq,
    Debug
    )

    A {by, at} record, as in generated and verified. An attribution without an actor, such as a v0.1 timestamp, has no by.

    Attribution::equal

    fn Attribution::equal(Attribution, Attribution) -> Bool

    Attribution::not_equal

    fn Attribution::not_equal(x : Attribution, y : Attribution) -> Bool

    Bundle

    type Bundle

    An OKF bundle: a directory tree of Markdown documents and other files.

    Bundle::assets

    fn Bundle::assets(self : Bundle) -> ReadOnlyArray[BundlePath]

    Non-Markdown files.

    Bundle::bundle_path_of

    fn Bundle::bundle_path_of(self : Bundle, path : StorePath) -> BundlePath?

    The bundle path of a store path, when it is inside this bundle.

    Bundle::concept

    fn Bundle::concept(self : Bundle, id : ConceptId) -> Document?

    The concept with this Concept ID.

    Bundle::concepts

    fn Bundle::concepts(self : Bundle) -> Array[Document]

    Bundle::config

    fn Bundle::config(self : Bundle) -> Metadata

    The root index frontmatter: okf_version and profile bundle keys.

    Bundle::description_drift

    fn Bundle::description_drift(self : Bundle) -> Array[Drift]

    The index entries whose description differs from their concept.

    Bundle::document

    fn Bundle::document(self : Bundle, path : BundlePath) -> Document?

    Bundle::documents

    fn Bundle::documents(self : Bundle) -> ReadOnlyArray[Document]

    Every document, sorted by path.

    Bundle::group

    fn Bundle::group(self : Bundle) -> ReadOnlyArray[String]

    The grouping directories between the discovery root and the bundle.

    Bundle::ignored_logs

    fn Bundle::ignored_logs(self : Bundle) -> ReadOnlyArray[BundlePath]

    Nested log.md files that the RootOnly option left out.

    Bundle::index_entries_for

    fn Bundle::index_entries_for(self : Bundle, target : BundlePath) -> Array[(Document, IndexEntry)]

    The index entries of a bundle that link to target, with their index documents.

    Bundle::indexes

    fn Bundle::indexes(self : Bundle) -> Array[Document]

    The root index and the sub-indexes.

    Bundle::knows_version

    fn Bundle::knows_version(self : Bundle) -> Bool

    True when this library knows the declared OKF version, or none is declared.

    Bundle::label

    fn Bundle::label(self : Bundle) -> BundleLabel

    The bundle label: its group and its name, such as morphir/ir.

    Bundle::logs

    fn Bundle::logs(self : Bundle) -> Array[Document]

    Bundle::name

    fn Bundle::name(self : Bundle) -> String

    The bundle name, the last segment of its label.

    Bundle::okf_version

    fn Bundle::okf_version(self : Bundle) -> OkfVersion?

    The okf_version of the root index.

    Bundle::options

    fn Bundle::options(self : Bundle) -> Options

    The options that the bundle was loaded with.

    Bundle::root

    fn Bundle::root(self : Bundle) -> StoreDir

    The store directory of the bundle root.

    Bundle::root_index

    fn Bundle::root_index(self : Bundle) -> Document?

    Bundle::root_log

    fn Bundle::root_log(self : Bundle) -> Document?

    The bundle-root log.md.

    Bundle::store_path_of

    fn Bundle::store_path_of(self : Bundle, path : BundlePath) -> StorePath

    The store path of a bundle path.

    Bundle::unindexed_concepts

    fn Bundle::unindexed_concepts(self : Bundle) -> Array[Document]

    A coverage gap: a concept that no index of its bundle links to.

    BundleLabel

    type BundleLabel derive(Eq, Hash,
    Debug
    )

    A bundle label: its group segments and its name, joined with /, such as morphir/ir or my notes. No segment is empty or holds /, : or a line break.
    impl Show for BundleLabel

    BundleLabel::BundleLabel

    fn BundleLabel::BundleLabel(text : String) -> BundleLabel raise ValueError

    Parses a bundle label such as morphir/ir, or a bare name such as ir.

    BundleLabel::compare

    fn BundleLabel::compare(self : BundleLabel, other : BundleLabel) -> Int

    BundleLabel::equal

    fn BundleLabel::equal(BundleLabel, BundleLabel) -> Bool

    BundleLabel::group

    fn BundleLabel::group(self : BundleLabel) -> ReadOnlyArray[String]

    The segments before the name.

    BundleLabel::hash

    fn BundleLabel::hash(self : BundleLabel) -> Int

    BundleLabel::hash_combine

    fn BundleLabel::hash_combine(BundleLabel, Hasher) -> Unit

    BundleLabel::is_bare

    fn BundleLabel::is_bare(self : BundleLabel) -> Bool

    True when the label has only a name, so it can match a bundle by name.

    BundleLabel::name

    fn BundleLabel::name(self : BundleLabel) -> String

    The last segment, the bundle name.

    BundleLabel::not_equal

    fn BundleLabel::not_equal(x : BundleLabel, y : BundleLabel) -> Bool

    BundleLabel::op_ge

    fn BundleLabel::op_ge(x : BundleLabel, y : BundleLabel) -> Bool

    BundleLabel::op_gt

    fn BundleLabel::op_gt(x : BundleLabel, y : BundleLabel) -> Bool

    BundleLabel::op_le

    fn BundleLabel::op_le(x : BundleLabel, y : BundleLabel) -> Bool

    BundleLabel::op_lt

    fn BundleLabel::op_lt(x : BundleLabel, y : BundleLabel) -> Bool

    BundleLabel::output

    fn BundleLabel::output(self : BundleLabel, logger : &Logger) -> Unit

    BundleLabel::to_string

    fn BundleLabel::to_string(self : BundleLabel) -> String

    BundlePath

    type BundlePath derive(Eq, Hash,
    Debug
    )

    A path relative to a bundle root. Its text form starts with /, as OKF bundle-rooted links do, for example /tables/customers.md.
    impl Show for BundlePath

    BundlePath::BundlePath

    fn BundlePath::BundlePath(text : String) -> BundlePath raise PathError

    Validates text as a bundle path. A leading / is optional.

    BundlePath::compare

    fn BundlePath::compare(self : BundlePath, other : BundlePath) -> Int

    BundlePath::depth

    fn BundlePath::depth(self : BundlePath) -> Int

    The number of directories above the file, 0 for a file at the bundle root.

    BundlePath::directory

    fn BundlePath::directory(self : BundlePath) -> Array[String]

    The directory segments, without the file name.

    BundlePath::ends_with

    fn BundlePath::ends_with(self : BundlePath, suffix : String) -> Bool

    True when the path ends with suffix, compared segment by segment.

    BundlePath::equal

    fn BundlePath::equal(BundlePath, BundlePath) -> Bool

    BundlePath::hash

    fn BundlePath::hash(self : BundlePath) -> Int

    BundlePath::hash_combine

    fn BundlePath::hash_combine(BundlePath, Hasher) -> Unit

    BundlePath::name

    fn BundlePath::name(self : BundlePath) -> String

    BundlePath::not_equal

    fn BundlePath::not_equal(x : BundlePath, y : BundlePath) -> Bool

    BundlePath::op_ge

    fn BundlePath::op_ge(x : BundlePath, y : BundlePath) -> Bool

    BundlePath::op_gt

    fn BundlePath::op_gt(x : BundlePath, y : BundlePath) -> Bool

    BundlePath::op_le

    fn BundlePath::op_le(x : BundlePath, y : BundlePath) -> Bool

    BundlePath::op_lt

    fn BundlePath::op_lt(x : BundlePath, y : BundlePath) -> Bool

    BundlePath::output

    fn BundlePath::output(self : BundlePath, logger : &Logger) -> Unit

    BundlePath::root_index

    fn BundlePath::root_index() -> BundlePath

    The root index, /index.md.

    BundlePath::root_log

    fn BundlePath::root_log() -> BundlePath

    The root log, /log.md.

    BundlePath::segments

    fn BundlePath::segments(self : BundlePath) -> ReadOnlyArray[String]

    BundlePath::to_string

    fn BundlePath::to_string(self : BundlePath) -> String

    Citation

    pub(all) struct Citation {
    label : String
    line : Int
    } derive(Eq,
    Debug
    )

    A footnote reference in a body, such as [^ga4-schema].

    Citation::equal

    fn Citation::equal(Citation, Citation) -> Bool

    Citation::not_equal

    fn Citation::not_equal(x : Citation, y : Citation) -> Bool

    Citation::to_repr

    CodeBlock

    pub(all) struct CodeBlock {
    language : String?
    code : String
    line : Int
    } derive(Eq,
    Debug
    )

    One fenced or indented code block.

    CodeBlock::equal

    fn CodeBlock::equal(CodeBlock, CodeBlock) -> Bool

    CodeBlock::not_equal

    fn CodeBlock::not_equal(x : CodeBlock, y : CodeBlock) -> Bool

    CommitSha

    type CommitSha derive(Eq, Hash,
    Debug
    )

    A commit SHA of 7 to 40 hexadecimal characters.

    CommitSha::CommitSha

    fn CommitSha::CommitSha(text : String) -> CommitSha raise GitHubUrlError

    CommitSha::equal

    fn CommitSha::equal(CommitSha, CommitSha) -> Bool

    CommitSha::hash

    fn CommitSha::hash(self : CommitSha) -> Int

    CommitSha::hash_combine

    fn CommitSha::hash_combine(CommitSha, Hasher) -> Unit

    CommitSha::not_equal

    fn CommitSha::not_equal(x : CommitSha, y : CommitSha) -> Bool

    CommitSha::to_string

    fn CommitSha::to_string(self : CommitSha) -> String

    ConceptId

    type ConceptId derive(Eq, Hash,
    Debug
    )

    The OKF Concept ID: the bundle path without its leading / and without the .md extension, for example tables/customers.
    impl Show for ConceptId

    ConceptId::ConceptId

    fn ConceptId::ConceptId(text : String) -> ConceptId raise PathError

    Validates text as a Concept ID. A trailing .md and a leading / are removed, so /tables/customers.md and tables/customers are equal. A path whose file name is only .md, such as /.md, raises EmptyPath.

    ConceptId::compare

    fn ConceptId::compare(self : ConceptId, other : ConceptId) -> Int

    ConceptId::equal

    fn ConceptId::equal(ConceptId, ConceptId) -> Bool

    ConceptId::hash

    fn ConceptId::hash(self : ConceptId) -> Int

    ConceptId::hash_combine

    fn ConceptId::hash_combine(ConceptId, Hasher) -> Unit

    ConceptId::not_equal

    fn ConceptId::not_equal(x : ConceptId, y : ConceptId) -> Bool

    ConceptId::of_path

    fn ConceptId::of_path(path : BundlePath) -> ConceptId?

    The Concept ID of the file at path, or None when the file name is only .md, which leaves an empty name.

    ConceptId::op_ge

    fn ConceptId::op_ge(x : ConceptId, y : ConceptId) -> Bool

    ConceptId::op_gt

    fn ConceptId::op_gt(x : ConceptId, y : ConceptId) -> Bool

    ConceptId::op_le

    fn ConceptId::op_le(x : ConceptId, y : ConceptId) -> Bool

    ConceptId::op_lt

    fn ConceptId::op_lt(x : ConceptId, y : ConceptId) -> Bool

    ConceptId::output

    fn ConceptId::output(self : ConceptId, logger : &Logger) -> Unit

    ConceptId::to_path

    fn ConceptId::to_path(self : ConceptId) -> BundlePath

    The bundle path of the Markdown file for this Concept ID.

    ConceptId::to_string

    fn ConceptId::to_string(self : ConceptId) -> String

    ConceptType

    type ConceptType derive(
    Debug
    )

    An OKF concept type, such as Decision Record. It is not blank, and two concept types are equal when they differ only in letter case.
    impl Eq for ConceptType
    impl Hash for ConceptType
    impl Show for ConceptType

    ConceptType::ConceptType

    fn ConceptType::ConceptType(text : String) -> ConceptType raise ValueError

    ConceptType::compare

    fn ConceptType::compare(self : ConceptType, other : ConceptType) -> Int

    ConceptType::equal

    fn ConceptType::equal(self : ConceptType, other : ConceptType) -> Bool

    ConceptType::hash

    fn ConceptType::hash(self : ConceptType) -> Int

    ConceptType::hash_combine

    fn ConceptType::hash_combine(self : ConceptType, hasher : Hasher) -> Unit

    ConceptType::not_equal

    fn ConceptType::not_equal(x : ConceptType, y : ConceptType) -> Bool

    ConceptType::op_ge

    fn ConceptType::op_ge(x : ConceptType, y : ConceptType) -> Bool

    ConceptType::op_gt

    fn ConceptType::op_gt(x : ConceptType, y : ConceptType) -> Bool

    ConceptType::op_le

    fn ConceptType::op_le(x : ConceptType, y : ConceptType) -> Bool

    ConceptType::op_lt

    fn ConceptType::op_lt(x : ConceptType, y : ConceptType) -> Bool

    ConceptType::output

    fn ConceptType::output(self : ConceptType, logger : &Logger) -> Unit

    ConceptType::to_string

    fn ConceptType::to_string(self : ConceptType) -> String

    The type as written.

    DocKey

    pub(all) struct DocKey {
    bundle : BundleLabel
    path : BundlePath
    } derive(Eq, Hash,
    Debug
    )

    A document key: the bundle label and the bundle path.
    impl Compare for DocKey

    DocKey::compare

    fn DocKey::compare(self : DocKey, other : DocKey) -> Int

    DocKey::equal

    fn DocKey::equal(DocKey, DocKey) -> Bool

    DocKey::hash

    fn DocKey::hash(self : DocKey) -> Int

    DocKey::hash_combine

    fn DocKey::hash_combine(DocKey, Hasher) -> Unit

    DocKey::not_equal

    fn DocKey::not_equal(x : DocKey, y : DocKey) -> Bool

    DocKey::of

    fn DocKey::of(bundle : Bundle, doc : Document) -> DocKey

    DocKey::op_ge

    fn DocKey::op_ge(x : DocKey, y : DocKey) -> Bool

    DocKey::op_gt

    fn DocKey::op_gt(x : DocKey, y : DocKey) -> Bool

    DocKey::op_le

    fn DocKey::op_le(x : DocKey, y : DocKey) -> Bool

    DocKey::op_lt

    fn DocKey::op_lt(x : DocKey, y : DocKey) -> Bool

    DocKey::to_repr

    DocKey::to_string

    fn DocKey::to_string(self : DocKey) -> String

    DocKind

    pub(all) enum DocKind {
    RootIndex
    SubIndex
    Log
    Concept
    } derive(Eq,
    Debug
    )

    The kind of an OKF document, from its file name (OKF v0.2, section 3.1).

    DocKind::equal

    fn DocKind::equal(DocKind, DocKind) -> Bool

    DocKind::is_index

    fn DocKind::is_index(self : DocKind) -> Bool

    True when kind is an index.

    DocKind::not_equal

    fn DocKind::not_equal(x : DocKind, y : DocKind) -> Bool

    DocKind::to_repr

    DocRef

    A document reference: bundle-label:/path.md, or /path.md in the same bundle. It holds a valid label and a valid bundle path.

    DocRef::DocRef

    fn DocRef::DocRef(text : String) -> DocRef raise DocRefError

    Parses bundle-label:/path.md or /path.md.

    DocRef::bundle

    fn DocRef::bundle(self : DocRef) -> BundleLabel?

    The bundle label, or None for a reference in the same bundle.

    DocRef::equal

    fn DocRef::equal(DocRef, DocRef) -> Bool

    DocRef::not_equal

    fn DocRef::not_equal(x : DocRef, y : DocRef) -> Bool

    DocRef::path

    fn DocRef::path(self : DocRef) -> BundlePath

    DocRef::to_repr

    Document

    type Document

    One Markdown document of a bundle, read once and immutable.

    Document::Document

    fn Document::Document(path : BundlePath, store_path : StorePath, text : String) -> Document

    Reads one document. Frontmatter errors are kept as data.

    Document::body

    fn Document::body(self : Document) -> String

    The Markdown body after the frontmatter block.

    Document::body_line

    fn Document::body_line(self : Document) -> Int

    The file line of the first body line, counted from 1.

    Document::citations

    fn Document::citations(self : Document) -> Array[Citation]

    The footnote references of a body, in order.

    Document::cited_sources

    fn Document::cited_sources(self : Document) -> Array[(Citation, Source?)]

    A citation with the sources entry whose id equals its label.

    Document::code_blocks

    fn Document::code_blocks(self : Document) -> Array[CodeBlock]

    The code blocks of the body, in order.

    Document::concept_id

    fn Document::concept_id(self : Document) -> ConceptId?

    The Concept ID, for a concept.

    Document::concept_type

    fn Document::concept_type(self : Document) -> ConceptType?

    Document::derived_metadata

    fn Document::derived_metadata(self : Document) -> Metadata?

    The metadata that profiles derived for a document without frontmatter.

    Document::display_title

    fn Document::display_title(self : Document) -> String

    title, else the file name without .md.

    Document::has_frontmatter_block

    fn Document::has_frontmatter_block(self : Document) -> Bool

    True when the document starts with a frontmatter block, valid or not.

    Document::header

    fn Document::header(self : Document) -> Header

    The shape of the start of the document.

    Document::index_model

    fn Document::index_model(self : Document) -> IndexModel

    Parses the body of an index document.

    Document::is_concept

    fn Document::is_concept(self : Document) -> Bool

    Document::is_derived

    fn Document::is_derived(self : Document) -> Bool

    True when the metadata of this document comes from a profile.

    Document::kind

    fn Document::kind(self : Document) -> DocKind

    fn Document::links(self : Document) -> Array[Link]

    The body links of a document: inline, reference and autolinks, with file lines. Images, footnote references and text inside code are left out.

    Document::log_model

    fn Document::log_model(self : Document) -> LogModel

    Parses the body of a log document. Each ## heading starts a section.

    Document::markdown

    The parsed Markdown body.

    Document::metadata

    fn Document::metadata(self : Document) -> Metadata

    The written metadata, else the derived metadata, else empty metadata.

    Document::metadata_error

    fn Document::metadata_error(self : Document) -> MetadataError?

    The frontmatter error, when the block is invalid.

    Document::outline

    fn Document::outline(self : Document) -> Array[Heading]

    The headings of the body, with levels, slugs and file lines. Lines in code that start with # are not headings. Repeated slugs get -1, -2 and so on.

    Document::path

    fn Document::path(self : Document) -> BundlePath

    Document::prose_lines

    fn Document::prose_lines(self : Document) -> Array[(Int, String)]

    The body lines of a document with their file line numbers, without the lines inside fenced code blocks.

    Document::section

    fn Document::section(self : Document, heading : String) -> SectionContent?

    The section under the first heading with this text, ignoring letter case.

    Document::store_path

    fn Document::store_path(self : Document) -> StorePath

    Document::text

    fn Document::text(self : Document) -> String

    The full source text.

    Document::with_derived

    fn Document::with_derived(self : Document, fields : Fields) -> Document

    A copy with derived metadata, for a document without frontmatter.

    Document::written_metadata

    fn Document::written_metadata(self : Document) -> Metadata?

    The written frontmatter, when it is valid.

    DocumentSet

    type DocumentSet

    An immutable set of files in memory, sorted by path. It is the input of the pure core: stores read into a document set, and the core loads bundles from it.

    DocumentSet::DocumentSet

    fn DocumentSet::DocumentSet(entries : ArrayView[FileEntry]) -> DocumentSet

    Builds a document set. A later entry for the same path replaces an earlier one.

    DocumentSet::contains

    fn DocumentSet::contains(self : DocumentSet, path : StorePath) -> Bool

    DocumentSet::entries

    fn DocumentSet::entries(self : DocumentSet) -> ReadOnlyArray[FileEntry]

    All files, sorted by path.

    DocumentSet::get

    fn DocumentSet::get(self : DocumentSet, path : StorePath) -> FileEntry?

    DocumentSet::has_directory

    fn DocumentSet::has_directory(self : DocumentSet, dir : StoreDir) -> Bool

    True when a file exists under the directory dir.

    DocumentSet::length

    fn DocumentSet::length(self : DocumentSet) -> Int

    The number of files.

    DocumentSet::of_texts

    fn DocumentSet::of_texts(files : ArrayView[(String, String)]) -> DocumentSet raise PathError

    Builds a document set from (path, text) pairs.

    DocumentSet::with_entry

    fn DocumentSet::with_entry(self : DocumentSet, entry : FileEntry) -> DocumentSet

    A new document set with entry added or replaced.

    DocumentSet::without

    fn DocumentSet::without(self : DocumentSet, path : StorePath) -> DocumentSet

    A new document set without the file at path.

    DocumentSetResolver

    pub(all) struct DocumentSetResolver {
    set : DocumentSet
    }

    A resolver that knows every file of a document set.

    DocumentSetResolver::exists

    fn DocumentSetResolver::exists(self : DocumentSetResolver, path : StorePath) -> Bool

    Drift

    pub(all) struct Drift {
    index : Document
    entry : IndexEntry
    concept : Document
    expected : String
    }

    One description drift: an index entry whose description differs from the description of its concept.

    Edge

    pub(all) struct Edge {
    from : DocKey
    link : Link
    target : Target
    escapes : Bool
    } derive(Eq,
    Debug
    )

    One link of the graph.

    Edge::equal

    fn Edge::equal(Edge, Edge) -> Bool

    Edge::is_broken

    fn Edge::is_broken(self : Edge) -> Bool

    Edge::not_equal

    fn Edge::not_equal(x : Edge, y : Edge) -> Bool

    Edge::to_repr

    EntryName

    type EntryName derive(Eq, Hash,
    Debug
    )

    One name in a directory listing: one segment that is not empty, . or .. and has no / or \.
    impl Show for EntryName

    EntryName::EntryName

    fn EntryName::EntryName(text : String) -> EntryName raise PathError

    EntryName::equal

    fn EntryName::equal(EntryName, EntryName) -> Bool

    EntryName::hash

    fn EntryName::hash(self : EntryName) -> Int

    EntryName::hash_combine

    fn EntryName::hash_combine(EntryName, Hasher) -> Unit

    EntryName::not_equal

    fn EntryName::not_equal(x : EntryName, y : EntryName) -> Bool

    EntryName::output

    fn EntryName::output(self : EntryName, logger : &Logger) -> Unit

    EntryName::to_string

    fn EntryName::to_string(self : EntryName) -> String

    Executor

    pub(all) struct Executor {
    resource : String?
    receipt : ReadOnlyArray[String]
    } derive(Eq,
    Debug
    )

    The executor of an Attested Computation.

    Executor::equal

    fn Executor::equal(Executor, Executor) -> Bool

    Executor::not_equal

    fn Executor::not_equal(x : Executor, y : Executor) -> Bool

    Executor::to_repr

    Facet

    pub(all) enum Facet {
    Type
    StatusFacet
    Tags
    Bundles
    Field(FieldKey)
    } derive(Eq,
    Debug
    )

    What a facet counts.

    Facet::equal

    fn Facet::equal(Facet, Facet) -> Bool

    Facet::not_equal

    fn Facet::not_equal(x : Facet, y : Facet) -> Bool

    Facet::to_repr

    FieldKey

    A plain frontmatter key that edits can write and profiles can define: a letter, a digit or _ first, then letters, digits, _, . or -. Reading metadata takes any YAML key as text.
    impl Compare for FieldKey
    impl Show for FieldKey

    FieldKey::FieldKey

    fn FieldKey::FieldKey(text : String) -> FieldKey raise ValueError

    FieldKey::compare

    fn FieldKey::compare(self : FieldKey, other : FieldKey) -> Int

    FieldKey::equal

    fn FieldKey::equal(FieldKey, FieldKey) -> Bool

    FieldKey::hash

    fn FieldKey::hash(self : FieldKey) -> Int

    FieldKey::hash_combine

    fn FieldKey::hash_combine(FieldKey, Hasher) -> Unit

    FieldKey::not_equal

    fn FieldKey::not_equal(x : FieldKey, y : FieldKey) -> Bool

    FieldKey::op_ge

    fn FieldKey::op_ge(x : FieldKey, y : FieldKey) -> Bool

    FieldKey::op_gt

    fn FieldKey::op_gt(x : FieldKey, y : FieldKey) -> Bool

    FieldKey::op_le

    fn FieldKey::op_le(x : FieldKey, y : FieldKey) -> Bool

    FieldKey::op_lt

    fn FieldKey::op_lt(x : FieldKey, y : FieldKey) -> Bool

    FieldKey::output

    fn FieldKey::output(self : FieldKey, logger : &Logger) -> Unit

    FieldKey::to_repr

    FieldKey::to_string

    fn FieldKey::to_string(self : FieldKey) -> String

    Fields

    An ordered set of keys and values. Keys keep their source order.

    Fields::Fields

    fn Fields::Fields(pairs : ArrayView[(String, Value)]) -> Fields

    Builds fields from ordered pairs. A later pair for the same key replaces the value of the earlier pair and keeps its position.

    Fields::bool

    fn Fields::bool(self : Fields, key : String) -> Bool?

    Fields::entries

    fn Fields::entries(self : Fields) -> ReadOnlyArray[(String, Value)]

    Fields::equal

    fn Fields::equal(Fields, Fields) -> Bool

    Fields::get

    fn Fields::get(self : Fields, key : String) -> Value?

    Fields::int

    fn Fields::int(self : Fields, key : String) -> Int?

    Fields::keys

    fn Fields::keys(self : Fields) -> Array[String]

    Fields::not_equal

    fn Fields::not_equal(x : Fields, y : Fields) -> Bool

    Fields::text

    fn Fields::text(self : Fields, key : String) -> String?

    A text field of a mapping.

    Fields::texts

    fn Fields::texts(self : Fields, key : String) -> Array[String]

    Fields::to_repr

    FileContent

    pub(all) enum FileContent {
    Text(String)
    Bytes(Bytes)
    } derive(Eq,
    Debug
    )

    The content of one file in a document set.

    FileContent::equal

    fn FileContent::equal(FileContent, FileContent) -> Bool

    FileContent::not_equal

    fn FileContent::not_equal(x : FileContent, y : FileContent) -> Bool

    FileContent::text

    fn FileContent::text(self : FileContent) -> String

    The text of a file, decoding bytes as UTF-8 when needed.

    FileEntry

    pub(all) struct FileEntry {
    path : StorePath
    content : FileContent
    } derive(Eq,
    Debug
    )

    One file of a document set: its store path and its content.

    FileEntry::equal

    fn FileEntry::equal(FileEntry, FileEntry) -> Bool

    FileEntry::not_equal

    fn FileEntry::not_equal(x : FileEntry, y : FileEntry) -> Bool

    Filter

    pub(all) enum Filter {
    TypeIs(ConceptType)
    StatusIs(Status)
    HasTag(String)
    InBundle(BundleLabel)
    FieldIs(FieldKey, String)
    } derive(Eq,
    Debug
    )

    A filter on concepts. Text comparison ignores letter case.

    Filter::equal

    fn Filter::equal(Filter, Filter) -> Bool

    Filter::matches

    fn Filter::matches(self : Filter, bundle : Bundle, doc : Document) -> Bool

    True when the concept matches the filter.

    Filter::not_equal

    fn Filter::not_equal(x : Filter, y : Filter) -> Bool

    Filter::to_repr

    Finding

    pub struct Finding {
    severity : Severity
    rule : RuleName
    subject : FindingSubject
    line : Int?
    message : String
    hint : String?
    } derive(Eq,
    Debug
    )

    One validation result. Only validate makes findings.

    Finding::equal

    fn Finding::equal(Finding, Finding) -> Bool

    Finding::not_equal

    fn Finding::not_equal(x : Finding, y : Finding) -> Bool

    Finding::to_repr

    FindingSubject

    pub(all) enum FindingSubject {
    InBundle(BundleLabel, BundlePath)
    Stray(StorePath)
    ProfileSubject(String)
    ConfigSubject
    } derive(Eq,
    Debug
    )

    What a finding is about.

    FindingSubject::bundle

    The bundle label of the subject, when it is a document of a bundle.

    FindingSubject::equal

    FindingSubject::not_equal

    fn FindingSubject::not_equal(x : FindingSubject, y : FindingSubject) -> Bool

    FindingSubject::path_text

    fn FindingSubject::path_text(self : FindingSubject) -> String?

    The path text of the subject: a bundle path or a store path. A profile or the config has no path.

    FixedClock

    pub(all) struct FixedClock {
    instant : Instant
    } derive(Eq,
    Debug
    )

    A clock that always gives the same instant, for tests and reproducible runs.
    impl Clock for FixedClock

    FixedClock::FixedClock

    fn FixedClock::FixedClock(instant : Instant) -> FixedClock

    FixedClock::at

    fn FixedClock::at(text : String) -> FixedClock raise ValueError

    A fixed clock from an ISO 8601 datetime or a YYYY-MM-DD date. Raises InvalidInstant when the text does not parse.

    FixedClock::equal

    fn FixedClock::equal(FixedClock, FixedClock) -> Bool

    FixedClock::not_equal

    fn FixedClock::not_equal(x : FixedClock, y : FixedClock) -> Bool

    FixedClock::now

    fn FixedClock::now(self : FixedClock) -> Instant

    GitHubSource

    type GitHubSource derive(Eq,
    Debug
    )

    The parts of a commit-pinned GitHub URL. No part is empty.

    GitHubSource::GitHubSource

    fn GitHubSource::GitHubSource(url : String) -> GitHubSource raise GitHubUrlError

    Parses https://github.com/<org>/<repo>/blob/<commit>/<path> (or tree).

    GitHubSource::commit

    fn GitHubSource::commit(self : GitHubSource) -> CommitSha

    GitHubSource::equal

    GitHubSource::not_equal

    fn GitHubSource::not_equal(x : GitHubSource, y : GitHubSource) -> Bool

    GitHubSource::org

    fn GitHubSource::org(self : GitHubSource) -> String

    GitHubSource::path

    fn GitHubSource::path(self : GitHubSource) -> String

    The file path in the repository.

    GitHubSource::repo

    fn GitHubSource::repo(self : GitHubSource) -> String

    Graph

    type Graph

    The directed link graph of a set of bundles.
    fn Graph::backlinks(self : Graph, key : DocKey) -> Array[Edge]

    The resolved links that point to a document.

    Graph::broken

    fn Graph::broken(self : Graph) -> Array[Edge]

    Every broken link.

    Graph::build

    fn Graph::build(knowledge : Knowledge, resolver? : &LinkResolver, profiles? : ArrayView[&Profile]) -> Graph

    Builds the graph: each body link of each document, plus the links that profiles add. resolver answers for targets outside the loaded documents.

    Graph::edges

    fn Graph::edges(self : Graph) -> ReadOnlyArray[Edge]

    Graph::linked_from

    fn Graph::linked_from(self : Graph, key : DocKey) -> Array[DocKey]

    The documents that link to a document, without duplicates, sorted.

    Graph::orphans

    fn Graph::orphans(self : Graph, knowledge : Knowledge, count_index_links? : Bool) -> Array[DocKey]

    The concepts that no other document links to. With count_index_links=false, links from index.md files do not count.

    Graph::outbound

    fn Graph::outbound(self : Graph, key : DocKey) -> Array[Edge]

    The links from a document, in document order.
    pub(all) struct Header {
    shape : HeaderShape
    body : String
    body_offset : Int
    body_line : Int
    bom : Bool
    } derive(Eq,
    Debug
    )

    The split of a document into its frontmatter block and its Markdown body.

    Header::equal

    fn Header::equal(Header, Header) -> Bool

    Header::not_equal

    fn Header::not_equal(x : Header, y : Header) -> Bool

    Header::to_repr

    HeaderShape

    pub(all) enum HeaderShape {
    NoBlock
    Block(raw~ : String)
    Unterminated
    } derive(Eq,
    Debug
    )

    How a document starts.

    HeaderShape::equal

    fn HeaderShape::equal(HeaderShape, HeaderShape) -> Bool

    HeaderShape::not_equal

    fn HeaderShape::not_equal(x : HeaderShape, y : HeaderShape) -> Bool

    Heading

    pub struct Heading {
    level :
    HeadingLevel

    text : String
    slug : String
    line : Int
    } derive(Eq,
    Debug
    )

    One heading of a document outline.

    Heading::equal

    fn Heading::equal(Heading, Heading) -> Bool

    Heading::not_equal

    fn Heading::not_equal(x : Heading, y : Heading) -> Bool

    Heading::to_repr

    IdRule

    pub(all) enum IdRule {
    LeadingDigits(IdWidth)
    FieldValue(FieldKey)
    } derive(Eq,
    Debug
    )

    How a register finds the ID of a record.

    IdRule::equal

    fn IdRule::equal(IdRule, IdRule) -> Bool

    IdRule::not_equal

    fn IdRule::not_equal(x : IdRule, y : IdRule) -> Bool

    IdRule::to_repr

    IdWidth

    The width of a padded record ID: 1 to 9 digits.

    IdWidth::IdWidth

    fn IdWidth::IdWidth(value : Int) -> IdWidth raise ValueError

    IdWidth::default

    fn IdWidth::default() -> IdWidth

    The width 4, as in 0042.

    IdWidth::equal

    fn IdWidth::equal(IdWidth, IdWidth) -> Bool

    IdWidth::hash

    fn IdWidth::hash(self : IdWidth) -> Int

    IdWidth::hash_combine

    fn IdWidth::hash_combine(IdWidth, Hasher) -> Unit

    IdWidth::not_equal

    fn IdWidth::not_equal(x : IdWidth, y : IdWidth) -> Bool

    IdWidth::to_int

    fn IdWidth::to_int(self : IdWidth) -> Int

    IdWidth::to_repr

    IndexEntry

    pub(all) struct IndexEntry {
    text : String
    destination : String
    description : String?
    line : Int
    } derive(Eq,
    Debug
    )

    One entry of an index.md section: * [Title](link) - description.

    IndexEntry::equal

    fn IndexEntry::equal(IndexEntry, IndexEntry) -> Bool

    IndexEntry::not_equal

    fn IndexEntry::not_equal(x : IndexEntry, y : IndexEntry) -> Bool

    IndexGroup

    pub(all) enum IndexGroup {
    Typed(ConceptType)
    Untyped
    Subdirectories
    } derive(Eq,
    Debug
    )

    A section of a generated index.

    IndexGroup::equal

    fn IndexGroup::equal(IndexGroup, IndexGroup) -> Bool

    IndexGroup::heading

    fn IndexGroup::heading(self : IndexGroup) -> String

    The heading text of the section.

    IndexGroup::not_equal

    fn IndexGroup::not_equal(x : IndexGroup, y : IndexGroup) -> Bool

    IndexHeading

    pub(all) enum IndexHeading {
    Preamble
    Titled(String,
    HeadingLevel
    )
    } derive(Eq,
    Debug
    )

    The heading of an index section.

    IndexHeading::equal

    IndexHeading::not_equal

    fn IndexHeading::not_equal(x : IndexHeading, y : IndexHeading) -> Bool

    IndexModel

    pub struct IndexModel {
    sections : ReadOnlyArray[IndexSection]
    } derive(Eq,
    Debug
    )

    The parsed body of an index.md (OKF v0.2, section 8).

    IndexModel::entries

    fn IndexModel::entries(self : IndexModel) -> Array[IndexEntry]

    Every entry, in document order.

    IndexModel::equal

    fn IndexModel::equal(IndexModel, IndexModel) -> Bool

    IndexModel::not_equal

    fn IndexModel::not_equal(x : IndexModel, y : IndexModel) -> Bool

    IndexModel::section

    fn IndexModel::section(self : IndexModel, heading : String) -> IndexSection?

    The section with this heading.

    IndexSection

    pub struct IndexSection {
    heading : IndexHeading
    line : Int
    entries : ReadOnlyArray[IndexEntry]
    text : ReadOnlyArray[String]
    } derive(Eq,
    Debug
    )

    One section of an index.md: a heading with its entries and other lines.

    IndexSection::equal

    IndexSection::not_equal

    fn IndexSection::not_equal(x : IndexSection, y : IndexSection) -> Bool

    IndexSection::title

    fn IndexSection::title(self : IndexSection) -> String?

    The heading text, or None for the preamble.

    Instant

    A point in time, in milliseconds since 1970-01-01T00:00:00Z.

    Instant::compare

    fn Instant::compare(Instant, Instant) -> Int

    Instant::date_text

    fn Instant::date_text(self : Instant) -> String

    The calendar date of an instant in UTC, as YYYY-MM-DD.

    Instant::equal

    fn Instant::equal(Instant, Instant) -> Bool

    Instant::hash

    fn Instant::hash(self : Instant) -> Int

    Instant::hash_combine

    fn Instant::hash_combine(Instant, Hasher) -> Unit

    Instant::millis

    fn Instant::millis(self : Instant) -> Int64

    Instant::not_equal

    fn Instant::not_equal(x : Instant, y : Instant) -> Bool

    Instant::of_millis

    fn Instant::of_millis(millis : Int64) -> Instant

    Instant::op_ge

    fn Instant::op_ge(x : Instant, y : Instant) -> Bool

    Instant::op_gt

    fn Instant::op_gt(x : Instant, y : Instant) -> Bool

    Instant::op_le

    fn Instant::op_le(x : Instant, y : Instant) -> Bool

    Instant::op_lt

    fn Instant::op_lt(x : Instant, y : Instant) -> Bool

    Instant::parse

    fn Instant::parse(text : String, date_only? : Bool) -> Instant?

    Parses an ISO 8601 datetime with an explicit offset, such as 2026-06-30T14:00:00Z or 2026-06-30T14:00:00.250+02:00. With date_only=true, a YYYY-MM-DD date is the start of that day in UTC.

    Instant::parse_date

    fn Instant::parse_date(text : String) -> Instant?

    Parses a calendar date written exactly as YYYY-MM-DD, such as 2026-10-23, as the start of that day in UTC. Other forms and dates that do not exist give None.

    Instant::to_repr

    Issue

    pub struct Issue {
    subject : FindingSubject
    line : Int?
    message : String
    hint : String?
    } derive(Eq,
    Debug
    )

    What a rule reports. Validation adds the rule name and the severity.

    Issue::at

    fn Issue::at(bundle : Bundle, doc : Document, message : String, line? : Int, hint? : String) -> Issue

    An issue about one document of a bundle.

    Issue::equal

    fn Issue::equal(Issue, Issue) -> Bool

    Issue::in_bundle

    fn Issue::in_bundle(key : DocKey, message : String, line? : Int, hint? : String) -> Issue

    An issue about a document of a bundle, by its key.

    Issue::not_equal

    fn Issue::not_equal(x : Issue, y : Issue) -> Bool

    Issue::stray

    fn Issue::stray(path : StorePath, message : String, hint? : String) -> Issue

    An issue about a Markdown file outside every bundle.

    Issue::to_repr

    KeyDefinition

    pub(all) struct KeyDefinition {
    key : FieldKey
    values : ReadOnlyArray[String]
    description : String
    } derive(Eq,
    Debug
    )

    A frontmatter key that a profile defines.

    KeyDefinition::KeyDefinition

    fn KeyDefinition::KeyDefinition(key : FieldKey, values? : ArrayView[String], description? : String) -> KeyDefinition

    KeyDefinition::equal

    KeyDefinition::not_equal

    fn KeyDefinition::not_equal(x : KeyDefinition, y : KeyDefinition) -> Bool

    Knowledge

    type Knowledge

    A set of bundles found under one directory, and the Markdown files that belong to no bundle.

    Knowledge::Knowledge

    fn Knowledge::Knowledge(bundles : ArrayView[Bundle], strays? : ArrayView[StorePath], options? : Options) -> Knowledge

    Knowledge with the given bundles.

    Knowledge::bundle

    fn Knowledge::bundle(self : Knowledge, label : BundleLabel) -> Lookup[Bundle]

    Finds a bundle by its full label, or by its name when the label is bare and no bundle has it as a full label.

    Knowledge::bundle_at

    fn Knowledge::bundle_at(self : Knowledge, path : StorePath) -> Bundle?

    The bundle that contains a store path, if any. The innermost bundle wins.

    Knowledge::bundles

    fn Knowledge::bundles(self : Knowledge) -> ReadOnlyArray[Bundle]

    Knowledge::concepts

    fn Knowledge::concepts(self : Knowledge) -> Array[(Bundle, Document)]

    Every concept of every bundle, with its bundle.

    Knowledge::document

    fn Knowledge::document(self : Knowledge, key : DocKey) -> Document?

    The document for a key. The bundle label must match exactly.

    Knowledge::document_at

    fn Knowledge::document_at(self : Knowledge, path : StorePath) -> (Bundle, Document)?

    The document at a store path, with its bundle.

    Knowledge::documents

    fn Knowledge::documents(self : Knowledge) -> Array[(Bundle, Document)]

    Every document of every bundle, with its bundle.

    Knowledge::facet

    fn Knowledge::facet(self : Knowledge, facet : Facet, filters? : ArrayView[Filter]) -> Array[(String, Int)]

    The values of a facet over the concepts that match filters, with their counts, most frequent first.

    Knowledge::filter

    fn Knowledge::filter(self : Knowledge, filters : ArrayView[Filter]) -> Array[(Bundle, Document)]

    The concepts that match every filter.

    Knowledge::find_document

    fn Knowledge::find_document(self : Knowledge, path : String, bundle? : BundleLabel) -> Lookup[(Bundle, Document)]

    Finds a document by bundle and path. Without an exact match, the documents whose path ends with path match. bundle narrows the search to one bundle.

    Knowledge::options

    fn Knowledge::options(self : Knowledge) -> Options

    Knowledge::scan

    fn Knowledge::scan(self : Knowledge, text : String, bodies? : Bool, filters? : ArrayView[Filter]) -> Array[ScanHit]

    Finds the concepts whose title, description, type, tags or path contain text, ignoring letter case. With bodies=true, body lines count too.

    Knowledge::strays

    fn Knowledge::strays(self : Knowledge) -> ReadOnlyArray[StorePath]

    KnowledgeResolver

    pub(all) struct KnowledgeResolver {
    knowledge : Knowledge
    }

    A resolver that knows the documents and assets of loaded knowledge.

    KnowledgeResolver::exists

    fn KnowledgeResolver::exists(self : KnowledgeResolver, path : StorePath) -> Bool

    Line

    pub struct Line {
    text : String
    start : Int
    ending : LineEnding?
    } derive(Eq,
    Debug
    )

    One line of a text, with its start offset and its line ending. Only split_lines makes lines.

    Line::ending_text

    fn Line::ending_text(self : Line) -> String

    The line ending text after the line: "\n", "\r\n", "\r", or "" for a last line without one.

    Line::equal

    fn Line::equal(Line, Line) -> Bool

    Line::not_equal

    fn Line::not_equal(x : Line, y : Line) -> Bool

    Line::to_repr

    LineEnding

    pub(all) enum LineEnding {
    Lf
    CrLf
    Cr
    } derive(Eq,
    Debug
    )

    The line ending that a text uses most, so that edits can reuse it.

    LineEnding::equal

    fn LineEnding::equal(LineEnding, LineEnding) -> Bool

    LineEnding::not_equal

    fn LineEnding::not_equal(x : LineEnding, y : LineEnding) -> Bool

    LineEnding::text

    fn LineEnding::text(self : LineEnding) -> String

    pub struct Link {
    text : String
    destination : String
    origin : LinkOrigin
    kind : LinkKind
    } derive(Eq,
    Debug
    )

    One link. Its kind always follows from its destination, so only this package and Link::Link make links. Link::Link makes profile links.
    fn Link::Link(text : String, destination : String) -> Link

    A link that a profile adds.

    Link::equal

    fn Link::equal(Link, Link) -> Bool

    Link::fragment

    fn Link::fragment(self : Link) -> String?

    The fragment after #, if any.

    Link::line_number

    fn Link::line_number(self : Link) -> Int?

    The file line of a body link.

    Link::not_equal

    fn Link::not_equal(x : Link, y : Link) -> Bool

    Link::path_part

    fn Link::path_part(self : Link) -> String

    The destination without its fragment.

    Link::to_repr

    LinkBase

    pub(all) enum LinkBase {
    FileDirectory
    BundleRoot
    } derive(Eq,
    Debug
    )

    The base for relative links and relative path-valued fields.

    LinkBase::equal

    fn LinkBase::equal(LinkBase, LinkBase) -> Bool

    LinkBase::not_equal

    fn LinkBase::not_equal(x : LinkBase, y : LinkBase) -> Bool

    LinkBase::to_repr

    LinkKind

    pub(all) enum LinkKind {
    External
    Anchor
    BundleRooted
    Relative
    } derive(Eq,
    Debug
    )

    The kind of a link destination.

    LinkKind::equal

    fn LinkKind::equal(LinkKind, LinkKind) -> Bool

    LinkKind::not_equal

    fn LinkKind::not_equal(x : LinkKind, y : LinkKind) -> Bool

    LinkKind::to_repr

    LinkOrigin

    pub enum LinkOrigin {
    Body(line~ : Int)
    FromProfile
    } derive(Eq,
    Debug
    )

    Where a link comes from. Only this package makes body links, from lines that it reads, so a body line is always a real file line.

    LinkOrigin::equal

    fn LinkOrigin::equal(LinkOrigin, LinkOrigin) -> Bool

    LinkOrigin::not_equal

    fn LinkOrigin::not_equal(x : LinkOrigin, y : LinkOrigin) -> Bool

    LogDate

    A calendar date in the form YYYY-MM-DD, as log headings and log edits use.
    impl Compare for LogDate
    impl Show for LogDate

    LogDate::LogDate

    fn LogDate::LogDate(text : String) -> LogDate raise ValueError

    Parses a real calendar date written exactly as YYYY-MM-DD.

    LogDate::compare

    fn LogDate::compare(self : LogDate, other : LogDate) -> Int

    LogDate::equal

    fn LogDate::equal(LogDate, LogDate) -> Bool

    LogDate::hash

    fn LogDate::hash(self : LogDate) -> Int

    LogDate::hash_combine

    fn LogDate::hash_combine(LogDate, Hasher) -> Unit

    LogDate::instant

    fn LogDate::instant(self : LogDate) -> Instant

    The start of the date in UTC.

    LogDate::not_equal

    fn LogDate::not_equal(x : LogDate, y : LogDate) -> Bool

    LogDate::of_instant

    fn LogDate::of_instant(instant : Instant) -> LogDate

    The UTC calendar date of an instant.

    LogDate::op_ge

    fn LogDate::op_ge(x : LogDate, y : LogDate) -> Bool

    LogDate::op_gt

    fn LogDate::op_gt(x : LogDate, y : LogDate) -> Bool

    LogDate::op_le

    fn LogDate::op_le(x : LogDate, y : LogDate) -> Bool

    LogDate::op_lt

    fn LogDate::op_lt(x : LogDate, y : LogDate) -> Bool

    LogDate::output

    fn LogDate::output(self : LogDate, logger : &Logger) -> Unit

    LogDate::to_repr

    LogDate::to_string

    fn LogDate::to_string(self : LogDate) -> String

    LogEntry

    pub(all) struct LogEntry {
    label : String?
    text : String
    line : Int
    } derive(Eq,
    Debug
    )

    One log.md entry, such as * **Update**: Added revenue metric.

    LogEntry::equal

    fn LogEntry::equal(LogEntry, LogEntry) -> Bool

    LogEntry::not_equal

    fn LogEntry::not_equal(x : LogEntry, y : LogEntry) -> Bool

    LogEntry::to_repr

    LogHeading

    pub enum LogHeading {
    Dated(LogDate)
    Undated(String)
    } derive(Eq,
    Debug
    )

    The heading of a log.md section. Only the log parser makes values, so Undated never holds a date.
    impl Show for LogHeading

    LogHeading::equal

    fn LogHeading::equal(LogHeading, LogHeading) -> Bool

    LogHeading::not_equal

    fn LogHeading::not_equal(x : LogHeading, y : LogHeading) -> Bool

    LogHeading::output

    fn LogHeading::output(self : LogHeading, logger : &Logger) -> Unit

    LogHeading::to_string

    fn LogHeading::to_string(self : LogHeading) -> String

    The heading as written.

    LogModel

    pub struct LogModel {
    sections : ReadOnlyArray[LogSection]
    } derive(Eq,
    Debug
    )

    The parsed body of a log.md (OKF v0.2, section 9).

    LogModel::equal

    fn LogModel::equal(LogModel, LogModel) -> Bool

    LogModel::not_equal

    fn LogModel::not_equal(x : LogModel, y : LogModel) -> Bool

    LogModel::order_problem

    fn LogModel::order_problem(self : LogModel) -> (LogSection, LogSection)?

    The first pair of dated sections that are not newest first, if any. The order comes from the dates, not from the heading text.

    LogModel::to_repr

    LogModel::undated_sections

    fn LogModel::undated_sections(self : LogModel) -> Array[LogSection]

    The sections whose heading is not a YYYY-MM-DD date.

    LogSection

    pub struct LogSection {
    heading : LogHeading
    line : Int
    entries : ReadOnlyArray[LogEntry]
    } derive(Eq,
    Debug
    )

    One log.md section, from one ## heading to the next.

    LogSection::equal

    fn LogSection::equal(LogSection, LogSection) -> Bool

    LogSection::not_equal

    fn LogSection::not_equal(x : LogSection, y : LogSection) -> Bool

    Lookup

    pub(all) enum Lookup[T] {
    NotFound
    Found(T)
    Ambiguous(ReadOnlyArray[T])
    } derive(Eq,
    Debug
    )

    The result of a lookup that can match nothing, one item or several items.

    Lookup::equal

    fn[T : Eq] Lookup::equal(Lookup[T], Lookup[T]) -> Bool

    Lookup::not_equal

    fn[T : Eq] Lookup::not_equal(x : Lookup[T], y : Lookup[T]) -> Bool

    Lookup::to_option

    fn[T] Lookup::to_option(self : Lookup[T]) -> T?

    Metadata

    type Metadata derive(Eq,
    Debug
    )

    The parsed frontmatter of a document: the raw block, its ordered fields and the location of each top-level key.

    Metadata::Metadata

    fn Metadata::Metadata(raw : String, first_line? : Int) -> Metadata raise MetadataError

    Parses a raw frontmatter block. first_line is the file line of the first line of raw; error positions are file positions.

    Metadata::attester

    fn Metadata::attester(self : Metadata) -> String?

    The attester.resource of an Attested Computation.

    Metadata::bool

    fn Metadata::bool(self : Metadata, key : String) -> Bool?

    Metadata::computation

    fn Metadata::computation(self : Metadata) -> String?

    Metadata::concept_type

    fn Metadata::concept_type(self : Metadata) -> ConceptType?

    The OKF type, or None when it is missing or blank.

    Metadata::contains

    fn Metadata::contains(self : Metadata, key : String) -> Bool

    Metadata::description

    fn Metadata::description(self : Metadata) -> String?

    Metadata::effective_status

    fn Metadata::effective_status(self : Metadata, options? : Options) -> Status?

    The status after the default of options applies.

    Metadata::empty

    fn Metadata::empty() -> Metadata

    An empty frontmatter, as in an empty block.

    Metadata::equal

    fn Metadata::equal(Metadata, Metadata) -> Bool

    Metadata::executor

    fn Metadata::executor(self : Metadata) -> Executor?

    Metadata::fields

    fn Metadata::fields(self : Metadata) -> Fields

    Metadata::generated

    fn Metadata::generated(self : Metadata, options? : Options) -> Attribution?

    generated, or with v01_fields a v0.1 timestamp as generated.at.

    Metadata::get

    fn Metadata::get(self : Metadata, key : String) -> Value?

    Metadata::int

    fn Metadata::int(self : Metadata, key : String) -> Int?

    Metadata::is_stale

    fn Metadata::is_stale(self : Metadata, now : Instant, options? : Options) -> Bool

    True when now is at or after stale_after. A value that does not parse under options gives false.

    Metadata::keys

    fn Metadata::keys(self : Metadata) -> Array[String]

    The top-level keys in source order.

    Metadata::line_of

    fn Metadata::line_of(self : Metadata, key : String) -> Int?

    The file line of a top-level key, when the metadata has source text.

    Metadata::mappings

    fn Metadata::mappings(self : Metadata, key : String) -> Array[Fields]

    A key read as a list of mappings; a mapping gives a list with one item.

    Metadata::not_equal

    fn Metadata::not_equal(x : Metadata, y : Metadata) -> Bool

    Metadata::of_fields

    fn Metadata::of_fields(fields : Fields) -> Metadata

    Metadata from fields, for derived metadata that has no source text.

    Metadata::parameters

    fn Metadata::parameters(self : Metadata) -> Array[Parameter]

    Metadata::raw

    fn Metadata::raw(self : Metadata) -> String

    Metadata::raw_entries

    fn Metadata::raw_entries(self : Metadata) -> ReadOnlyArray[RawEntry]

    The located top-level keys.

    Metadata::raw_text

    fn Metadata::raw_text(self : Metadata, key : String) -> String?

    The raw source text after key: on its line, as written.

    Metadata::resource

    fn Metadata::resource(self : Metadata) -> String?

    Metadata::runtime

    fn Metadata::runtime(self : Metadata) -> String?

    Metadata::sources

    fn Metadata::sources(self : Metadata) -> Array[Source]

    The sources entries that have a resource. Entries without one are left out.

    Metadata::stale_after

    fn Metadata::stale_after(self : Metadata) -> String?

    The raw stale_after text.

    Metadata::status

    fn Metadata::status(self : Metadata) -> Status?

    The written status, or None when it is absent.

    Metadata::tags

    fn Metadata::tags(self : Metadata) -> Array[String]

    Metadata::text

    fn Metadata::text(self : Metadata, key : String) -> String?

    The text of a scalar key. An empty or missing value gives None.

    Metadata::texts

    fn Metadata::texts(self : Metadata, key : String) -> Array[String]

    A key read as a list of texts; a scalar gives a list with one item.

    Metadata::title

    fn Metadata::title(self : Metadata) -> String?

    Metadata::to_repr

    Metadata::trust_tier

    fn Metadata::trust_tier(self : Metadata) -> TrustTier

    The trust tier, derived from verified only.

    Metadata::usage_window

    fn Metadata::usage_window(self : Metadata) -> UsageWindow?

    The top-level usage_window.

    Metadata::verified

    fn Metadata::verified(self : Metadata) -> Array[Attribution]

    verified as a list. A single mapping is a list with one entry.

    NestedLogs

    pub(all) enum NestedLogs {
    AllLevels
    RootOnly
    } derive(Eq,
    Debug
    )

    Which log.md files a bundle loads.

    NestedLogs::equal

    fn NestedLogs::equal(NestedLogs, NestedLogs) -> Bool

    NestedLogs::not_equal

    fn NestedLogs::not_equal(x : NestedLogs, y : NestedLogs) -> Bool

    Normalized

    pub(all) struct Normalized {
    segments : ReadOnlyArray[String]
    above : Int
    } derive(Eq,
    Debug
    )

    The result of normalizing a path: the segments that remain after . and .. are removed, and how many .. segments climbed above the start.

    Normalized::equal

    fn Normalized::equal(Normalized, Normalized) -> Bool

    Normalized::not_equal

    fn Normalized::not_equal(x : Normalized, y : Normalized) -> Bool

    Obligation

    pub(all) struct Obligation {
    name : String
    met : (Record) -> Bool
    }

    A condition that a transition requires, such as a reason value. The name is a label for reports.

    Obligation::requires_key

    fn Obligation::requires_key(key : FieldKey) -> Obligation

    An obligation that holds when the record has a non-empty value for key.

    OkfVersion

    pub enum OkfVersion {
    V01
    V02
    Unknown(String)
    } derive(Eq,
    Debug
    )

    The OKF version that a bundle declares in its root index. Only OkfVersion::parse makes values, so Unknown never holds a known version.

    OkfVersion::equal

    fn OkfVersion::equal(OkfVersion, OkfVersion) -> Bool

    OkfVersion::is_known

    fn OkfVersion::is_known(self : OkfVersion) -> Bool

    OkfVersion::not_equal

    fn OkfVersion::not_equal(x : OkfVersion, y : OkfVersion) -> Bool

    OkfVersion::parse

    fn OkfVersion::parse(text : String) -> OkfVersion

    OkfVersion::to_string

    fn OkfVersion::to_string(self : OkfVersion) -> String

    Options

    pub(all) struct Options {
    link_base : LinkBase
    status_default : Status?
    nested_logs : NestedLogs
    date_only_instants : Bool
    v01_fields : Bool
    index_links_count : Bool
    } derive(Eq,
    Debug
    )

    The options for each known difference between the OKF v0.2 specification and existing tools. Options::default() follows the specification.

    Options::default

    fn Options::default() -> Options

    The OKF v0.2 behavior.

    Options::equal

    fn Options::equal(Options, Options) -> Bool

    Options::not_equal

    fn Options::not_equal(x : Options, y : Options) -> Bool

    Options::to_repr

    Options::update

    fn Options::update(self : Options, link_base? : LinkBase, status_default? : Status?, nested_logs? : NestedLogs, date_only_instants? : Bool, v01_fields? : Bool, index_links_count? : Bool) -> Options

    A copy with the given options changed.

    Parameter

    pub(all) struct Parameter {
    name : String
    type_ : String?
    required : Bool
    } derive(Eq,
    Debug
    )

    One parameters entry of an Attested Computation.

    Parameter::equal

    fn Parameter::equal(Parameter, Parameter) -> Bool

    Parameter::not_equal

    fn Parameter::not_equal(x : Parameter, y : Parameter) -> Bool

    PathListResolver

    type PathListResolver

    A resolver that knows a fixed list of extra paths. It keeps its own copy of the list.

    PathListResolver::PathListResolver

    fn PathListResolver::PathListResolver(paths : ArrayView[StorePath]) -> PathListResolver

    PathListResolver::exists

    fn PathListResolver::exists(self : PathListResolver, path : StorePath) -> Bool

    ProfileConflict

    pub(all) enum ProfileConflict {
    KeyConflict(key~ : FieldKey, first~ : String, second~ : String)
    RegisterConflict(concept_type~ : ConceptType, first~ : String, second~ : String)
    ProfileInvalid(profile~ : String, error~ : ValueError)
    } derive(Eq,
    Debug
    )

    Two profiles that define the same key or register differently.

    ProfileConflict::equal

    ProfileConflict::not_equal

    fn ProfileConflict::not_equal(x : ProfileConflict, y : ProfileConflict) -> Bool

    RawEntry

    pub(all) struct RawEntry {
    key : String
    inline : String
    first_line : Int
    last_line : Int
    } derive(Eq,
    Debug
    )

    One top-level key of a frontmatter block, located in the raw block text.

    RawEntry::equal

    fn RawEntry::equal(RawEntry, RawEntry) -> Bool

    RawEntry::not_equal

    fn RawEntry::not_equal(x : RawEntry, y : RawEntry) -> Bool

    RawEntry::to_repr

    Record

    pub struct Record {
    register : RegisterName
    bundle : BundleLabel
    id : RecordId?
    state : StateName?
    document : Document
    }

    One record of a register: a typed view of one concept.

    Record::key

    fn Record::key(self : Record) -> DocKey

    Record::metadata

    fn Record::metadata(self : Record) -> Metadata

    Record::with_document

    fn Record::with_document(self : Record, document : Document) -> Record

    The frontmatter of the record's concept. The same record with another text of its document, such as the preview of an edit. The ID and the state stay as they were, so a transition check on the preview starts from the current state.

    RecordId

    A record ID, such as 0042. It is not blank.
    impl Compare for RecordId
    impl Show for RecordId

    RecordId::RecordId

    fn RecordId::RecordId(text : String) -> RecordId raise ValueError

    RecordId::compare

    fn RecordId::compare(self : RecordId, other : RecordId) -> Int

    RecordId::equal

    fn RecordId::equal(RecordId, RecordId) -> Bool

    RecordId::hash

    fn RecordId::hash(self : RecordId) -> Int

    RecordId::hash_combine

    fn RecordId::hash_combine(RecordId, Hasher) -> Unit

    RecordId::not_equal

    fn RecordId::not_equal(x : RecordId, y : RecordId) -> Bool

    RecordId::op_ge

    fn RecordId::op_ge(x : RecordId, y : RecordId) -> Bool

    RecordId::op_gt

    fn RecordId::op_gt(x : RecordId, y : RecordId) -> Bool

    RecordId::op_le

    fn RecordId::op_le(x : RecordId, y : RecordId) -> Bool

    RecordId::op_lt

    fn RecordId::op_lt(x : RecordId, y : RecordId) -> Bool

    RecordId::output

    fn RecordId::output(self : RecordId, logger : &Logger) -> Unit

    RecordId::to_repr

    RecordId::to_string

    fn RecordId::to_string(self : RecordId) -> String

    RefTarget

    pub(all) enum RefTarget {
    ToDocument(DocKey)
    ToRecord(register~ : RegisterName, record~ : DocKey)
    ToFile(StorePath)
    ToUri(String)
    FreeText(String)
    Malformed(String)
    Unresolved(String)
    } derive(Eq,
    Debug
    )

    What a typed reference points to.

    RefTarget::equal

    fn RefTarget::equal(RefTarget, RefTarget) -> Bool

    RefTarget::not_equal

    fn RefTarget::not_equal(x : RefTarget, y : RefTarget) -> Bool

    ReferenceField

    pub(all) struct ReferenceField {
    key : FieldKey
    kind : ReferenceKind
    } derive(Eq,
    Debug
    )

    A frontmatter field whose values name documents or records.

    ReferenceField::equal

    ReferenceField::not_equal

    fn ReferenceField::not_equal(x : ReferenceField, y : ReferenceField) -> Bool

    ReferenceKind

    pub(all) enum ReferenceKind {
    DocumentRef
    RecordRef(register~ : RegisterName)
    PathRef
    } derive(Eq,
    Debug
    )

    What a reference field names.

    ReferenceKind::equal

    ReferenceKind::not_equal

    fn ReferenceKind::not_equal(x : ReferenceKind, y : ReferenceKind) -> Bool

    Region

    pub(all) struct Region {
    marker : String
    preamble : String
    content : String
    line : Int
    } derive(Eq,
    Debug
    )

    A region of a document that starts at a marker comment, such as <!-- kb:sources -->, and runs to the end of the document.

    Region::equal

    fn Region::equal(Region, Region) -> Bool

    Region::not_equal

    fn Region::not_equal(x : Region, y : Region) -> Bool

    Region::to_repr

    Register

    type Register

    A typed view of the concepts of one type, defined by a profile. Build it with Register::Register, which checks its parts.

    Register::Register

    fn Register::Register(name : RegisterName, concept_type : ConceptType, id_rule? : IdRule, state_key? : FieldKey, states? : ArrayView[StateName], transitions? : ArrayView[Transition], supersedes_key? : FieldKey, superseded_by_key? : FieldKey, superseded_states? : ArrayView[StateName], bundle_flag? : FieldKey, fields? : ArrayView[KeyDefinition]) -> Register raise ValueError

    Builds a register. When states is not empty, every transition state and every superseded state must be one of them; otherwise it raises UnknownState.

    Register::all_records

    fn Register::all_records(self : Register, knowledge : Knowledge) -> Array[Record]

    The records of every bundle where the register applies.

    Register::applies_to

    fn Register::applies_to(self : Register, bundle : Bundle) -> Bool

    True when the register applies to bundle: no bundle flag, or the root index sets the flag to true.

    Register::bundle_flag

    fn Register::bundle_flag(self : Register) -> FieldKey?

    Register::check_transition

    fn Register::check_transition(self : Register, record : Record, to : StateName) -> Result[Unit, TransitionDenial]

    Checks whether record can move to state to: Ok when it can, else the reason why not.

    Register::concept_type

    fn Register::concept_type(self : Register) -> ConceptType

    Register::duplicates

    fn Register::duplicates(_self : Register, records : ArrayView[Record]) -> Array[(RecordId, ReadOnlyArray[Record])]

    The IDs that more than one record has, with those records, sorted by ID.

    Register::fields

    fn Register::fields(self : Register) -> ReadOnlyArray[KeyDefinition]

    Register::find

    fn Register::find(self : Register, records : ArrayView[Record], query : String) -> Lookup[Record]

    Finds records by ID (42 or 0042) or by a part of the file name.

    Register::id_rule

    fn Register::id_rule(self : Register) -> IdRule

    Register::name

    fn Register::name(self : Register) -> RegisterName

    Register::parse_id

    fn Register::parse_id(self : Register, text : String) -> RecordId?

    The record ID for an ID that a user or a field gives, such as 42.

    Register::record_id

    fn Register::record_id(self : Register, doc : Document) -> RecordId?

    The ID of a document under this register.

    Register::records

    fn Register::records(self : Register, bundle : Bundle) -> Array[Record]

    The records of bundle: its concepts whose type equals the register type, ignoring letter case.

    Register::state_key

    fn Register::state_key(self : Register) -> FieldKey?

    Register::states

    fn Register::states(self : Register) -> ReadOnlyArray[StateName]

    Register::successors

    fn Register::successors(self : Register, records : ArrayView[Record], record : Record) -> Array[Record]

    The chain of successors of record, following superseded_by. A cycle ends the chain.

    Register::superseded_by_key

    fn Register::superseded_by_key(self : Register) -> FieldKey?

    Register::superseded_states

    fn Register::superseded_states(self : Register) -> ReadOnlyArray[StateName]

    Register::supersedes_key

    fn Register::supersedes_key(self : Register) -> FieldKey?

    Register::supersession_issues

    fn Register::supersession_issues(self : Register, records : ArrayView[Record]) -> Array[SupersessionIssue]

    Checks the supersession fields of records, which come from one bundle.

    Register::transitions

    fn Register::transitions(self : Register) -> ReadOnlyArray[Transition]

    RegisterName

    type RegisterName derive(Eq, Hash,
    Debug
    )

    A register name, such as decision. It is not blank.

    RegisterName::RegisterName

    fn RegisterName::RegisterName(text : String) -> RegisterName raise ValueError

    RegisterName::equal

    RegisterName::hash

    fn RegisterName::hash(self : RegisterName) -> Int

    RegisterName::hash_combine

    fn RegisterName::hash_combine(RegisterName, Hasher) -> Unit

    RegisterName::not_equal

    fn RegisterName::not_equal(x : RegisterName, y : RegisterName) -> Bool

    RegisterName::output

    fn RegisterName::output(self : RegisterName, logger : &Logger) -> Unit

    RegisterName::to_string

    fn RegisterName::to_string(self : RegisterName) -> String

    Report

    type Report

    The sorted findings of one validation run.

    Report::count

    fn Report::count(self : Report, severity : Severity) -> Int

    Report::fails

    fn Report::fails(self : Report, strict? : Bool) -> Bool

    True when the result fails: any error, or any warning in strict mode.

    Report::findings

    fn Report::findings(self : Report) -> ReadOnlyArray[Finding]

    Report::of_rule

    fn Report::of_rule(self : Report, rule : RuleName) -> Array[Finding]

    The findings of one rule.

    Resolution

    pub(all) enum Resolution {
    ExternalUri(String)
    SameDocument(String)
    StoreTarget(path~ : StorePath, fragment~ : String?, escapes~ : Bool)
    Unresolvable(String)
    } derive(Eq,
    Debug
    )

    Where a link points, before existence checks.

    Resolution::equal

    fn Resolution::equal(Resolution, Resolution) -> Bool

    Resolution::not_equal

    fn Resolution::not_equal(x : Resolution, y : Resolution) -> Bool

    Rule

    type Rule

    One named check with a default severity.

    Rule::Rule

    fn Rule::Rule(name : RuleName, severity : Severity, check : (ValidationContext) -> Array[Issue]) -> Rule

    Rule::name

    fn Rule::name(self : Rule) -> RuleName

    Rule::severity

    fn Rule::severity(self : Rule) -> Severity

    RuleName

    The name of a validation rule, in lower-case kebab case, such as link-broken.
    impl Compare for RuleName
    impl Show for RuleName

    RuleName::RuleName

    fn RuleName::RuleName(text : String) -> RuleName raise ValueError

    RuleName::compare

    fn RuleName::compare(self : RuleName, other : RuleName) -> Int

    RuleName::equal

    fn RuleName::equal(RuleName, RuleName) -> Bool

    RuleName::hash

    fn RuleName::hash(self : RuleName) -> Int

    RuleName::hash_combine

    fn RuleName::hash_combine(RuleName, Hasher) -> Unit

    RuleName::not_equal

    fn RuleName::not_equal(x : RuleName, y : RuleName) -> Bool

    RuleName::op_ge

    fn RuleName::op_ge(x : RuleName, y : RuleName) -> Bool

    RuleName::op_gt

    fn RuleName::op_gt(x : RuleName, y : RuleName) -> Bool

    RuleName::op_le

    fn RuleName::op_le(x : RuleName, y : RuleName) -> Bool

    RuleName::op_lt

    fn RuleName::op_lt(x : RuleName, y : RuleName) -> Bool

    RuleName::output

    fn RuleName::output(self : RuleName, logger : &Logger) -> Unit

    RuleName::to_repr

    RuleName::to_string

    fn RuleName::to_string(self : RuleName) -> String

    RuleSet

    type RuleSet

    A named group of rules. The name is a label for reports.

    RuleSet::RuleSet

    fn RuleSet::RuleSet(name : String, rules : ArrayView[Rule]) -> RuleSet

    RuleSet::name

    fn RuleSet::name(self : RuleSet) -> String

    RuleSet::rules

    fn RuleSet::rules(self : RuleSet) -> ReadOnlyArray[Rule]

    ScanField

    pub(all) enum ScanField {
    TitleField
    DescriptionField
    TypeField
    TagsField
    PathField
    } derive(Eq,
    Debug
    )

    A field that a text scan can match.

    ScanField::equal

    fn ScanField::equal(ScanField, ScanField) -> Bool

    ScanField::not_equal

    fn ScanField::not_equal(x : ScanField, y : ScanField) -> Bool

    ScanHit

    pub struct ScanHit {
    key : DocKey
    fields : ReadOnlyArray[ScanField]
    lines : ReadOnlyArray[(Int, String)]
    } derive(Eq,
    Debug
    )

    One result of a text scan.

    ScanHit::equal

    fn ScanHit::equal(ScanHit, ScanHit) -> Bool

    ScanHit::not_equal

    fn ScanHit::not_equal(x : ScanHit, y : ScanHit) -> Bool

    ScanHit::to_repr

    SearchHit

    pub(all) struct SearchHit {
    key : DocKey
    score : Double
    snippet : String
    } derive(Eq,
    Debug
    )

    One ranked search result.

    SearchHit::equal

    fn SearchHit::equal(SearchHit, SearchHit) -> Bool

    SearchHit::not_equal

    fn SearchHit::not_equal(x : SearchHit, y : SearchHit) -> Bool

    SearchLimit

    type SearchLimit derive(Eq, Hash,
    Debug
    )

    The number of results that a search request may give: 1 to max_search_limit.

    SearchLimit::SearchLimit

    fn SearchLimit::SearchLimit(value : Int) -> SearchLimit raise ValueError

    SearchLimit::default

    fn SearchLimit::default() -> SearchLimit

    The default limit, 20.

    SearchLimit::equal

    fn SearchLimit::equal(SearchLimit, SearchLimit) -> Bool

    SearchLimit::hash

    fn SearchLimit::hash(self : SearchLimit) -> Int

    SearchLimit::hash_combine

    fn SearchLimit::hash_combine(SearchLimit, Hasher) -> Unit

    SearchLimit::not_equal

    fn SearchLimit::not_equal(x : SearchLimit, y : SearchLimit) -> Bool

    SearchLimit::to_int

    fn SearchLimit::to_int(self : SearchLimit) -> Int

    SearchRequest

    pub struct SearchRequest {
    query : String
    filters : ReadOnlyArray[Filter]
    limit : SearchLimit
    } derive(Eq,
    Debug
    )

    A ranked search request.

    SearchRequest::SearchRequest

    fn SearchRequest::SearchRequest(query : String, filters? : ArrayView[Filter], limit? : SearchLimit) -> SearchRequest

    SearchRequest::equal

    SearchRequest::not_equal

    fn SearchRequest::not_equal(x : SearchRequest, y : SearchRequest) -> Bool

    SectionContent

    pub struct SectionContent {
    heading : Heading
    text : String
    code_blocks : ReadOnlyArray[CodeBlock]
    } derive(Eq,
    Debug
    )

    The content under one heading, up to the next heading of the same or a higher level.

    SectionContent::equal

    SectionContent::not_equal

    fn SectionContent::not_equal(x : SectionContent, y : SectionContent) -> Bool

    Severity

    pub(all) enum Severity {
    Error
    Warning
    Info
    } derive(Compare, Eq, Hash,
    Debug
    )

    The severity of a finding. Errors sort first.

    Severity::compare

    fn Severity::compare(Severity, Severity) -> Int

    Severity::equal

    fn Severity::equal(Severity, Severity) -> Bool

    Severity::hash

    fn Severity::hash(self : Severity) -> Int

    Severity::hash_combine

    fn Severity::hash_combine(Severity, Hasher) -> Unit

    Severity::not_equal

    fn Severity::not_equal(x : Severity, y : Severity) -> Bool

    Severity::op_ge

    fn Severity::op_ge(x : Severity, y : Severity) -> Bool

    Severity::op_gt

    fn Severity::op_gt(x : Severity, y : Severity) -> Bool

    Severity::op_le

    fn Severity::op_le(x : Severity, y : Severity) -> Bool

    Severity::op_lt

    fn Severity::op_lt(x : Severity, y : Severity) -> Bool

    Severity::to_repr

    Severity::to_string

    fn Severity::to_string(self : Severity) -> String

    The short form of a severity, as reports print it: error, warn or info.

    Source

    pub(all) struct Source {
    resource : String
    id : String?
    title : String?
    author : String?
    usage_count : Int?
    last_modified : String?
    usage_window : UsageWindow?
    } derive(Eq,
    Debug
    )

    One sources entry (OKF v0.2, section 5.1).

    Source::equal

    fn Source::equal(Source, Source) -> Bool

    Source::not_equal

    fn Source::not_equal(x : Source, y : Source) -> Bool

    Source::to_repr

    StateName

    type StateName derive(Eq, Hash,
    Debug
    )

    A state of a register, such as Accepted. It is not blank, and it is compared exactly as written.
    impl Show for StateName

    StateName::StateName

    fn StateName::StateName(text : String) -> StateName raise ValueError

    StateName::equal

    fn StateName::equal(StateName, StateName) -> Bool

    StateName::hash

    fn StateName::hash(self : StateName) -> Int

    StateName::hash_combine

    fn StateName::hash_combine(StateName, Hasher) -> Unit

    StateName::not_equal

    fn StateName::not_equal(x : StateName, y : StateName) -> Bool

    StateName::output

    fn StateName::output(self : StateName, logger : &Logger) -> Unit

    StateName::to_string

    fn StateName::to_string(self : StateName) -> String

    Status

    pub(all) enum Status {
    Draft
    Stable
    Deprecated
    Unknown(UnknownStatus)
    } derive(Eq,
    Debug
    )

    The lifecycle status of a concept (OKF v0.2, section 5.4).

    Status::equal

    fn Status::equal(Status, Status) -> Bool

    Status::not_equal

    fn Status::not_equal(x : Status, y : Status) -> Bool

    Status::parse

    fn Status::parse(text : String) -> Status?

    Parses a status word, ignoring letter case and surrounding white space. A blank text has no status.

    Status::to_repr

    Status::to_string

    fn Status::to_string(self : Status) -> String

    StoreDir

    A directory below the root of a document set or store, given as segments. The root itself has no segments. No segment is empty, . or ...
    impl Compare for StoreDir
    impl Show for StoreDir

    StoreDir::StoreDir

    fn StoreDir::StoreDir(text : String) -> StoreDir raise PathError

    Parses a directory path such as kb/bundles. / and \ are both separators; "" is the root. A path that escapes the root is refused.

    StoreDir::child

    fn StoreDir::child(self : StoreDir, entry : EntryName) -> StoreDir

    The child directory with the name of one entry, such as a listed directory.

    StoreDir::compare

    fn StoreDir::compare(self : StoreDir, other : StoreDir) -> Int

    StoreDir::contains

    fn StoreDir::contains(self : StoreDir, path : StorePath) -> Bool

    True when path is inside this directory, at any depth.

    StoreDir::encloses

    fn StoreDir::encloses(self : StoreDir, other : StoreDir) -> Bool

    True when other is this directory or below it.

    StoreDir::equal

    fn StoreDir::equal(StoreDir, StoreDir) -> Bool

    StoreDir::file

    fn StoreDir::file(self : StoreDir, entry : EntryName) -> StorePath

    The path of the file entry in this directory.

    StoreDir::hash

    fn StoreDir::hash(self : StoreDir) -> Int

    StoreDir::hash_combine

    fn StoreDir::hash_combine(StoreDir, Hasher) -> Unit

    StoreDir::is_root

    fn StoreDir::is_root(self : StoreDir) -> Bool

    StoreDir::name

    fn StoreDir::name(self : StoreDir) -> String?

    The last segment, or None for the root.

    StoreDir::not_equal

    fn StoreDir::not_equal(x : StoreDir, y : StoreDir) -> Bool

    StoreDir::op_ge

    fn StoreDir::op_ge(x : StoreDir, y : StoreDir) -> Bool

    StoreDir::op_gt

    fn StoreDir::op_gt(x : StoreDir, y : StoreDir) -> Bool

    StoreDir::op_le

    fn StoreDir::op_le(x : StoreDir, y : StoreDir) -> Bool

    StoreDir::op_lt

    fn StoreDir::op_lt(x : StoreDir, y : StoreDir) -> Bool

    StoreDir::output

    fn StoreDir::output(self : StoreDir, logger : &Logger) -> Unit

    StoreDir::resolve

    fn StoreDir::resolve(self : StoreDir, path : BundlePath) -> StorePath

    The store path of a bundle path, with this directory as the bundle root.

    StoreDir::root

    fn StoreDir::root() -> StoreDir

    The root directory.

    StoreDir::segments

    fn StoreDir::segments(self : StoreDir) -> ReadOnlyArray[String]

    StoreDir::to_repr

    StoreDir::to_string

    fn StoreDir::to_string(self : StoreDir) -> String

    StorePath

    type StorePath derive(Eq, Hash,
    Debug
    )

    A file path relative to the root of a document set or store. It never escapes that root. Its text form uses / and has no leading /.
    impl Show for StorePath

    StorePath::StorePath

    fn StorePath::StorePath(text : String) -> StorePath raise PathError

    Validates text as a store path. / and \ are both separators.

    StorePath::compare

    fn StorePath::compare(self : StorePath, other : StorePath) -> Int

    StorePath::equal

    fn StorePath::equal(StorePath, StorePath) -> Bool

    StorePath::hash

    fn StorePath::hash(self : StorePath) -> Int

    StorePath::hash_combine

    fn StorePath::hash_combine(StorePath, Hasher) -> Unit

    StorePath::is_under

    fn StorePath::is_under(self : StorePath, dir : StoreDir) -> Bool

    True when self is inside the directory dir, at any depth.

    StorePath::name

    fn StorePath::name(self : StorePath) -> String

    The last segment, for example customers.md.

    StorePath::not_equal

    fn StorePath::not_equal(x : StorePath, y : StorePath) -> Bool

    StorePath::op_ge

    fn StorePath::op_ge(x : StorePath, y : StorePath) -> Bool

    StorePath::op_gt

    fn StorePath::op_gt(x : StorePath, y : StorePath) -> Bool

    StorePath::op_le

    fn StorePath::op_le(x : StorePath, y : StorePath) -> Bool

    StorePath::op_lt

    fn StorePath::op_lt(x : StorePath, y : StorePath) -> Bool

    StorePath::output

    fn StorePath::output(self : StorePath, logger : &Logger) -> Unit

    StorePath::parent

    fn StorePath::parent(self : StorePath) -> StoreDir

    The directory of the file: the root for a file at the root.

    StorePath::segments

    fn StorePath::segments(self : StorePath) -> ReadOnlyArray[String]

    StorePath::to_string

    fn StorePath::to_string(self : StorePath) -> String

    SupersessionIssue

    pub(all) enum SupersessionIssue {
    MissingSuccessor(Record)
    UnknownSuccessor(Record, RecordId)
    UnknownPredecessor(Record, RecordId)
    NotMutual(Record, Record)
    }

    A supersession problem.

    Target

    pub(all) enum Target {
    Doc(DocKey)
    File(StorePath)
    Uri(String)
    Fragment(String)
    Broken(StorePath?)
    } derive(Eq,
    Debug
    )

    The target of a link after resolution and existence checks.

    Target::equal

    fn Target::equal(Target, Target) -> Bool

    Target::not_equal

    fn Target::not_equal(x : Target, y : Target) -> Bool

    Target::to_repr

    Template

    pub(all) struct Template {
    concept_type : ConceptType
    body : String
    } derive(Eq,
    Debug
    )

    A template for new concepts of one type. The body can use {{title}}, {{description}} and {{type}}.

    Template::equal

    fn Template::equal(Template, Template) -> Bool

    Template::not_equal

    fn Template::not_equal(x : Template, y : Template) -> Bool

    Template::to_repr

    Transition

    type Transition

    An allowed change of state. An empty from allows any current state.

    Transition::Transition

    fn Transition::Transition(to : StateName, from? : ArrayView[StateName], obligations? : ArrayView[Obligation]) -> Transition

    Transition::from

    fn Transition::from(self : Transition) -> ReadOnlyArray[StateName]

    Transition::obligations

    fn Transition::obligations(self : Transition) -> ReadOnlyArray[Obligation]

    Transition::to

    fn Transition::to(self : Transition) -> StateName

    TransitionDenial

    pub(all) enum TransitionDenial {
    UnknownState(StateName)
    NotAllowed(from~ : StateName?, to~ : StateName)
    Refused(ReadOnlyArray[String])
    } derive(Eq,
    Debug
    )

    Why a register refuses a transition.

    TransitionDenial::equal

    TransitionDenial::not_equal

    fn TransitionDenial::not_equal(x : TransitionDenial, y : TransitionDenial) -> Bool

    TrustTier

    pub(all) enum TrustTier {
    Unverified
    MachineConfirmed
    HumanReviewed
    } derive(Compare, Eq,
    Debug
    )

    The derived trust tier (OKF v0.2, section 5.3).

    TrustTier::compare

    fn TrustTier::compare(TrustTier, TrustTier) -> Int

    TrustTier::equal

    fn TrustTier::equal(TrustTier, TrustTier) -> Bool

    TrustTier::not_equal

    fn TrustTier::not_equal(x : TrustTier, y : TrustTier) -> Bool

    TrustTier::op_ge

    fn TrustTier::op_ge(x : TrustTier, y : TrustTier) -> Bool

    TrustTier::op_gt

    fn TrustTier::op_gt(x : TrustTier, y : TrustTier) -> Bool

    TrustTier::op_le

    fn TrustTier::op_le(x : TrustTier, y : TrustTier) -> Bool

    TrustTier::op_lt

    fn TrustTier::op_lt(x : TrustTier, y : TrustTier) -> Bool

    TypedReference

    pub struct TypedReference {
    key : FieldKey
    value : String
    line : Int?
    target : RefTarget
    } derive(Eq,
    Debug
    )

    One typed reference of a document. The key is the frontmatter key, such as sources.

    TypedReference::equal

    TypedReference::is_resolved

    fn TypedReference::is_resolved(self : TypedReference) -> Bool

    TypedReference::not_equal

    fn TypedReference::not_equal(x : TypedReference, y : TypedReference) -> Bool

    UnknownStatus

    type UnknownStatus derive(Eq, Hash,
    Debug
    )

    A status word that is not draft, stable or deprecated. Only Status::parse makes one, so it is never blank and never a known word.

    UnknownStatus::equal

    UnknownStatus::hash

    fn UnknownStatus::hash(self : UnknownStatus) -> Int

    UnknownStatus::hash_combine

    fn UnknownStatus::hash_combine(UnknownStatus, Hasher) -> Unit

    UnknownStatus::not_equal

    fn UnknownStatus::not_equal(x : UnknownStatus, y : UnknownStatus) -> Bool

    UnknownStatus::output

    fn UnknownStatus::output(self : UnknownStatus, logger : &Logger) -> Unit

    UnknownStatus::to_string

    fn UnknownStatus::to_string(self : UnknownStatus) -> String

    UsageWindow

    pub(all) struct UsageWindow {
    from : String?
    to : String?
    } derive(Eq,
    Debug
    )

    A usage_window mapping with its raw from and to texts.

    UsageWindow::equal

    fn UsageWindow::equal(UsageWindow, UsageWindow) -> Bool

    UsageWindow::not_equal

    fn UsageWindow::not_equal(x : UsageWindow, y : UsageWindow) -> Bool

    ValidationConfig

    type ValidationConfig

    How a caller adjusts validation. The config keeps its own copies, so later changes to the arrays that built it do not change it.

    ValidationConfig::ValidationConfig

    fn ValidationConfig::ValidationConfig(overrides? : ArrayView[(RuleName, Severity)], disabled? : ArrayView[RuleName]) -> ValidationConfig

    ValidationConfig::disabled

    fn ValidationConfig::disabled(self : ValidationConfig) -> ReadOnlyArray[RuleName]

    The rules that do not run.

    ValidationConfig::overrides

    fn ValidationConfig::overrides(self : ValidationConfig) -> ReadOnlyArray[(RuleName, Severity)]

    The severity changes, by rule name.

    ValidationContext

    pub struct ValidationContext {
    knowledge : Knowledge
    graph : Graph
    now : Instant
    options : Options
    vocabulary : Vocabulary
    profiles : ReadOnlyArray[&Profile]
    }

    The inputs that every rule can read.

    Value

    pub(all) enum Value {
    Scalar(String)
    Seq(ReadOnlyArray[Value])
    Mapping(Fields)
    Null
    } derive(Eq,
    Debug
    )

    A frontmatter value. Every scalar is kept as text, so dates, timestamps and numbers stay as written. Typed accessors read the text when asked.

    Value::as_bool

    fn Value::as_bool(self : Value) -> Bool?

    Reads true, yes and on as true and false, no and off as false, ignoring letter case.

    Value::as_int

    fn Value::as_int(self : Value) -> Int?

    Value::as_mappings

    fn Value::as_mappings(self : Value) -> Array[Fields]

    Reads a value as a list of mappings. A mapping becomes a list with one item.

    Value::as_text

    fn Value::as_text(self : Value) -> String?

    The text of a scalar value, or None for other values.

    Value::as_texts

    fn Value::as_texts(self : Value) -> Array[String]

    Reads a value as a list of texts. A scalar becomes a list with one item. Items that are not scalars are left out.

    Value::equal

    fn Value::equal(Value, Value) -> Bool

    Value::not_equal

    fn Value::not_equal(x : Value, y : Value) -> Bool

    Value::to_repr

    Vocabulary

    type Vocabulary

    The keys that validation treats as known: OKF keys and profile keys.

    Vocabulary::knows

    fn Vocabulary::knows(self : Vocabulary, key : String) -> Bool

    True when the key is an OKF or profile concept key.

    Vocabulary::knows_bundle_key

    fn Vocabulary::knows_bundle_key(self : Vocabulary, key : String) -> Bool

    True when the key is an OKF or profile root index key.

    Vocabulary::of_profiles

    fn Vocabulary::of_profiles(profiles : ArrayView[&Profile]) -> Vocabulary

    The OKF vocabulary plus the vocabulary of each profile. The value of each key is the name of the profile that defines it, or okf. A profile whose definitions break a rule adds no keys; validate reports it.

    advisory

    fn advisory() -> RuleSet

    Advisory rules. They report quality problems that OKF v0.2 tolerates; the caller sets their severity with ValidationConfig.

    classify_destination

    fn classify_destination(dest : String) -> LinkKind

    Classifies a link destination.

    detect_line_ending

    fn detect_line_ending(text : String) -> LineEnding

    The line ending of the first line break in text, or Lf when there is none.

    discover

    fn discover(set : DocumentSet, under? : StoreDir, options? : Options, profiles? : ArrayView[&Profile]) -> Knowledge

    Finds each bundle under the directory under: each directory whose index.md frontmatter contains okf_version. It does not look for bundles inside a bundle. Markdown files outside every bundle, except README.md, are strays.

    effective_options

    fn effective_options(profiles : ArrayView[&Profile], caller? : Options) -> Options

    The options to load with: the caller's options when given, else the options of the first profile that has some, else the OKF v0.2 defaults.

    encode_utf8

    fn encode_utf8(text : String) -> Bytes

    Encodes text as UTF-8.

    find_region

    fn find_region(text : String, name : String) -> Region?

    Finds the region that the marker <!-- name --> starts.

    generate_index

    fn generate_index(bundle : Bundle, dir? : StoreDir, describe? : (StoreDir) -> String?) -> String

    Generates the content of the index.md for the bundle directory dir: its concepts grouped by type (sorted by type, then by title ignoring case), and a Subdirectories section. describe gives the description of a subdirectory. The root index keeps the okf_version of the bundle.

    is_markdown_name

    fn is_markdown_name(name : String) -> Bool

    True when name ends with .md, ignoring letter case.

    kind_of

    fn kind_of(path : BundlePath) -> DocKind

    The kind of the Markdown file at path.

    lexical_compare

    fn lexical_compare(a : String, b : String) -> Int

    Compares two strings code unit by code unit, so that a < ab < b.
    fn link_escapes(bundle : Bundle, doc : Document, link : Link, options? : Options) -> Bool

    True when a bundle-rooted or relative link climbs above the bundle root, whether or not its target exists.

    load_bundle

    fn load_bundle(set : DocumentSet, root? : StoreDir, label? : BundleLabel, options? : Options, profiles? : ArrayView[&Profile]) -> Bundle

    Loads the bundle whose root is the directory root of a document set. Each Markdown file under the root becomes a document; other files become assets. Without label, the label is the name of the root directory, or . for the store root.

    marker_comment

    fn marker_comment(name : String) -> String

    The comment form of a marker name: <!-- name -->.

    max_search_limit

    let max_search_limit : Int

    The largest search limit.

    normalize_description

    fn normalize_description(text : String) -> String

    Normalizes a description for drift checks: lower case, single spaces, and no trailing full stop.

    normalize_id

    fn normalize_id(text : String, width : IdWidth) -> RecordId?

    Normalizes an ID: digits only, padded with zeros to width. Text that is not all digits gives None.

    normalize_path

    fn normalize_path(text : String) -> Normalized

    Splits text on / and \, removes empty and . segments, and applies .. segments. A .. with nothing left to remove counts in above.

    okf_concept_keys

    let okf_concept_keys : ReadOnlyArray[String]

    The keys that OKF v0.2 defines for concepts.

    okf_v02_conformance

    fn okf_v02_conformance() -> RuleSet

    The OKF v0.2 conformance rules (section 11): parseable frontmatter and a non-empty type on each concept, and index.md and log.md in their formats.

    parse_index_entry

    fn parse_index_entry(line : String, line_number? : Int) -> IndexEntry?

    Parses an index entry line: a list item that starts with a link, then an optional - , — or : and a description.

    profile_conflicts

    fn profile_conflicts(profiles : ArrayView[&Profile]) -> Array[ProfileConflict]

    The conflicts between profiles, and the profiles whose definitions break a rule. The library never selects one definition in silence; a caller reports the conflicts or removes a profile.

    registers_of

    fn registers_of(profiles : ArrayView[&Profile]) -> Array[Register]

    Every register of profiles. A profile whose registers raise adds none; validate reports it, and the registers of the other profiles stay.

    resolve_field_path

    fn resolve_field_path(bundle : Bundle, doc : Document, value : String, options? : Options) -> Resolution

    Resolves a path-valued field (such as sources[].resource) of doc.
    fn resolve_link(bundle : Bundle, doc : Document, link : Link, options? : Options) -> Resolution

    Resolves a link of doc in bundle with the link base of options.

    scan_entries

    fn scan_entries(raw : String) -> Array[RawEntry]

    Finds each top-level key of a raw frontmatter block, in source order, with the lines of its value. Trailing blank and comment lines do not belong to a value.

    search_knowledge

    fn search_knowledge(knowledge : Knowledge, request : SearchRequest) -> Array[SearchHit]

    Ranks the concepts of knowledge for request with BM25 over title, description, tags and body. Every query term must occur in the concept. Equal scores sort by bundle label and path, so results are deterministic.

    slugify

    fn slugify(text : String) -> String

    A GitHub-style slug: lower case, letters, digits, - and _, with spaces as -.

    split_header

    fn split_header(text : String) -> Header

    Splits text into a frontmatter block and a body, as OKF and moonrockz/mdc read it: a first line --- opens the block, and the next --- or ... line closes it. A leading byte order mark is allowed.

    split_lines

    fn split_lines(text : String) -> Array[Line]

    Splits text into lines. LF, CRLF and CR all end a line. A final line without a line ending is kept; an empty text has no lines.

    tokenize

    fn tokenize(text : String) -> Array[String]

    Splits text into lower-case terms of letters and digits.

    typed_references

    fn typed_references(knowledge : Knowledge, bundle : Bundle, doc : Document, profiles? : ArrayView[&Profile], resolver? : &LinkResolver) -> Array[TypedReference]

    The typed references of a document: each sources[].resource, and each value of the reference fields of profiles. A profile whose definitions break a rule adds no references; validate reports it.

    validate

    fn validate(knowledge : Knowledge, rule_sets : ArrayView[RuleSet], clock : &Clock, config? : ValidationConfig, resolver? : &LinkResolver, profiles? : ArrayView[&Profile]) -> Report

    Runs the rule sets over the knowledge and returns the sorted findings. A profile whose definitions break a rule gives a profile-invalid error, and a config that names a rule that no active rule set defines gives a validation-config-unknown-rule warning.