feat: scienting-math/1 sources and derived/math.jsonl; lode references; stress fixes
Math content may say its source is in scienting-math/1's canonical TeX (form, in no hash); derived/math.jsonl holds papermath's tree, symbols and issues, and the validator now checks derived files. A symbol annotation names its symbol by key; lode claim references use lode's tag and pin syntax. The zip reader refuses entries zipfile cannot read, and checkpoint lines end in LF only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017R7sgDNvUGWY2zFPCq2JH6
This commit is contained in:
40 files changed
+750
-63
No files matched your search
+4
-3
@@ -1,6 +1,6 @@
|
||||
# Schemas
|
||||
|
||||
This folder holds the JSON (JavaScript Object Notation) Schemas (draft 2020-12) for every file and record that the paperspec formats (paperspec is the specification this repository holds) define: 42 schema files.
|
||||
This folder holds the JSON (JavaScript Object Notation) Schemas (draft 2020-12) for every file and record that the paperspec formats (paperspec is the specification this repository holds) define: 43 schema files.
|
||||
A JSON Schema is a file, itself written in JSON, that states what a valid JSON file looks like.
|
||||
Newcomers can read it as a form: it lists the fields a record must have and what kind of value each field takes.
|
||||
Implementers will find the loading recipe and the traps under "Validating" and "Writing schemas".
|
||||
@@ -20,7 +20,7 @@ The number after each name is the chapter of `spec/` that defines the file.
|
||||
| Topic | Schemas (chapter) |
|
||||
| --- | --- |
|
||||
| Shared definitions | `common.schema.json` (1): hashes, IDs, keys, addresses, times, decimals, boxes, licenses, signatures, evidence, quotes. |
|
||||
| A package | `manifest.schema.json` (12), `document.schema.json` (2, 12), `node.schema.json` (3), `runs.schema.json` (3), `witnesses.schema.json` (2), `provenance.schema.json` (12), `page.schema.json` (7), `location.schema.json` (7), `reference.schema.json` (10), `id-entry.schema.json` (4), `correction.schema.json` (11), `receipt.schema.json` (8), `revocation.schema.json` (8), `roster.schema.json` (8), `suspect.schema.json` (5), `mathml.schema.json` (12) |
|
||||
| A package | `manifest.schema.json` (12), `document.schema.json` (2, 12), `node.schema.json` (3), `runs.schema.json` (3), `witnesses.schema.json` (2), `provenance.schema.json` (12), `page.schema.json` (7), `location.schema.json` (7), `reference.schema.json` (10), `id-entry.schema.json` (4), `correction.schema.json` (11), `receipt.schema.json` (8), `revocation.schema.json` (8), `roster.schema.json` (8), `suspect.schema.json` (5), `mathml.schema.json` (12), `math.schema.json` (9, 12) |
|
||||
| Pointing into documents | `anchor.schema.json` (6) |
|
||||
| Rights | `rights.schema.json` (14), `policy.schema.json` (14), `stages.schema.json` (14), `backend.schema.json` (14), `profile.schema.json` (14), `stamps.schema.json` (7) |
|
||||
| Review | `qa-report.schema.json` (8), `spot-check.schema.json` (8), `checklist.schema.json` (8), `proof.schema.json` (8, 11) |
|
||||
@@ -37,7 +37,8 @@ The Data schemas for datasets, digitizations and views, the Teams and drafts sch
|
||||
The rest belong to `candidate` formats or to no format of their own.
|
||||
|
||||
The bundle has no JSON Schema: its registry entry points to `sql/bundle-sqlite.sql`.
|
||||
Of the 42 schemas, 11 have no format of their own because each describes a line or part of a larger file: `common`, `node`, `runs`, `witnesses`, `provenance`, `location`, `reference`, `id-entry`, `mathml`, `annotation` and `value-anchor`.
|
||||
Of the 43 schemas, 12 have no format of their own because each describes a line or part of a larger file: `common`, `node`, `runs`, `witnesses`, `provenance`, `location`, `reference`, `id-entry`, `mathml`, `math`, `annotation` and `value-anchor`.
|
||||
A line of `derived/math.jsonl` carries `form`, the math form `scienting-math/1` it reads the formula in; that names a spelling of TeX, which papermath implements ([spec/09 §9.4](../spec/09-figures-tables-equations.md#94-the-math-form)), not a file format, so the registry does not list it.
|
||||
Of the schemas that do have one, 27 require a `format` property; `spot-check.schema.json` describes the input a VRF proof is made over rather than a file.
|
||||
The others (`page`, `draft-ids`, `view` and `log-entry`) describe a line of a file, a Vega-Lite specification (a JSON description of a chart) or an item of a tree, and the record itself does not need to carry the identifier.
|
||||
|
||||
|
||||
@@ -111,15 +111,13 @@
|
||||
"const": "SpecificResource"
|
||||
},
|
||||
"source": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
"$ref": "common.schema.json#/$defs/claimRef"
|
||||
},
|
||||
"kind": {
|
||||
"const": "claim-link"
|
||||
},
|
||||
"pin": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
"$ref": "common.schema.json#/$defs/claimPin"
|
||||
},
|
||||
"role": {
|
||||
"enum": [
|
||||
@@ -144,17 +142,21 @@
|
||||
"const": "SpecificResource"
|
||||
},
|
||||
"source": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
"$ref": "common.schema.json#/$defs/claimRef"
|
||||
},
|
||||
"kind": {
|
||||
"const": "symbol"
|
||||
},
|
||||
"pin": {
|
||||
"$ref": "common.schema.json#/$defs/claimPin"
|
||||
},
|
||||
"key": {
|
||||
"description": "The symbol's scienting-math/1 key, which the symbol claim's notation has too (spec/09 §9.4, spec/18 §18.4).",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"symbol": {
|
||||
"description": "The symbol as the span writes it.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
@@ -162,7 +164,8 @@
|
||||
"required": [
|
||||
"type",
|
||||
"kind",
|
||||
"source"
|
||||
"source",
|
||||
"key"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
|
||||
@@ -71,6 +71,22 @@
|
||||
"type": "string",
|
||||
"pattern": "^([a-z0-9][a-z0-9._-]*/)?[a-z][a-z0-9]*-[0-9a-hjkmnp-tv-z]{4,51}(\\.[a-z0-9][a-z0-9-]*)*#[a-z0-9][a-z0-9._-]*(@[0-9a-f]{6})?(\\[(0|[1-9][0-9]*):(0|[1-9][0-9]*)\\])?$"
|
||||
},
|
||||
"claimRef": {
|
||||
"type": "string",
|
||||
"pattern": "^lode:([a-z0-9.-]+\\.[a-z]{2,}/)?[0-9A-HJKMNP-TV-Z]{8}$",
|
||||
"description": "A claim in a lode store: lode:TAG, or lode:host/TAG for another store, TAG eight Crockford base32 capitals (spec/18 §18.4)."
|
||||
},
|
||||
"claimPin": {
|
||||
"type": "string",
|
||||
"pattern": "^lode:([a-z0-9.-]+\\.[a-z]{2,}/)?[0-9A-HJKMNP-TV-Z]{8}@[0-9a-f]{6}$",
|
||||
"description": "A claim pinned to its statement: the claim's reference, @ and the first six hex digits of its statement hash (spec/18 §18.4)."
|
||||
},
|
||||
"mathForm": {
|
||||
"enum": [
|
||||
"scienting-math/1"
|
||||
],
|
||||
"description": "The form a math source is spelled in; scienting-math/1 is canonical TeX (spec/03 §3.7, spec/09 §9.4)."
|
||||
},
|
||||
"time": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-6][0-9]Z$"
|
||||
|
||||
@@ -47,8 +47,15 @@
|
||||
"same_as": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": "^(doi|arxiv|isbn|pmid|pmcid|openalex|url|lode):[^ ]+$"
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^(doi|arxiv|isbn|pmid|pmcid|openalex|url):[^ ]+$"
|
||||
},
|
||||
{
|
||||
"$ref": "common.schema.json#/$defs/claimRef"
|
||||
}
|
||||
]
|
||||
},
|
||||
"uniqueItems": true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://paperspec.scient.ing/schemas/math.schema.json",
|
||||
"title": "Derived math",
|
||||
"description": "One line of derived/math.jsonl: a formula of the package read in the form scienting-math/1 by a pinned tool, its tree, symbol keys and issues; never authoritative; spec/09-figures-tables-equations.md §9.4, spec/12-package.md §12.7.",
|
||||
"$defs": {
|
||||
"kind": {
|
||||
"description": "What a tree node is. The kinds of scienting-math/1 are num, sym, text, const, oper, dots, empty, add, neg, pm, mp, mul, times, div, op, frac, binom, sqrt, root, pow, sub, prime, fact, apply, lim, sum, prod, coprod, int, iint, iiint, oint, bigcup, bigcap, abs, norm, angle, floor, ceil, braces, interval, rel, list, lines, cases, matrix and opaque (spec/09 §9.4). The schema takes any lowercase name, so that a later minor version of the form may add a kind; a consumer that meets a kind it does not know treats that node as it treats opaque.",
|
||||
"type": "string",
|
||||
"pattern": "^[a-z][a-z0-9-]*$",
|
||||
"examples": [
|
||||
"sym",
|
||||
"frac",
|
||||
"rel",
|
||||
"opaque"
|
||||
]
|
||||
},
|
||||
"node": {
|
||||
"description": "A tree node: an array whose first item is its kind and whose other items are its parts.",
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"prefixItems": [
|
||||
{
|
||||
"$ref": "#/$defs/kind"
|
||||
}
|
||||
],
|
||||
"items": {
|
||||
"$ref": "#/$defs/part"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"description": "Parts that are not a node: a case's value and condition, or a matrix's rows and cells. Its first item, when it has one, is a node, a group or null, never a string, so it is never mistaken for a node.",
|
||||
"type": "array",
|
||||
"prefixItems": [
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"items": {
|
||||
"$ref": "#/$defs/part"
|
||||
}
|
||||
},
|
||||
"part": {
|
||||
"description": "A part of a node: a string (digits, a symbol key, words, a command, a relation such as =), null (a script or condition that is absent), a node, or a group.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/node"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/group"
|
||||
}
|
||||
]
|
||||
},
|
||||
"issue": {
|
||||
"description": "Something a reader of the formula should look at; the formula is read all the same.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "unbalanced, unknown-command, label-or-power, script-on-group, opaque or infix-fraction in scienting-math/1 (spec/09 §9.4); a later minor version may add a code.",
|
||||
"type": "string",
|
||||
"pattern": "^[a-z][a-z0-9-]*$"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"at": {
|
||||
"description": "The TeX the issue is about, in canonical form; empty when it is about the whole formula.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"code",
|
||||
"message",
|
||||
"at"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"node": {
|
||||
"$ref": "common.schema.json#/$defs/nodeId"
|
||||
},
|
||||
"run": {
|
||||
"description": "The index of the math run in the node's runs, or null for an equation or equation-line node, as in derived/mathml.jsonl.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tool": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"version"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"form": {
|
||||
"enum": [
|
||||
"scienting-math/1"
|
||||
]
|
||||
},
|
||||
"tree": {
|
||||
"$ref": "#/$defs/node"
|
||||
},
|
||||
"symbols": {
|
||||
"description": "The key of every symbol in the tree, each once, in the order the formula first writes it.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"uniqueItems": true
|
||||
},
|
||||
"complete": {
|
||||
"description": "True exactly when the tree has no opaque node.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"issues": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/issue"
|
||||
}
|
||||
},
|
||||
"label": {
|
||||
"description": "The printed number the tool lifted out of a \\tag in the source; omitted when the source has none.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"node",
|
||||
"run",
|
||||
"tool",
|
||||
"form",
|
||||
"tree",
|
||||
"symbols",
|
||||
"complete",
|
||||
"issues"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
@@ -329,13 +329,28 @@
|
||||
"source": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"form": {
|
||||
"$ref": "common.schema.json#/$defs/mathForm"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"notation",
|
||||
"source"
|
||||
],
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"if": {
|
||||
"required": [
|
||||
"form"
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"notation": {
|
||||
"const": "tex"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,21 @@
|
||||
"type",
|
||||
"ref"
|
||||
],
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"if": {
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "claim"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"ref": {
|
||||
"$ref": "common.schema.json#/$defs/claimRef"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"minItems": 1
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@
|
||||
"source": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"form": {
|
||||
"$ref": "common.schema.json#/$defs/mathForm"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -71,7 +74,19 @@
|
||||
"notation",
|
||||
"source"
|
||||
],
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"if": {
|
||||
"required": [
|
||||
"form"
|
||||
]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"notation": {
|
||||
"const": "tex"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
|
||||
Reference in new issue
Block a user