LinkML in Ten Minutes

Vlad Korolev

Boston Python Meetup — October 2026

  • My name is Zelda
  • My name is Zelda
  • I am a developer
  • My name is Zelda
  • I am a developer
  • I like Pokémon
Pokémon is a trademark of Nintendo. Used here for illustration only.
  • My name is Zelda
  • I am a developer
  • I like Pokémon
  • I need an app to keep track of Species, Moves and Abilities
Pokémon is a trademark of Nintendo. Used here for illustration only.
  • I need two things
  • I need two things
  • Data model
  • I need two things
  • Data model
  • Keep it simple

Django model = the schema. One owner.

  • SQL tables — Django
  • Python model — Django
  • Frontend forms — Django
class Habitat(models.Model):
    name = models.CharField(max_length=100)

class Ability(models.Model):
    name = models.CharField(max_length=100)

class Move(models.Model):
    name = models.CharField(max_length=100)

class Species(models.Model):
    name = models.CharField(max_length=200)
    weight_kg = models.FloatField()
    habitat = models.ForeignKey(Habitat, on_delete=models.CASCADE)
    abilities = models.ManyToManyField(Ability)
    moves = models.ManyToManyField(Move)

The app takes off

New architecture

React
Frontend
Pydantic
Backend
Postgres
Database

New architecture

React
Frontend
Pydantic
Backend
Postgres
Database
New architecture, new challenges.

The UI is what users touch. The type is ours to define.

interface Species {
  id: number;
  name: string;
  weightKg: number;
  habitat: Habitat;
  moves: Move[];
}

Nothing is valid until Pydantic says so.

class Species(BaseModel):
    id: int
    name: str
    weight_kg: float
    habitat: Habitat
    moves: list[Move]

If it's not normalized in the database, it isn't real.

CREATE TABLE species (
  id INT PRIMARY KEY,
  name TEXT,
  weight REAL,
  habitat_id INT REFERENCES habitat(id)
);

Everybody's model is the right one

The loudest team wins.

Because if it's not normalized in the database, it isn't real.

The loudest team wins.

Or because nothing is valid until Pydantic says so.

The loudest team wins.

Or because the UI is what users touch.

Things grow

New architecture, take two

React
web app
Frontend
Android
lab floor tablets
Control panels
gQL
REST
Pydantic
Backend
SQL
RPC
Postgres
Database
Wet lab
LIMSSequencerProcess control
Lab

New architecture, take two

React
web app
Frontend
Android
lab floor tablets
Control panels
gQL
REST
Pydantic
Backend
SQL
RPC
Postgres
Database
Wet lab
LIMSSequencerProcess control
Lab

Challenges increase

Mobile ships its own Species class. Android doesn't wait for anyone.

class Species {
  String name;
  float weightKg;
}

The API is the contract. Every partner integrates against our schema.

Species:
  type: object
  properties:
    name: {type: string}
    weightKg: {type: number}

Bytes on the wire are the only truth. Protobuf is the real model.

message Species {
  string name = 1;
  float weight_kg = 2;
}

Schemas change

Height isn't one number anymore. It's a range, and it needs units.

Real example

A LinkML schema, in three moves

classes:
  Species:
  Color:
  Height:
  Type:
  • Classes

A LinkML schema, in three moves

classes:
  Species:
  Color:
  Height:
  Type:

slots:
  name:
    range: string
  hasColor:
    range: Color
  hasHeight:
    range: Quantity
  hasType:
    range: Type
  • Classes
  • Slots

A LinkML schema, in three moves

classes:
  Species:
    slots:
      - name
      - hasColor
      - hasHeight
      - hasType
  Color:
  Height:
  Type:

slots:
  name:
    range: string
  hasColor:
    range: Color
  hasHeight:
    range: Quantity
  hasType:
    range: Type
  • Classes
  • Slots
  • Classes use slots

Species, as a dataclass

classes:
  Species:
    is_a: NamedIndividual
    slots:
      - name
      - hasColor
      - hasHeight
      - hasType

slots:
  name:
    range: string
  hasColor:
    range: Color
  hasHeight:
    range: Quantity
    inlined: true
  hasType:
    range: Type
    multivalued: true
@dataclass
class Species(NamedIndividual):
    class_class_uri: ClassVar[URIRef] = \
        PKMN.Species
    class_name: ClassVar[str] = "Species"

    name: Optional[str] = None
    hasColor: Optional[Union[str, ColorId]] \
        = None
    hasHeight: Optional[Union[dict,
        Quantity]] = None
    hasType: Optional[Union[Union[str,
        TypeId], List[...]]] = empty_list()

Species, as Pydantic

classes:
  Species:
    is_a: NamedIndividual
    slots:
      - name
      - hasColor
      - hasHeight
      - hasType

slots:
  name:
    range: string
  hasColor:
    range: Color
  hasHeight:
    range: Quantity
    inlined: true
  hasType:
    range: Type
    multivalued: true
class Species(NamedIndividual):
    linkml_meta: ClassVar[LinkMLMeta] = \
        LinkMLMeta({"from_schema": "pokemon"})

    name: Optional[str] = Field(
        default=None,
        json_schema_extra={"linkml_meta":
            {"alias": "name"}})
    hasColor: Optional[Color] = \
        Field(default=None)
    hasHeight: Optional[Quantity] = \
        Field(default=None)
    hasType: Optional[list[Type]] = \
        Field(default_factory=list)

Species, as SQL

classes:
  Species:
    is_a: NamedIndividual
    slots:
      - name
      - hasColor
      - hasHeight
      - hasType

slots:
  name:
    range: string
  hasColor:
    range: Color
  hasHeight:
    range: Quantity
    inlined: true
  hasType:
    range: Type
    multivalued: true
CREATE TABLE "Species" (
  "hasColour" TEXT,
  "hasShape" TEXT,
  "hasGenus" TEXT,
  "hasCatchRate" INTEGER,
  id TEXT NOT NULL,
  name TEXT NOT NULL,
  "hasHeight_id" TEXT,
  "hasWeight_id" TEXT,
  PRIMARY KEY (id),
  FOREIGN KEY("hasHeight_id")
    REFERENCES "Quantity" (id),
  FOREIGN KEY("hasWeight_id")
    REFERENCES "Quantity" (id)
);

Species, as Protobuf

classes:
  Species:
    is_a: NamedIndividual
    slots:
      - name
      - hasColor
      - hasHeight
      - hasType

slots:
  name:
    range: string
  hasColor:
    range: Color
  hasHeight:
    range: Quantity
    inlined: true
  hasType:
    range: Type
    multivalued: true
message Species {
  uri id = 0;
  string name = 0;
  colour hasColour = 0;
  quantity hasHeight = 0;
  quantity hasWeight = 0;
  repeated type hasType = 0;
  repeated ability
    mayHaveAbility = 0;
}

Species, as TypeScript

classes:
  Species:
    is_a: NamedIndividual
    slots:
      - name
      - hasColor
      - hasHeight
      - hasType

slots:
  name:
    range: string
  hasColor:
    range: Color
  hasHeight:
    range: Quantity
    inlined: true
  hasType:
    range: Type
    multivalued: true
export interface Species
    extends NamedIndividual {
  /** A Pokémon has a color */
  hasColor?: Color,
  /** How tall a species is, as a
   * quantity with unit. */
  hasHeight?: Quantity,
  /** How heavy a species is, as a
   * quantity with unit. */
  hasWeight?: Quantity,
  hasType?: Type[],
}

Not covered today

  • Validators
  • Loaders
  • Schema Automator
  • Data Harmonizer
  • ...and a lot more

Origin

  • Started by Harold Solbrig, Johns Hopkins University
  • First released in 2021
  • Apache-2.0 licensed
  • Lead maintainer: Sierra Moxon, Lawrence Berkeley National Laboratory (BBOP)
  • Backed by Berkeley Lab's BBOP group — Jackson Laboratory, EMBL-EBI, and others

The LinkML community

⌥ 4,889
commits
★ 646
stars
⬢ 167
releases
☺ 126
contributors

Large LinkML Projects

â–£classesâ—†slots + attrs
MIxS Genomic and environmental metadata â–£347â—†1,178 GSC/mixs
BioLink Model Biomedical knowledge graphs â–£336â—†583 biolink/biolink-model
NMDC National microbiome data â–£89â—†901 microbiomedata/nmdc-schema
INCLUDE Down syndrome research hub â–£65â—†69 include-dcc/include-linkml
BICAN Brain cell atlas models â–£114â—†259 brain-bican/models

Please join

How to help

  • Good first issues
  • Write a generator for a target nobody has covered yet
  • Try it on your own data, then tell the project what broke

Where to find everyone

Demo

Keep exploring

?????

This deck
Demo schema
Get involved

Thank You

This deck
Demo schema
Get involved

Slide 1 Intro myself say pres about LinkML very quick

Slide 2 This is Zelda. She is a developer. She lives in Boston. And she likes Pokemons She needs to make an app to track Species Moves and Abilities

Slide 4

Slide 7 To get started we need a data model and we should keep things very simple.

Slide 8

Slide 9

Slide 10 Django app, one model file, takes care of db backend and frontend

Slide 11 Things take off. Lots of fans, recognition and a bag of money

Slide 12 But now cost of fame. Bugs, Features, Infrastructure She needs more people And she gets a team

Slide 13

Slide 14

Slide 15 The team comes with new architecture New arch new challenges

Slide 16

Slide 17 Many devs. Many opinions

Slide 18 And of course my model is the right one

Slide 19 Loudest team usually wins. Everybody has to deal with it. For small teams usually works.

Slide 20

Slide 21

Slide 22 Things grow. More users. More resources. Pivot to Biotech. Synthetic biology team We can now grow real pokemons But we need more people

Slide 23

Slide 24

Slide 26 More people more opinions. And that's when things start getting out of control

Slide 27

Slide 28

Slide 29

Slide 30

Slide 31

Slide 32

Slide 33 And now we out of control what do we do?

Slide 34 And that's when the linkml comes in

Slide 35 We can create one schema file and generate code from it for everybody

Slide 36

Slide 37

Slide 38 Make a model. Start with classes. Add slots and assign slots to classes

Slide 39

Slide 40

Slide 41 And now we can generate code for everybody

Slide 42

Slide 43

Slide 44

Slide 45

Slide 47

Slide 46 Real pokemon species model Pokemon schema/ontology practice KG Not a toy one, but not a giant

Slide 48

Slide 49 Where it came from and who keeps it running, in one beat. The community slide carries the headline counts.

Slide 50

Slide 51

Slide 52 Join us, this is not an overwhelming project. But you'll learn a lot when try to collaborate with 100+ developers. We are very accepting bunch. If you are grad student there are some interesting research problems that could come up

Slide 53

Slide 54

Slide 55

Slide 56

Slide 57