Generators#
A LinkML generator is code that transforms a linkml schema into a datamodel expressed using another framework, or into some other artefact, such as JSON-Schema, or markdown documentation.
Generators allow you to tap into the rich tooling offered in other technical stacks. The philosophy of LinkML is to embrace and reuse these existing frameworks, rather than serve as an alternative.
Schema Frameworks#
These generators translate from a LinkML model to commonly used web standards for structuring data such as JSON-Schema, Protocol Buffers (ProtoBuf), and GraphQL.
Linked Data Standards#
Linked Data is a broad term encompassing frameworks based on RDF and URIs/IRIs. LinkML schemas, can be translated directly into RDF, or they can be mapped to OWL, or translated to shape languages such as ShEx and SHACL.
- JSON-LD Contexts
- JSON-LD
JSONLDGenerator
JSONLDGenerator.adjust_slot()
JSONLDGenerator.context
JSONLDGenerator.end_schema()
JSONLDGenerator.file_extension
JSONLDGenerator.generatorname
JSONLDGenerator.generatorversion
JSONLDGenerator.original_schema
JSONLDGenerator.requires_metamodel
JSONLDGenerator.uses_schemaloader
JSONLDGenerator.valid_formats
JSONLDGenerator.visit_class()
JSONLDGenerator.visit_slot()
JSONLDGenerator.visit_subset()
JSONLDGenerator.visit_type()
- RDF
- SPARQL
- ShEx
- SHACL
- OWL
Documentation Generation#
These generators will translate LinkML models into documentation, including UML class diagrams and markdown websites that can be easily published on static hosting sites.
- Markdown
- Docs
DIALECT
DiagramType
DocGenerator
DocGenerator.all_class_objects()
DocGenerator.all_enum_objects()
DocGenerator.all_slot_objects()
DocGenerator.all_subset_objects()
DocGenerator.all_type_object_names()
DocGenerator.all_type_objects()
DocGenerator.bullet()
DocGenerator.cardinality()
DocGenerator.class_hierarchy_as_tuples()
DocGenerator.class_induced_slots()
DocGenerator.diagram_type
DocGenerator.dialect
DocGenerator.directory
DocGenerator.example_directory
DocGenerator.example_object_blobs()
DocGenerator.example_runner
DocGenerator.gen_classvars
DocGenerator.gen_slots
DocGenerator.generatorname
DocGenerator.generatorversion
DocGenerator.genmeta
DocGenerator.get_direct_slot_names()
DocGenerator.get_direct_slots()
DocGenerator.get_indirect_slots()
DocGenerator.get_mixin_inherited_slots()
DocGenerator.get_slot_inherited_from()
DocGenerator.hierarchical_class_view
DocGenerator.include_top_level_diagram
DocGenerator.index_name
DocGenerator.inheritance_tree()
DocGenerator.inject_slot_info()
DocGenerator.latex()
DocGenerator.link()
DocGenerator.links()
DocGenerator.mermaid_diagram()
DocGenerator.mermaid_directive()
DocGenerator.name()
DocGenerator.no_types_dir
DocGenerator.number_value_range()
DocGenerator.requires_metamodel
DocGenerator.schema_title()
DocGenerator.serialize()
DocGenerator.sort_by
DocGenerator.template_directory
DocGenerator.template_mappings
DocGenerator.uri()
DocGenerator.uri_link()
DocGenerator.use_class_uris
DocGenerator.use_slot_uris
DocGenerator.uses_schemaloader
DocGenerator.valid_formats
DocGenerator.visit_all_class_slots
DocGenerator.yaml()
MarkdownDialect
customize_environment()
enshorten()
- ER Diagrams
- YUML
YumlGenerator
YumlGenerator.associations_generated
YumlGenerator.box_generated
YumlGenerator.cardinality()
YumlGenerator.class_associations()
YumlGenerator.class_box()
YumlGenerator.classes
YumlGenerator.diagram_name
YumlGenerator.directory
YumlGenerator.filtered_cls_slots()
YumlGenerator.focus_classes
YumlGenerator.gen_classes
YumlGenerator.generated
YumlGenerator.generatorname
YumlGenerator.generatorversion
YumlGenerator.load_image
YumlGenerator.output_file_name
YumlGenerator.prop_modifier()
YumlGenerator.referenced
YumlGenerator.valid_formats
YumlGenerator.visit_all_class_slots
YumlGenerator.visit_schema()
- PlantUML Diagram Generator
- Project Generator
Language Specific#
These will generate object models that are particular to specific languages such as Python, Javascript, or Java.
- Python
- Example Output
- Overview
- Code Docs
- Additional Notes
- Code generation for LinkML slots
- 1) Slot range is a LinkML
type
definition - 2) Python generation for basic python Type.
- 3) Python generation for a Type defined in
metamodelcore.py
–XSDDate
in this example - 4) Python generation for an inherited Type
- 5) Slot range is a LinkML
class
definition - 6) Non-keyed, non-identified classes
- Keyed or Identified Classes
- Python generation options for single-value (non-list) slots
- Python generation options for multivalued slots
- Input in the form of a dictionary
- Input in the form of a list
- Slots
- 1) Slot range is a LinkML
- Pydantic
- Java
- Typescript
Database#
Generators specific to database frameworks. Currently only SQL databases.