linkml-toolkit 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- linkml_toolkit-0.1.0/.coveragerc +12 -0
- linkml_toolkit-0.1.0/.gitignore +36 -0
- linkml_toolkit-0.1.0/LICENSE +21 -0
- linkml_toolkit-0.1.0/MANIFEST.in +6 -0
- linkml_toolkit-0.1.0/PKG-INFO +290 -0
- linkml_toolkit-0.1.0/README.md +246 -0
- linkml_toolkit-0.1.0/docs/api/cli.md +12 -0
- linkml_toolkit-0.1.0/docs/api/core.md +10 -0
- linkml_toolkit-0.1.0/docs/api/export.md +10 -0
- linkml_toolkit-0.1.0/docs/api/validation.md +10 -0
- linkml_toolkit-0.1.0/docs/contributing.md +69 -0
- linkml_toolkit-0.1.0/docs/index.md +71 -0
- linkml_toolkit-0.1.0/docs/usage/getting-started.md +26 -0
- linkml_toolkit-0.1.0/docs/usage/summary.md +116 -0
- linkml_toolkit-0.1.0/environment-dev.yml +31 -0
- linkml_toolkit-0.1.0/environment.yml +15 -0
- linkml_toolkit-0.1.0/mkdocs.yml +62 -0
- linkml_toolkit-0.1.0/pyproject.toml +21 -0
- linkml_toolkit-0.1.0/setup.cfg +61 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/__init__.py +19 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/_version.py +24 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/cli.py +1000 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/core.py +1304 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/export.py +217 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/sql.py +176 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/templates/schema_analysis.html +167 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/utils.py +49 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/validation.py +266 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/visualization/__init__.py +29 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/visualization/components.py +746 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/visualization/core.py +917 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit/visualization/utils.py +288 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit.egg-info/PKG-INFO +290 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit.egg-info/SOURCES.txt +47 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit.egg-info/dependency_links.txt +1 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit.egg-info/entry_points.txt +2 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit.egg-info/requires.txt +26 -0
- linkml_toolkit-0.1.0/src/linkml_toolkit.egg-info/top_level.txt +1 -0
- linkml_toolkit-0.1.0/tests/conftest.py +112 -0
- linkml_toolkit-0.1.0/tests/data/basic_schema.yaml +28 -0
- linkml_toolkit-0.1.0/tests/data/invalid_schema.yaml +3 -0
- linkml_toolkit-0.1.0/tests/data/second_schema.yaml +34 -0
- linkml_toolkit-0.1.0/tests/test_cli.py +136 -0
- linkml_toolkit-0.1.0/tests/test_core.py +120 -0
- linkml_toolkit-0.1.0/tests/test_export.py +78 -0
- linkml_toolkit-0.1.0/tests/test_operations.py +40 -0
- linkml_toolkit-0.1.0/tests/test_validation.py +83 -0
- linkml_toolkit-0.1.0/tox.ini +20 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
.Python
|
|
6
|
+
build/
|
|
7
|
+
develop-eggs/
|
|
8
|
+
dist/
|
|
9
|
+
downloads/
|
|
10
|
+
eggs/
|
|
11
|
+
.eggs/
|
|
12
|
+
lib/
|
|
13
|
+
lib64/
|
|
14
|
+
parts/
|
|
15
|
+
sdist/
|
|
16
|
+
var/
|
|
17
|
+
wheels/
|
|
18
|
+
*.egg-info/
|
|
19
|
+
.installed.cfg
|
|
20
|
+
*.egg
|
|
21
|
+
MANIFEST
|
|
22
|
+
.tox/
|
|
23
|
+
.coverage
|
|
24
|
+
.coverage.*
|
|
25
|
+
.cache
|
|
26
|
+
coverage.xml
|
|
27
|
+
*.cover
|
|
28
|
+
*.py,cover
|
|
29
|
+
.pytest_cache/
|
|
30
|
+
.env
|
|
31
|
+
.venv
|
|
32
|
+
env/
|
|
33
|
+
venv/
|
|
34
|
+
ENV/
|
|
35
|
+
docs/_build/
|
|
36
|
+
.DS_Store
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Antonio Fernandez-Guerra
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: linkml-toolkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple toolkit for working with LinkML schemas
|
|
5
|
+
Author: Antonio Fernandez-Guerra
|
|
6
|
+
Author-email: antonio@metagenomics.eu
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Requires-Python: >=3.7
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: linkml>=1.8.1
|
|
21
|
+
Requires-Dist: click>=8.0.0
|
|
22
|
+
Requires-Dist: rich>=10.0.0
|
|
23
|
+
Requires-Dist: pyyaml>=5.4.0
|
|
24
|
+
Requires-Dist: rdflib>=6.0.0
|
|
25
|
+
Requires-Dist: jsonschema>=4.0.0
|
|
26
|
+
Provides-Extra: test
|
|
27
|
+
Requires-Dist: pytest>=6.0; extra == "test"
|
|
28
|
+
Requires-Dist: pytest-cov>=2.0; extra == "test"
|
|
29
|
+
Requires-Dist: tox>=3.24; extra == "test"
|
|
30
|
+
Requires-Dist: coverage>=5.0; extra == "test"
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
|
34
|
+
Requires-Dist: tox>=3.24; extra == "dev"
|
|
35
|
+
Requires-Dist: coverage>=5.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
|
37
|
+
Requires-Dist: isort>=5.0; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy>=0.910; extra == "dev"
|
|
39
|
+
Provides-Extra: docs
|
|
40
|
+
Requires-Dist: mkdocs>=1.2; extra == "docs"
|
|
41
|
+
Requires-Dist: mkdocstrings>=0.18; extra == "docs"
|
|
42
|
+
Requires-Dist: mkdocs-material>=8.0; extra == "docs"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# LinkML Toolkit (lmtk)
|
|
46
|
+
|
|
47
|
+
[](https://github.com/genomewalker/linkml-toolkit/actions)
|
|
48
|
+
[](https://badge.fury.io/py/linkml-toolkit)
|
|
49
|
+
[](https://linkml-toolkit.readthedocs.io/en/latest/?badge=latest)
|
|
50
|
+
|
|
51
|
+
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.
|
|
52
|
+
|
|
53
|
+
## 🌟 Features
|
|
54
|
+
|
|
55
|
+
- **Schema Analysis**
|
|
56
|
+
- Generate schema summaries.
|
|
57
|
+
- Detailed views of classes, slots, and types.
|
|
58
|
+
- Support for hierarchical and section-based analysis.
|
|
59
|
+
|
|
60
|
+
- **Schema Validation**
|
|
61
|
+
- Rigorous validation checks with detailed error reporting.
|
|
62
|
+
- Optional metadata display for schemas.
|
|
63
|
+
|
|
64
|
+
- **Schema Operations**
|
|
65
|
+
- Merge or concatenate multiple schemas.
|
|
66
|
+
- Subset schemas by specified classes.
|
|
67
|
+
|
|
68
|
+
- **Format Conversion**
|
|
69
|
+
- Export schemas to JSON, RDF, GraphQL, CSV, TSV, and SQL formats.
|
|
70
|
+
- Customize RDF serialization formats (e.g., Turtle, XML).
|
|
71
|
+
- SQL export supporting PostgreSQL, MySQL, SQLite, and DuckDB dialects.
|
|
72
|
+
|
|
73
|
+
- **Visualization**
|
|
74
|
+
- Generate interactive HTML visualizations of schemas.
|
|
75
|
+
- Options for inheritance, descriptions, and statistics display.
|
|
76
|
+
|
|
77
|
+
## 🚀 Installation
|
|
78
|
+
|
|
79
|
+
### Using pip
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install linkml-toolkit
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Using conda
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Create environment from provided configuration
|
|
89
|
+
conda env create -f environment-dev.yml
|
|
90
|
+
conda activate linkml-toolkit-dev
|
|
91
|
+
|
|
92
|
+
# For production environment only
|
|
93
|
+
conda env create -f environment.yml
|
|
94
|
+
conda activate linkml-toolkit
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Development Installation
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Clone the repository
|
|
101
|
+
git clone https://github.com/genomewalker/linkml-toolkit.git
|
|
102
|
+
cd linkml-toolkit
|
|
103
|
+
|
|
104
|
+
# Create and activate conda environment
|
|
105
|
+
conda env create -f environment-dev.yml
|
|
106
|
+
conda activate linkml-toolkit-dev
|
|
107
|
+
|
|
108
|
+
# Install in development mode
|
|
109
|
+
pip install -e ".[dev,test,docs]"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 📚 Usage
|
|
113
|
+
|
|
114
|
+
### Core Commands
|
|
115
|
+
|
|
116
|
+
#### Schema Summary
|
|
117
|
+
```bash
|
|
118
|
+
# Generate a summary of the schema
|
|
119
|
+
lmtk summary --schema schema.yaml
|
|
120
|
+
|
|
121
|
+
# Detailed view for specific sections
|
|
122
|
+
lmtk summary --schema schema.yaml --section slots --detailed
|
|
123
|
+
|
|
124
|
+
# Export summary to JSON
|
|
125
|
+
lmtk summary --schema schema.yaml --output summary.json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Schema Validation
|
|
129
|
+
```bash
|
|
130
|
+
# Validate schema
|
|
131
|
+
lmtk validate --schema schema.yaml
|
|
132
|
+
|
|
133
|
+
# Validate with metadata display
|
|
134
|
+
lmtk validate --schema schema.yaml --metadata
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Schema Export
|
|
138
|
+
```bash
|
|
139
|
+
# Export to JSON Schema
|
|
140
|
+
lmtk export --schema schema.yaml --format json --output schema.json
|
|
141
|
+
|
|
142
|
+
# Export to RDF (Turtle format)
|
|
143
|
+
lmtk export --schema schema.yaml --format rdf --rdf-format turtle --output schema.ttl
|
|
144
|
+
|
|
145
|
+
# Export to SQL (PostgreSQL dialect)
|
|
146
|
+
lmtk export --schema schema.yaml --format sql --sql-dialect postgresql --output schema.sql
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### Schema Subset
|
|
150
|
+
```bash
|
|
151
|
+
# Create a subset containing specific classes
|
|
152
|
+
lmtk subset --schema schema.yaml --classes class1,class2 --output subset.yaml
|
|
153
|
+
|
|
154
|
+
# Exclude inherited elements
|
|
155
|
+
lmtk subset --schema schema.yaml --classes class1 --no-inherited --output subset.yaml
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### Schema Combination
|
|
159
|
+
```bash
|
|
160
|
+
# Merge schemas
|
|
161
|
+
lmtk combine --schema base.yaml --additional-schemas schema1.yaml -a schema2.yaml --mode merge --output merged.yaml
|
|
162
|
+
|
|
163
|
+
# Concatenate schemas
|
|
164
|
+
lmtk combine --schema base.yaml --additional-schemas schema1.yaml -a schema2.yaml --mode concat --output concatenated.yaml
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### Schema Visualization
|
|
168
|
+
```bash
|
|
169
|
+
# Generate an interactive HTML visualization
|
|
170
|
+
lmtk visualize --schema schema.yaml --output visualization.html
|
|
171
|
+
|
|
172
|
+
# Generate full documentation bundle
|
|
173
|
+
lmtk visualize --schema schema.yaml --output docs/ --full-docs
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 🛠️ Development
|
|
177
|
+
|
|
178
|
+
### Environment Management
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Create development environment
|
|
182
|
+
conda env create -f environment.yml
|
|
183
|
+
|
|
184
|
+
# Update environment
|
|
185
|
+
conda env update -f environment.yml
|
|
186
|
+
|
|
187
|
+
# Create production environment
|
|
188
|
+
conda env create -f environment.prod.yml
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Running Tests
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Run all tests
|
|
195
|
+
pytest
|
|
196
|
+
|
|
197
|
+
# Run with coverage
|
|
198
|
+
pytest --cov=linkml_toolkit
|
|
199
|
+
|
|
200
|
+
# Run specific test file
|
|
201
|
+
pytest tests/test_core.py
|
|
202
|
+
|
|
203
|
+
# Run tests with output
|
|
204
|
+
pytest -v
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Building Documentation
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Build documentation
|
|
211
|
+
cd docs
|
|
212
|
+
mkdocs build
|
|
213
|
+
|
|
214
|
+
# Serve documentation locally
|
|
215
|
+
mkdocs serve
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## 📖 Project Structure
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
linkml-toolkit/
|
|
222
|
+
├── src/
|
|
223
|
+
│ └── linkml_toolkit/ # Source code
|
|
224
|
+
├── tests/ # Test suite
|
|
225
|
+
│ └── data/ # Test data
|
|
226
|
+
├── docs/ # Documentation
|
|
227
|
+
├── environment.yml # Development environment
|
|
228
|
+
├── environment.prod.yml # Production environment
|
|
229
|
+
├── pyproject.toml # Build configuration
|
|
230
|
+
├── setup.cfg # Package metadata
|
|
231
|
+
└── tox.ini # Test automation
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## 🤝 Contributing
|
|
235
|
+
|
|
236
|
+
We welcome contributions! Here's how you can help:
|
|
237
|
+
|
|
238
|
+
1. **Fork the Repository**
|
|
239
|
+
```bash
|
|
240
|
+
git clone https://github.com/genomewalker/linkml-toolkit.git
|
|
241
|
+
cd linkml-toolkit
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
2. **Set Up Development Environment**
|
|
245
|
+
```bash
|
|
246
|
+
conda env create -f environment.yml
|
|
247
|
+
conda activate linkml-toolkit
|
|
248
|
+
pip install -e ".[dev,test,docs]"
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
3. **Create a Branch**
|
|
252
|
+
```bash
|
|
253
|
+
git checkout -b feature/your-feature-name
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
4. **Make Changes**
|
|
257
|
+
- Write code
|
|
258
|
+
- Add tests
|
|
259
|
+
- Update documentation
|
|
260
|
+
|
|
261
|
+
5. **Verify Changes**
|
|
262
|
+
```bash
|
|
263
|
+
# Run tests
|
|
264
|
+
pytest
|
|
265
|
+
|
|
266
|
+
# Run linting
|
|
267
|
+
tox -e lint
|
|
268
|
+
|
|
269
|
+
# Build docs
|
|
270
|
+
cd docs && mkdocs build
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
6. **Submit Pull Request**
|
|
274
|
+
- Push changes to your fork
|
|
275
|
+
- Create pull request
|
|
276
|
+
- Wait for review
|
|
277
|
+
|
|
278
|
+
## 📜 License
|
|
279
|
+
|
|
280
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
281
|
+
|
|
282
|
+
## 🙏 Acknowledgments
|
|
283
|
+
|
|
284
|
+
- LinkML community for the base LinkML implementation.
|
|
285
|
+
- Contributors who have helped improve this toolkit.
|
|
286
|
+
|
|
287
|
+
## 📫 Contact
|
|
288
|
+
|
|
289
|
+
- Issue Tracker: [GitHub Issues](https://github.com/genomewalker/linkml-toolkit/issues)
|
|
290
|
+
- Documentation: [ReadTheDocs](https://linkml-toolkit.readthedocs.io/)
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# LinkML Toolkit (lmtk)
|
|
2
|
+
|
|
3
|
+
[](https://github.com/genomewalker/linkml-toolkit/actions)
|
|
4
|
+
[](https://badge.fury.io/py/linkml-toolkit)
|
|
5
|
+
[](https://linkml-toolkit.readthedocs.io/en/latest/?badge=latest)
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
## 🌟 Features
|
|
10
|
+
|
|
11
|
+
- **Schema Analysis**
|
|
12
|
+
- Generate schema summaries.
|
|
13
|
+
- Detailed views of classes, slots, and types.
|
|
14
|
+
- Support for hierarchical and section-based analysis.
|
|
15
|
+
|
|
16
|
+
- **Schema Validation**
|
|
17
|
+
- Rigorous validation checks with detailed error reporting.
|
|
18
|
+
- Optional metadata display for schemas.
|
|
19
|
+
|
|
20
|
+
- **Schema Operations**
|
|
21
|
+
- Merge or concatenate multiple schemas.
|
|
22
|
+
- Subset schemas by specified classes.
|
|
23
|
+
|
|
24
|
+
- **Format Conversion**
|
|
25
|
+
- Export schemas to JSON, RDF, GraphQL, CSV, TSV, and SQL formats.
|
|
26
|
+
- Customize RDF serialization formats (e.g., Turtle, XML).
|
|
27
|
+
- SQL export supporting PostgreSQL, MySQL, SQLite, and DuckDB dialects.
|
|
28
|
+
|
|
29
|
+
- **Visualization**
|
|
30
|
+
- Generate interactive HTML visualizations of schemas.
|
|
31
|
+
- Options for inheritance, descriptions, and statistics display.
|
|
32
|
+
|
|
33
|
+
## 🚀 Installation
|
|
34
|
+
|
|
35
|
+
### Using pip
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install linkml-toolkit
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Using conda
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Create environment from provided configuration
|
|
45
|
+
conda env create -f environment-dev.yml
|
|
46
|
+
conda activate linkml-toolkit-dev
|
|
47
|
+
|
|
48
|
+
# For production environment only
|
|
49
|
+
conda env create -f environment.yml
|
|
50
|
+
conda activate linkml-toolkit
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Development Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Clone the repository
|
|
57
|
+
git clone https://github.com/genomewalker/linkml-toolkit.git
|
|
58
|
+
cd linkml-toolkit
|
|
59
|
+
|
|
60
|
+
# Create and activate conda environment
|
|
61
|
+
conda env create -f environment-dev.yml
|
|
62
|
+
conda activate linkml-toolkit-dev
|
|
63
|
+
|
|
64
|
+
# Install in development mode
|
|
65
|
+
pip install -e ".[dev,test,docs]"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 📚 Usage
|
|
69
|
+
|
|
70
|
+
### Core Commands
|
|
71
|
+
|
|
72
|
+
#### Schema Summary
|
|
73
|
+
```bash
|
|
74
|
+
# Generate a summary of the schema
|
|
75
|
+
lmtk summary --schema schema.yaml
|
|
76
|
+
|
|
77
|
+
# Detailed view for specific sections
|
|
78
|
+
lmtk summary --schema schema.yaml --section slots --detailed
|
|
79
|
+
|
|
80
|
+
# Export summary to JSON
|
|
81
|
+
lmtk summary --schema schema.yaml --output summary.json
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Schema Validation
|
|
85
|
+
```bash
|
|
86
|
+
# Validate schema
|
|
87
|
+
lmtk validate --schema schema.yaml
|
|
88
|
+
|
|
89
|
+
# Validate with metadata display
|
|
90
|
+
lmtk validate --schema schema.yaml --metadata
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Schema Export
|
|
94
|
+
```bash
|
|
95
|
+
# Export to JSON Schema
|
|
96
|
+
lmtk export --schema schema.yaml --format json --output schema.json
|
|
97
|
+
|
|
98
|
+
# Export to RDF (Turtle format)
|
|
99
|
+
lmtk export --schema schema.yaml --format rdf --rdf-format turtle --output schema.ttl
|
|
100
|
+
|
|
101
|
+
# Export to SQL (PostgreSQL dialect)
|
|
102
|
+
lmtk export --schema schema.yaml --format sql --sql-dialect postgresql --output schema.sql
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### Schema Subset
|
|
106
|
+
```bash
|
|
107
|
+
# Create a subset containing specific classes
|
|
108
|
+
lmtk subset --schema schema.yaml --classes class1,class2 --output subset.yaml
|
|
109
|
+
|
|
110
|
+
# Exclude inherited elements
|
|
111
|
+
lmtk subset --schema schema.yaml --classes class1 --no-inherited --output subset.yaml
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### Schema Combination
|
|
115
|
+
```bash
|
|
116
|
+
# Merge schemas
|
|
117
|
+
lmtk combine --schema base.yaml --additional-schemas schema1.yaml -a schema2.yaml --mode merge --output merged.yaml
|
|
118
|
+
|
|
119
|
+
# Concatenate schemas
|
|
120
|
+
lmtk combine --schema base.yaml --additional-schemas schema1.yaml -a schema2.yaml --mode concat --output concatenated.yaml
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Schema Visualization
|
|
124
|
+
```bash
|
|
125
|
+
# Generate an interactive HTML visualization
|
|
126
|
+
lmtk visualize --schema schema.yaml --output visualization.html
|
|
127
|
+
|
|
128
|
+
# Generate full documentation bundle
|
|
129
|
+
lmtk visualize --schema schema.yaml --output docs/ --full-docs
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 🛠️ Development
|
|
133
|
+
|
|
134
|
+
### Environment Management
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Create development environment
|
|
138
|
+
conda env create -f environment.yml
|
|
139
|
+
|
|
140
|
+
# Update environment
|
|
141
|
+
conda env update -f environment.yml
|
|
142
|
+
|
|
143
|
+
# Create production environment
|
|
144
|
+
conda env create -f environment.prod.yml
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Running Tests
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Run all tests
|
|
151
|
+
pytest
|
|
152
|
+
|
|
153
|
+
# Run with coverage
|
|
154
|
+
pytest --cov=linkml_toolkit
|
|
155
|
+
|
|
156
|
+
# Run specific test file
|
|
157
|
+
pytest tests/test_core.py
|
|
158
|
+
|
|
159
|
+
# Run tests with output
|
|
160
|
+
pytest -v
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Building Documentation
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Build documentation
|
|
167
|
+
cd docs
|
|
168
|
+
mkdocs build
|
|
169
|
+
|
|
170
|
+
# Serve documentation locally
|
|
171
|
+
mkdocs serve
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## 📖 Project Structure
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
linkml-toolkit/
|
|
178
|
+
├── src/
|
|
179
|
+
│ └── linkml_toolkit/ # Source code
|
|
180
|
+
├── tests/ # Test suite
|
|
181
|
+
│ └── data/ # Test data
|
|
182
|
+
├── docs/ # Documentation
|
|
183
|
+
├── environment.yml # Development environment
|
|
184
|
+
├── environment.prod.yml # Production environment
|
|
185
|
+
├── pyproject.toml # Build configuration
|
|
186
|
+
├── setup.cfg # Package metadata
|
|
187
|
+
└── tox.ini # Test automation
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 🤝 Contributing
|
|
191
|
+
|
|
192
|
+
We welcome contributions! Here's how you can help:
|
|
193
|
+
|
|
194
|
+
1. **Fork the Repository**
|
|
195
|
+
```bash
|
|
196
|
+
git clone https://github.com/genomewalker/linkml-toolkit.git
|
|
197
|
+
cd linkml-toolkit
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
2. **Set Up Development Environment**
|
|
201
|
+
```bash
|
|
202
|
+
conda env create -f environment.yml
|
|
203
|
+
conda activate linkml-toolkit
|
|
204
|
+
pip install -e ".[dev,test,docs]"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
3. **Create a Branch**
|
|
208
|
+
```bash
|
|
209
|
+
git checkout -b feature/your-feature-name
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
4. **Make Changes**
|
|
213
|
+
- Write code
|
|
214
|
+
- Add tests
|
|
215
|
+
- Update documentation
|
|
216
|
+
|
|
217
|
+
5. **Verify Changes**
|
|
218
|
+
```bash
|
|
219
|
+
# Run tests
|
|
220
|
+
pytest
|
|
221
|
+
|
|
222
|
+
# Run linting
|
|
223
|
+
tox -e lint
|
|
224
|
+
|
|
225
|
+
# Build docs
|
|
226
|
+
cd docs && mkdocs build
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
6. **Submit Pull Request**
|
|
230
|
+
- Push changes to your fork
|
|
231
|
+
- Create pull request
|
|
232
|
+
- Wait for review
|
|
233
|
+
|
|
234
|
+
## 📜 License
|
|
235
|
+
|
|
236
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
237
|
+
|
|
238
|
+
## 🙏 Acknowledgments
|
|
239
|
+
|
|
240
|
+
- LinkML community for the base LinkML implementation.
|
|
241
|
+
- Contributors who have helped improve this toolkit.
|
|
242
|
+
|
|
243
|
+
## 📫 Contact
|
|
244
|
+
|
|
245
|
+
- Issue Tracker: [GitHub Issues](https://github.com/genomewalker/linkml-toolkit/issues)
|
|
246
|
+
- Documentation: [ReadTheDocs](https://linkml-toolkit.readthedocs.io/)
|