linkml / linkml-project-template

A template for LinkML projects using poetry and gen-project
MIT License
9 stars 2 forks source link
linkml linkml-model-template

THIS REPOSITORY IS ARCHIVED

For creating new projects, you should use this:

https://github.com/linkml/linkml-project-cookiecutter

LinkML Project Template

A template for LinkML projects

NOTE: You don't need to use this repository directly as a GitHub template!

Instead:

Example:

mkdir ~/my-projects
cd ~/my-projects
pip install linkml
linkml-ws new my-project-name
cd my-project-name
# edit src/linkml/my-project-name
make setup

Type make to see a full list of options.

Then you will be encouraged to run

cd my-project-name
make setup

This will give you a fully functional LinkML repository with artifact generation via github actions based on the example "Person" schema that comes with this template. The next steps are to replace the example yaml files in src/linkml with your own model files.

Sometimes you may wish to divide your model into modules in individual yaml files. Or, you may be starting a project using linkml-ws with an existing set of schema yaml files from an autogenerated schema. This may mean that you have more thank one .yaml file in your_project/src/linkml/schema directory. However, in order for the project generation scrips to work, you must provide one yaml "root" file as the starting point to generate your schema. In order to make this work, you must declare a "root" schema.yaml file that imports your submodules.

For example, if my schema is divided into domains like this:

my_project/src/linkml/my_schema_domain_1.yaml
my_project/src/linkml/my_schema_domain_2.yaml
my_project/src/linkml/my_schema_domain_3.yaml

adding a simple:

myschema.yaml 

with the contents:

- id: myschema
- name: myschema
imports:  
- linkml:types
- my_schema_domain_1
- my_schema_domain_2
- my_schema_domain_3

and setting your schema file to myschema.yaml in the about.yaml, linkml-ws will find and properly iterate through all three domains of your model generating the artifacts as you have indicated in your gen-project makefile target.

How to author a schema

There are several ways to author a LinkML model.

Getting it into GitHub

Alternative protocol

You can also simply clone this repo and use it as a template, modifying files as you need - however, this is no longer the recommended path