Season 3, Episode 1 of Going Meta explores how LLM agents can create ontologies interactively using the Neo4j Data Modeling MCP (Model Context Protocol) Server. Rather than hand-crafting OWL files from scratch, the session demonstrates a workflow where an agent converses with the MCP server to build a graph data model, which is then exported as a Mermaid diagram and automatically converted to a fully-formed OWL ontology in Turtle format — and back again.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jbarrasa/goingmeta/llms.txt
Use this file to discover all available pages before exploring further.
Watch the Recording
Season 3, Episode 1 — October 2025
Session Code
Python scripts and example ontologies
The Blue Plaques Domain Model
The session uses the London Blue Plaques dataset as a running example. The data model captures people commemorated by blue plaques, the plaques themselves, the organisations that erected them, addresses, and musical compositions. This is the Mermaid diagram produced by the MCP server during the live session:Converting Mermaid to OWL with mermaid2owl.py
The mermaid2owl.py script parses the Mermaid diagram and produces an rdflib graph with proper OWL class declarations, datatype properties (mapped to XSD types), and object properties derived from labelled edges.
Type mapping
Mermaid property types are mapped to XSD datatypes via a configurable dictionary:Parsing nodes
The parser extracts class names and their properties from the node label syntax (ClassName["ClassName<br/>prop: TYPE"]), stripping Mermaid styling lines and comments:
Parsing edges
Labelled Mermaid arrows (A -->|REL| B) become OWL object properties with rdfs:domain and rdfs:range axioms:
Generating Turtle output
http://voc.neo4j.com/blueplaques namespace:
Reverse-Converting OWL Back to Mermaid with owl2mermaid.py
The companion script owl2mermaid.py performs the inverse transformation: it reads any OWL Turtle file, extracts classes and properties via rdflib, and reconstructs a graph TD Mermaid diagram. This is useful for visualising imported ontologies or verifying a round-trip conversion.
XSD-to-Mermaid type mapping
Building the diagram from an OWL file
build_mermaid function collects owl:Class nodes, groups owl:DatatypeProperty entries by domain, and renders each owl:ObjectProperty as a labelled edge — producing a diagram in the same format the Neo4j Data Modeling MCP Server generates natively.
The
mermaid2owl.py parser strips Mermaid styling lines (classDef, class) before processing, so visual colour annotations in the diagram do not affect the generated ontology.Workflow Summary
Design with the MCP Server
Use the Neo4j Data Modeling MCP Server inside your LLM agent (Claude Desktop, Cursor, etc.) to interactively create a graph data model through natural language. The server exposes tools for adding node types, properties, and relationships.
Export as Mermaid
Export the resulting model as a
.mermaid file. The MCP server generates the graph TD format with <br/>-delimited property lists and labelled -->|REL| edges.Convert to OWL Turtle
Run
mermaid2owl.py with your chosen base URI and ontology IRI to produce a standards-compliant OWL ontology in Turtle syntax, ready to load into Neo4j with n10s or any triple store.