Skip to content

p2p-ld/linkml-core

Repository files navigation

linkml-core

core linkml schema operations written in rust :)

Crates

  • linkml_meta (src/metamodel): Autogenerated LinkML metamodel types and helpers. Optional Serde/PyO3 features for serialization and Python interop.
  • schemaview (src/schemaview): Schema loading, CURIE/URI conversion, resolution (feature-gated), and view utilities: SchemaView, ClassView, SlotView, EnumView.
  • linkml_runtime (src/runtime): Core runtime: LinkMLValue parsing (YAML/JSON), basic validation, diff/patch, and Turtle serialization. Pure Rust library.
  • linkml_tools (src/tools): CLI tools wrapping the runtime and schemaview:
    • linkml-validate, linkml-convert, linkml-diff, linkml-patch, linkml-schema-validate.
  • linkml_runtime_python (src/python): PyO3 bindings and Python package (linkml_runtime_rust._native) exposing SchemaView and LinkMLValue to Python; includes small Python helpers.
  • linkml_wasm (src/wasm): WASM build target (experimental).

Regenerating the metamodel

In order to regenerate the metamodel:

  • Make sure you have a python virtual env with linkml_runtime (python!) installed, and that its active
  • In the ../linkml folder there should be a linkml checkout that is on a branch with the rust generator
  • run the regen.sh script from the root of this repo

Note that now the metamodel is generated from src/schemaview/tests/data/meta.yaml.

TODOs

  • generate the metamodel directly from the linkml meta repository

Development on the Python bindings

  1. Create a virtual env and activate it
  2. Install maturin (pip install maturin)
  3. From repo root, run: maturin develop -m src/python/Cargo.toml (or use your venv: ../env/bin/maturin develop -m src/python/Cargo.toml)

Now the linkml_runtime_rust module should be accessible.

Building and testing

  • Build all crates: cargo build --workspace
  • Run all tests: cargo test --workspace
  • Format: cargo fmt --all (check: cargo fmt --all -- --check)
  • Lint: cargo clippy --workspace --all-targets --all-features --exclude linkml_meta -- -D warnings --no-deps (excludes autogenerated linkml_meta)

About

core linkml schema operations written in rust :)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages