betty.json.linked_data module

Provide JSON-LD utilities.

class betty.json.linked_data.LinkedDataDumpable[source]

Bases: object

async dump_linked_data(app)[source]

Dump this instance to JSON-LD.

Parameters:
app

Return type:

dict[str, typing.Union[bool, int, float, str, None, typing.Sequence[typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], typing.Mapping[str, typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]]]]

async classmethod linked_data_schema(app)[source]

Define the JSON Schema for self.dump_linked_data().

Parameters:
app

Return type:

dict[str, typing.Union[bool, int, float, str, None, typing.Sequence[typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], typing.Mapping[str, typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]]]]

betty.json.linked_data.add_json_ld(schema, root_schema=None)[source]

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

Parameters:
schema

root_schema=None

Return type:

None

betty.json.linked_data.dump_context(dump, **contexts)[source]

Add one or more contexts to a dump.

Parameters:
dump

**contexts

Return type:

None

Add one or more links to a dump.

dump

app

None

betty.json.linked_data.ref_json_ld(root_schema)[source]

Reference the JSON-LD schema.

Parameters:
root_schema

Return type:

dict[str, typing.Union[bool, int, float, str, None, typing.Sequence[typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], typing.Mapping[str, typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]]]]