Generate JSONld

class linkml.generators.jsonldgen.JSONLDGenerator(schema: str | ~typing.TextIO | ~linkml_runtime.linkml_model.meta.SchemaDefinition | ~linkml.utils.generator.Generator | ~pathlib.Path, schemaview: ~linkml_runtime.utils.schemaview.SchemaView | None = None, format: str | None = None, metadata: bool = True, useuris: bool | None = None, log_level: int | None = 30, mergeimports: bool | None = True, source_file_date: str | None = None, source_file_size: int | None = None, logger: ~logging.Logger | None = None, verbose: bool | None = None, output: str | None = None, namespaces: ~linkml_runtime.utils.namespaces.Namespaces | None = None, directory_output: bool = False, base_dir: str | None = None, metamodel_name_map: ~typing.Dict[str, str] | None = None, importmap: str | ~typing.Mapping[str, str] | None = None, emit_prefixes: ~typing.Set[str] = <factory>, metamodel: ~linkml.utils.schemaloader.SchemaLoader | None = None, stacktrace: bool = False, include: str | ~pathlib.Path | ~linkml_runtime.linkml_model.meta.SchemaDefinition | None = None, original_schema: ~linkml_runtime.linkml_model.meta.SchemaDefinition | None = None, context: str | None = None, **_kwargs)[source]#

Generates JSON-LD from a Schema

Status: incompletely implemented

Note: this is distinct from ContextGenerator, which generates a JSON-LD context

adjust_slot(slot: SlotDefinition) None[source]#
context: str = None#

Path to a JSONLD context file

end_schema(context: str | None = None, **_) str[source]#

Visited once at the end of generation

@param kwargs: Arguments passed through from CLI – implementation dependent

file_extension: ClassVar[str] = 'jsonld'#
generatorname: ClassVar[str] = 'jsonldgen.py'#

Name of the generator. Override with os.path.basename(__file__)

generatorversion: ClassVar[str] = '0.0.2'#

Version of the generator. Consider deprecating and instead use overall linkml version

original_schema: SchemaDefinition = None#



See https

requires_metamodel: ClassVar[bool] = True#

Generator queries an instance of the metamodel

uses_schemaloader: ClassVar[bool] = True#

Old-style generator that uses the SchemaLoader and visitor pattern

valid_formats: ClassVar[List[str]] = ['jsonld', 'json']#

Allowed formats - first format is default

visit_class(cls: ClassDefinition) bool[source]#

Visited once per schema class

@param cls: class being visited @return: Visit slots and end class. False means skip and go on

visit_slot(aliased_slot_name: str, slot: SlotDefinition) None[source]#

Visited once for every slot definition in the schema.

@param aliased_slot_name: Aliased name of the slot. May not be unique @param slot: visited slot

visit_subset(ss: SubsetDefinition) None[source]#

Visited once for every subset definition in the schema

#param subset: Subset definition

visit_type(typ: TypeDefinition) None[source]#

Visited once for every type definition in the schema

@param typ: Type definition