{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://scient.ing/ns/schemas/node.schema.json", "title": "Node", "description": "One line of nodes.jsonl; spec/03-nodes.md.", "type": "object", "properties": { "id": { "$ref": "common.schema.json#/$defs/nodeId" }, "kind": { "$ref": "common.schema.json#/$defs/nodeKind" }, "parent": { "anyOf": [ { "$ref": "common.schema.json#/$defs/nodeId" }, { "type": "null" } ] }, "ord": { "type": "integer", "minimum": 0 }, "label": { "type": "string", "minLength": 1, "maxLength": 256 }, "attrs": { "type": "object", "properties": { "level": { "type": "integer", "minimum": 1 }, "columns": { "type": "array", "items": { "type": "object", "properties": { "id": { "$ref": "common.schema.json#/$defs/nodeId" }, "header_path": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/nodeId" } } }, "required": [ "id", "header_path" ], "additionalProperties": false } }, "column": { "anyOf": [ { "$ref": "common.schema.json#/$defs/nodeId" }, { "type": "null" } ] }, "rowspan": { "type": "integer", "minimum": 1 }, "colspan": { "type": "integer", "minimum": 1 }, "role": { "enum": [ "data", "column-header", "row-header", "row-group-header" ] }, "header_path": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/nodeId" } }, "ordered": { "type": "boolean" }, "marker": { "type": "string", "minLength": 1 }, "variant": { "type": "string", "minLength": 1 }, "image": { "type": "object", "properties": { "sha256": { "$ref": "common.schema.json#/$defs/hash" }, "media_type": { "type": "string", "minLength": 1 }, "native": { "type": "boolean" }, "dpi": { "type": "integer", "minimum": 1 } }, "required": [ "sha256", "media_type", "native" ], "additionalProperties": false }, "crop": { "type": "object", "properties": { "sha256": { "$ref": "common.schema.json#/$defs/hash" }, "media_type": { "type": "string", "minLength": 1 }, "dpi": { "type": "integer", "minimum": 1 } }, "required": [ "sha256", "media_type", "dpi" ], "additionalProperties": false }, "figure_text": { "type": "array", "items": { "type": "object", "properties": { "id": { "$ref": "common.schema.json#/$defs/nodeId" }, "text": { "type": "string", "minLength": 1 }, "role": { "enum": [ "axis-label", "tick-label", "legend", "annotation", "other" ] }, "page_fp": { "$ref": "common.schema.json#/$defs/hash" }, "boxes": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/box" }, "minItems": 1 } }, "required": [ "id", "text", "role" ], "additionalProperties": false } } }, "required": [], "additionalProperties": false, "minProperties": 1 }, "content": {}, "withheld": { "const": true }, "fidelity": { "$ref": "common.schema.json#/$defs/level" }, "prov": { "type": "object", "properties": { "witnesses": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/nodeId" }, "minItems": 1, "uniqueItems": true }, "backend": { "type": "string", "minLength": 1 }, "reading": { "type": "string", "minLength": 1 }, "corroborated_by": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/nodeId" }, "uniqueItems": true } }, "required": [], "additionalProperties": false }, "text_hash": { "$ref": "common.schema.json#/$defs/hash" }, "match_hash": { "$ref": "common.schema.json#/$defs/hash" }, "align_key": { "$ref": "common.schema.json#/$defs/hash" }, "own_hash": { "$ref": "common.schema.json#/$defs/hash" }, "node_hash": { "$ref": "common.schema.json#/$defs/hash" } }, "required": [ "id", "kind", "parent", "ord", "text_hash", "match_hash", "align_key", "own_hash", "node_hash" ], "additionalProperties": false, "allOf": [ { "if": { "properties": { "kind": { "enum": [ "sentence", "cell", "reference", "authors", "keywords" ] } } }, "then": { "anyOf": [ { "required": [ "withheld" ] }, { "required": [ "content" ], "properties": { "content": { "$ref": "runs.schema.json" } } } ] } }, { "if": { "properties": { "kind": { "enum": [ "equation", "equation-line" ] } } }, "then": { "anyOf": [ { "required": [ "withheld" ] }, { "required": [ "content" ], "properties": { "content": { "type": "object", "properties": { "notation": { "enum": [ "tex", "typst" ] }, "source": { "type": "string", "minLength": 1 } }, "required": [ "notation", "source" ], "additionalProperties": false } } } ] } }, { "if": { "properties": { "kind": { "enum": [ "code", "algorithm" ] } } }, "then": { "anyOf": [ { "required": [ "withheld" ] }, { "required": [ "content" ], "properties": { "content": { "type": "object", "properties": { "language": { "type": "string", "minLength": 1 }, "text": { "type": "string" } }, "required": [ "text" ], "additionalProperties": false } } } ] } }, { "if": { "properties": { "kind": { "not": { "enum": [ "sentence", "cell", "reference", "authors", "keywords", "equation", "equation-line", "code", "algorithm" ] } } } }, "then": { "not": { "anyOf": [ { "required": [ "content" ] }, { "required": [ "withheld" ] }, { "required": [ "fidelity" ] } ] } } }, { "if": { "properties": { "kind": { "not": { "enum": [ "section", "figure", "panel", "table", "theorem", "footnote", "equation", "equation-line", "reference", "code", "algorithm" ] } } } }, "then": { "not": { "required": [ "label" ] } } }, { "if": { "properties": { "kind": { "const": "section" } } }, "then": { "required": [ "attrs" ], "properties": { "attrs": { "required": [ "level" ] } } } }, { "if": { "properties": { "kind": { "not": { "enum": [ "section", "table", "cell", "row", "list", "item", "theorem", "panel" ] } } } }, "then": { "not": { "required": [ "attrs" ] } } }, { "if": { "properties": { "kind": { "const": "section" } } }, "then": { "properties": { "attrs": { "propertyNames": { "enum": [ "level" ] } } } } }, { "if": { "properties": { "kind": { "const": "table" } } }, "then": { "properties": { "attrs": { "propertyNames": { "enum": [ "columns" ] } } } } }, { "if": { "properties": { "kind": { "const": "cell" } } }, "then": { "properties": { "attrs": { "propertyNames": { "enum": [ "column", "rowspan", "colspan", "role" ] } } } } }, { "if": { "properties": { "kind": { "const": "row" } } }, "then": { "properties": { "attrs": { "propertyNames": { "enum": [ "header_path" ] } } } } }, { "if": { "properties": { "kind": { "const": "list" } } }, "then": { "properties": { "attrs": { "propertyNames": { "enum": [ "ordered" ] } } } } }, { "if": { "properties": { "kind": { "const": "item" } } }, "then": { "properties": { "attrs": { "propertyNames": { "enum": [ "marker" ] } } } } }, { "if": { "properties": { "kind": { "const": "theorem" } } }, "then": { "properties": { "attrs": { "propertyNames": { "enum": [ "variant" ] } } } } }, { "if": { "properties": { "kind": { "const": "panel" } } }, "then": { "properties": { "attrs": { "propertyNames": { "enum": [ "image", "crop", "figure_text" ] } } } } } ] }