| Crates.io | ggen |
| lib.rs | ggen |
| version | 5.1.3 |
| created_at | 2025-10-09 16:44:47.660343+00 |
| updated_at | 2026-01-06 22:53:40.693671+00 |
| description | Ontology-driven code generation: Transform RDF ontologies into typed code through SPARQL queries and Tera templates |
| homepage | https://github.com/seanchatmangpt/ggen |
| repository | https://github.com/seanchatmangpt/ggen |
| max_upload_size | |
| id | 1875895 |
| size | 2,656,567 |
Transform RDF ontologies into reproducible code through SPARQL queries and Tera templates.
ggen is a deterministic code generator that bridges semantic web technologies (RDF, SPARQL, OWL) with modern programming languages. Define your domain model once as an RDF ontology, and ggen generates type-safe code across multiple languages.
macOS/Linux (Fastest):
brew install seanchatmangpt/ggen/ggen
ggen --version # Should show: ggen 5.0.2+
Any Platform (Docker):
docker pull seanchatman/ggen:5.0.2
docker run --rm -v $(pwd):/workspace seanchatman/ggen:5.0.2 sync
From Source (Rust):
cargo install ggen-cli
Step 1: Create a minimal ontology (schema/Person.ttl):
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ex: <https://example.com/> .
ex:Person a rdfs:Class ;
rdfs:label "Person" ;
rdfs:comment "A person in the system" .
ex:name a rdf:Property ;
rdfs:domain ex:Person ;
rdfs:range xsd:string ;
rdfs:label "Full name" .
ex:email a rdf:Property ;
rdfs:domain ex:Person ;
rdfs:range xsd:string ;
rdfs:label "Email address" .
Step 2: Create configuration (ggen.toml):
[project]
name = "my-first-app"
version = "0.1.0"
[ontology]
source = "schema/"
[generation]
output_dir = "src/generated"
Step 3: Add a Tera template (templates/struct.tera):
{%- for class in classes %}
#[derive(Debug, Clone)]
pub struct {{ class.name }} {
{%- for prop in class.properties %}
pub {{ prop.name }}: String,
{%- endfor %}
}
{%- endfor %}
Step 4: Generate code:
ggen sync
Output: src/generated/struct.rs with:
#[derive(Debug, Clone)]
pub struct Person {
pub name: String,
pub email: String,
}
Choose your learning path:
Start with Tutorials - hands-on, step-by-step projects
Check How-To Guides - specific solutions to common tasks
See Reference Docs - CLI, ggen.toml, SPARQL, templates
Read Explanations - philosophical background and architecture
Explore Example Projects - REST APIs, databases, microservices
See INDEX.md - master listing of all documentation
Define your domain model in Turtle syntax - classes, properties, relationships, constraints.
Query the ontology to extract data, run inference (CONSTRUCT), and prepare data for generation.
Render code in any language using the Tera template engine with full programming capabilities.
Configure which queries feed into which templates, with validation and transformation rules.
ggen follows three paradigm shifts:
.ttl files (the source).md documentation from RDF# 1. Define API spec in RDF
# 2. SPARQL query to extract endpoints
# 3. Template renders Axum/Rocket code
ggen sync
# Same ontology, different templates
# rust/ → Rust code
# typescript/ → TypeScript code
# python/ → Python code
ggen sync
# RDF model → SPARQL inference → PostgreSQL DDL
# Includes: tables, indexes, relationships, migrations
ggen sync
Version: 5.0.2 Crates: 17 active (ggen-core, ggen-cli, ggen-ai, ggen-marketplace, ggen-test-audit, etc.) Stability: Production-ready License: Apache 2.0 OR MIT
We welcome contributions! See CONTRIBUTING.md for guidelines.
Development Setup:
git clone https://github.com/seanchatmangpt/ggen
cd ggen
cargo make check # Verify setup
cargo make test # Run tests
cargo make lint # Check style
This project follows strict operational principles. See CLAUDE.md for:
Licensed under either of:
at your option.
Ready to get started? → Quick Start Tutorial