Skip to content

Commit f64c610

Browse files
authored
Merge pull request #41 from FAIRChemistry/update-docs-add-jsonld
Enhance documentation, build workflow, and add OWL export
2 parents 1b58a03 + 2288e4c commit f64c610

54 files changed

Lines changed: 4894 additions & 251 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/generate_types.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ GEN_FILES=$(find types -name '*.toml')
3030
for file in $GEN_FILES; do
3131
# Generate the go file
3232
echo "Generating $file"
33-
md-models pipeline -i $file
33+
cargo run -- pipeline -i $file
3434
done

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ schemars = { version = "1.0.4" }
4545
json-patch = "4.0.0"
4646
thiserror = "2.0.12"
4747
variantly = "0.4.0"
48+
case = "1.0.0"
4849

4950
[features]
5051
default = ["openai"]

docs/src/SUMMARY.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- [Full example](./syntax/full_example.md)
1313
- [Best practices](./syntax/best_practices.md)
1414
- [Command Line Interface](./cli/cli.md)
15-
- [Generation](./cli/code_generation.md)
15+
- [Generation](./cli/generation.md)
1616
- [Pipelines](./cli/pipelines.md)
1717
- [Validation](./cli/schema_validation.md)
1818
- [Large Language Models](./cli/llm.md)
@@ -21,8 +21,5 @@
2121
- [Schema languages](./exporters/schemas.md)
2222
- [API specifications](./exporters/apis.md)
2323
- [Documentation](./exporters/documentation.md)
24-
- [Examples](./examples/examples.md)
25-
- [Hello MD-Models](./examples/hello_md_models.md)
26-
- [Union types](./examples/union_types.md)
27-
- [Database models](./examples/database_models.md)
2824
- [FAQ](./faq/faq.md)
25+
- [My model is not validating](./faq/validation.md)

docs/src/cli/cli.md

Lines changed: 194 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,196 @@
11
# Command Line Interface
22

3-
*To be added*
3+
The MD-Models command-line interface (CLI) provides a comprehensive set of tools for working with markdown data models. It enables you to validate models, generate code in multiple formats, extract data using AI, and automate workflows through pipelines.
4+
5+
## Installation
6+
7+
Install the MD-Models CLI using Cargo:
8+
9+
```bash
10+
cargo install mdmodels
11+
```
12+
13+
Once installed, you can use the `md-models` command from anywhere in your terminal.
14+
15+
## Available Commands
16+
17+
The MD-Models CLI provides the following commands:
18+
19+
### `validate`
20+
21+
Validates markdown model files for structural integrity, naming conventions, and type consistency.
22+
23+
**Quick start:**
24+
25+
```bash
26+
md-models validate -i model.md
27+
```
28+
29+
**Use cases:**
30+
- Check models before code generation
31+
- Validate models in CI/CD pipelines
32+
- Ensure models meet naming and structure requirements
33+
34+
**Learn more:** [Schema Validation](schema_validation.md)
35+
36+
---
37+
38+
### `convert`
39+
40+
Converts markdown models to various output formats including programming languages, schema definitions, API specifications, and documentation.
41+
42+
**Quick start:**
43+
44+
```bash
45+
# Generate Python Pydantic models
46+
md-models convert -i model.md -t python-pydantic -o models.py
47+
48+
# Generate JSON Schema
49+
md-models convert -i model.md -t json-schema -r Document -o schema.json
50+
```
51+
52+
**Use cases:**
53+
- Generate type-safe code for your application
54+
- Create API schemas and specifications
55+
- Produce documentation from models
56+
- Export to semantic web formats
57+
58+
**Learn more:** [Code Generation](generation.md)
59+
60+
**Available formats:** See [Exporters](../exporters/exporters.md) for a complete list of supported templates.
61+
62+
---
63+
64+
### `pipeline`
65+
66+
Generates multiple output files from one or more models using a TOML configuration file. Ideal for automating code generation workflows.
67+
68+
**Quick start:**
69+
70+
```bash
71+
md-models pipeline -i pipeline.toml
72+
```
73+
74+
**Use cases:**
75+
- Generate multiple formats in one command
76+
- Automate code generation for entire projects
77+
- Maintain consistency across generated outputs
78+
- Integrate with CI/CD workflows
79+
80+
**Learn more:** [Pipelines](pipelines.md)
81+
82+
---
83+
84+
### `extract`
85+
86+
Uses Large Language Models (LLMs) to extract structured data from unstructured text based on your data model.
87+
88+
**Quick start:**
89+
90+
```bash
91+
md-models extract -m model.md -i text.txt -o output.json
92+
```
93+
94+
**Use cases:**
95+
- Extract structured data from documents
96+
- Parse unstructured text into typed objects
97+
- Convert legacy data formats to structured JSON
98+
- Automate data entry tasks
99+
100+
**Learn more:** [Large Language Models](llm.md)
101+
102+
---
103+
104+
### `dataset validate`
105+
106+
Validates JSON datasets against markdown models to ensure data conforms to the model structure.
107+
108+
**Quick start:**
109+
110+
```bash
111+
md-models dataset validate -i data.json -m model.md
112+
```
113+
114+
**Use cases:**
115+
- Validate API request/response data
116+
- Check data quality in ETL pipelines
117+
- Ensure data consistency before processing
118+
- Validate user-submitted data
119+
120+
---
121+
122+
## Common Workflows
123+
124+
### Development Workflow
125+
126+
```bash
127+
# 1. Validate your model
128+
md-models validate -i model.md
129+
130+
# 2. Generate code for your application
131+
md-models convert -i model.md -t python-pydantic -o models.py
132+
133+
# 3. Generate API schemas
134+
md-models convert -i model.md -t json-schema -r Document -o schema.json
135+
md-models convert -i model.md -t graphql -o schema.graphql
136+
```
137+
138+
### Automated Pipeline Workflow
139+
140+
```bash
141+
# Use a pipeline configuration to generate everything at once
142+
md-models pipeline -i pipeline.toml
143+
```
144+
145+
### Data Extraction Workflow
146+
147+
```bash
148+
# Extract structured data from unstructured text
149+
md-models extract -m model.md -i document.txt -o extracted.json
150+
151+
# Validate the extracted data
152+
md-models dataset validate -i extracted.json -m model.md
153+
```
154+
155+
## Input Sources
156+
157+
All commands that accept input files support:
158+
159+
- **Local file paths**: `md-models validate -i model.md`
160+
- **Remote URLs**: `md-models validate -i https://example.com/model.md`
161+
162+
MD-Models automatically detects whether the input is a URL (starts with `http`/`https`) or a local file path.
163+
164+
## Getting Help
165+
166+
Get help for any command using the `--help` flag:
167+
168+
```bash
169+
# General help
170+
md-models --help
171+
172+
# Command-specific help
173+
md-models convert --help
174+
md-models validate --help
175+
md-models pipeline --help
176+
```
177+
178+
## Command Reference
179+
180+
| Command | Purpose | Documentation |
181+
|---------|---------|---------------|
182+
| `validate` | Validate model structure and syntax | [Schema Validation](schema_validation.md) |
183+
| `convert` | Generate code and schemas | [Code Generation](generation.md) |
184+
| `pipeline` | Batch generation from config | [Pipelines](pipelines.md) |
185+
| `extract` | LLM-powered data extraction | [Large Language Models](llm.md) |
186+
| `dataset validate` | Validate data against models | See `md-models dataset validate --help` |
187+
188+
## Next Steps
189+
190+
- **New to MD-Models?** Start with the [Quickstart](../quickstart.md) guide
191+
- **Want to generate code?** Read [Code Generation](generation.md) for detailed usage
192+
- **Need to validate models?** See [Schema Validation](schema_validation.md) for validation rules
193+
- **Automating workflows?** Check out [Pipelines](pipelines.md) for batch processing
194+
- **Working with AI?** Explore [Large Language Models](llm.md) for data extraction
195+
196+
For detailed information about available export formats and templates, see the [Exporters](../exporters/exporters.md) documentation.

docs/src/cli/code_generation.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)