A simple toolkit for working with LinkML schemas. This tool offers advanced schema analysis, validation, transformation, and visualization capabilities through a flexible command-line interface.
-
Schema Analysis
- Generate schema summaries.
- Detailed views of classes, slots, and types.
- Support for hierarchical and section-based analysis.
-
Schema Validation
- Rigorous validation checks with detailed error reporting.
- Optional metadata display for schemas.
-
Schema Operations
- Merge or concatenate multiple schemas.
- Subset schemas by specified classes.
-
Format Conversion
- Export schemas to JSON, RDF, GraphQL, CSV, TSV, and SQL formats.
- Customize RDF serialization formats (e.g., Turtle, XML).
- SQL export supporting PostgreSQL, MySQL, SQLite, and DuckDB dialects.
-
Visualization
- Generate interactive HTML visualizations of schemas.
- Options for inheritance, descriptions, and statistics display.
pip install linkml-toolkit# Create environment from provided configuration
conda env create -f environment-dev.yml
conda activate linkml-toolkit-dev
# For production environment only
conda env create -f environment.yml
conda activate linkml-toolkit# Clone the repository
git clone https://github.com/genomewalker/linkml-toolkit.git
cd linkml-toolkit
# Create and activate conda environment
conda env create -f environment-dev.yml
conda activate linkml-toolkit-dev
# Install in development mode
pip install -e ".[dev,test,docs]"# Generate a summary of the schema
lmtk summary --schema schema.yaml
# Detailed view for specific sections
lmtk summary --schema schema.yaml --section slots --detailed
# Export summary to JSON
lmtk summary --schema schema.yaml --output summary.json# Validate schema
lmtk validate --schema schema.yaml
# Validate with metadata display
lmtk validate --schema schema.yaml --metadata# Export to JSON Schema
lmtk export --schema schema.yaml --format json --output schema.json
# Export to RDF (Turtle format)
lmtk export --schema schema.yaml --format rdf --rdf-format turtle --output schema.ttl
# Export to SQL (PostgreSQL dialect)
lmtk export --schema schema.yaml --format sql --sql-dialect postgresql --output schema.sql# Create a subset containing specific classes
lmtk subset --schema schema.yaml --classes class1,class2 --output subset.yaml
# Exclude inherited elements
lmtk subset --schema schema.yaml --classes class1 --no-inherited --output subset.yaml# Merge schemas
lmtk combine --schema base.yaml --additional-schemas schema1.yaml -a schema2.yaml --mode merge --output merged.yaml
# Concatenate schemas
lmtk combine --schema base.yaml --additional-schemas schema1.yaml -a schema2.yaml --mode concat --output concatenated.yaml# Generate an interactive HTML visualization
lmtk visualize --schema schema.yaml --output visualization.html
# Generate full documentation bundle
lmtk visualize --schema schema.yaml --output docs/ --full-docs# Create development environment
conda env create -f environment.yml
# Update environment
conda env update -f environment.yml
# Create production environment
conda env create -f environment.prod.yml# Run all tests
pytest
# Run with coverage
pytest --cov=linkml_toolkit
# Run specific test file
pytest tests/test_core.py
# Run tests with output
pytest -v# Build documentation
cd docs
mkdocs build
# Serve documentation locally
mkdocs servelinkml-toolkit/
βββ src/
β βββ linkml_toolkit/ # Source code
βββ tests/ # Test suite
β βββ data/ # Test data
βββ docs/ # Documentation
βββ environment.yml # Development environment
βββ environment.prod.yml # Production environment
βββ pyproject.toml # Build configuration
βββ setup.cfg # Package metadata
βββ tox.ini # Test automation
We welcome contributions! Here's how you can help:
-
Fork the Repository
git clone https://github.com/genomewalker/linkml-toolkit.git cd linkml-toolkit -
Set Up Development Environment
conda env create -f environment.yml conda activate linkml-toolkit pip install -e ".[dev,test,docs]" -
Create a Branch
git checkout -b feature/your-feature-name
-
Make Changes
- Write code
- Add tests
- Update documentation
-
Verify Changes
# Run tests pytest # Run linting tox -e lint # Build docs cd docs && mkdocs build
-
Submit Pull Request
- Push changes to your fork
- Create pull request
- Wait for review
This project is licensed under the MIT License - see the LICENSE file for details.
- LinkML community for the base LinkML implementation.
- Contributors who have helped improve this toolkit.
- Issue Tracker: GitHub Issues
- Documentation: ReadTheDocs