Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.json.linked_data module

Provide JSON-LD utilities.

class betty.json.linked_data.LinkedDataDumpable

  Bases: `object`

  Describe an object that can be dumped to linked data.

  async dump_linked_data(project: Project) → DumpMapping[Dump]

    Dump this instance to JSON-LD.

  async classmethod linked_data_schema(project: Project) → DumpMapping[Dump]

    Define the JSON Schema for `betty.json.linked_data.LinkedDataDumpable.dump_linked_data()`.

betty.json.linked_data.add_json_ld(schema: MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]], root_schema: MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]] | None = None) → None

  Allow JSON-LD properties to be added to a schema.

betty.json.linked_data.dump_context(dump: DumpMapping[Dump], **contexts: str | Sequence[str]) → None

  Add one or more contexts to a dump.

async betty.json.linked_data.dump_link(dump: DumpMapping[Dump], project: Project, *links: Link) → None

  Add one or more links to a dump.

betty.json.linked_data.ref_json_ld(root_schema: MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]]) → MutableMapping[str, bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]]

  Reference the JSON-LD schema.