Synthetic Knowledge Graphs That Survive a Reasoner
PyGraft builds fake-but-consistent schemas and knowledge graphs on demand for research and benchmarking when real data is off-limits.

What it does
PyGraft is a Python library that fabricates synthetic schemas and knowledge graphs from a set of user-specified parameters. It can build just an ontology, just a KG, or both in a single pass, outputting standard RDF serialized with RDFS and OWL constructs. Every artifact is run through the HermiT DL reasoner to verify logical consistency before it lands in your output folder.
The interesting bit
Most synthetic data tools optimize for scale or realism; PyGraft optimizes for logical coherence. By feeding every generated schema and graph through a description logic reasoner, it ensures your fake data is not just structurally plausible but semantically self-consistent—a quiet but crucial distinction for benchmarking and ML experiments.
Key highlights
- Generates domain-agnostic schemas and KGs from one pipeline, or either component independently.
- Highly tunable via YAML parameters that control shape, size, and the density of OWL/RDFS constructs.
- Validates logical consistency with HermiT (via
owlready2) at both the schema and KG stages. - Exports standard RDF files plus JSON sidecars describing classes and relations.
- Usable as a Python package or from the command line.
Caveats
- Requires a Java runtime because the HermiT reasoner is JVM-based.
- Schema ingestion is currently limited to PyGraft-generated blueprints; arbitrary input ontologies are on the roadmap.
- Literal support and extreme-scale generation are flagged as future work, with the latter likely requiring a move away from
rdflib.
Verdict
Reach for PyGraft if you need reproducible, semantically valid synthetic graph data for research or benchmarking in privacy-sensitive domains. Look elsewhere if you need to bootstrap from an existing ontology or generate billion-triple scale KGs today.
Frequently asked
- What is nicolas-hbt/pygraft?
- PyGraft builds fake-but-consistent schemas and knowledge graphs on demand for research and benchmarking when real data is off-limits.
- Is pygraft open source?
- Yes — nicolas-hbt/pygraft is open source, released under the MIT license.
- What language is pygraft written in?
- nicolas-hbt/pygraft is primarily written in Python.
- How popular is pygraft?
- nicolas-hbt/pygraft has 710 stars on GitHub.
- Where can I find pygraft?
- nicolas-hbt/pygraft is on GitHub at https://github.com/nicolas-hbt/pygraft.