Skip to main content

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.

An ontology is a formal, machine-readable description of a domain: the kinds of things that exist, the properties they can have, and the logical relationships between them. In practical terms, ontologies give a knowledge graph its semantic backbone — they tell the system (and the LLM) not just that two nodes are connected, but what kind of things those nodes are and what that connection means. Going Meta treats ontologies as first-class citizens from Session 2 onward, using them to guide data import, validate graph shape, drive LLM extraction, and power agent tool calling.

Core Ontology Concepts

Classes

Define the categories of things in a domain. A class like dbo:Person or :Article says “there are entities of this type.” Classes can form hierarchies via rdfs:subClassOf (OWL) or skos:broader (SKOS).

Properties

Describe attributes of individuals (datatype properties, e.g. name) or relationships between individuals (object properties, e.g. authorOf). Properties can have domain and range constraints.

Individuals

Specific instances of a class — the actual data. In the property graph model, these become Neo4j nodes labelled with the class name.

Restrictions & Axioms

Logical rules that constrain the model — cardinality (each article has exactly one author), range (the object of authorOf must be a Person), and disjointness (a node cannot be both a Person and an Organisation).

OWL vs. SKOS

Going Meta uses both OWL and SKOS depending on the use case. Understanding the difference helps you choose the right vocabulary.
OWL is the W3C standard for expressive, logic-based ontologies. It supports full class hierarchies, property restrictions, inference rules, and consistency checking. OWL ontologies are used in Session 4 (ontology-based reasoning), Session 5 (ontology-driven KG construction), and throughout Season 2 for guiding LLM entity extraction.OWL files are most commonly serialised as Turtle (.ttl) or RDF/XML. Example class definition:
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix : <http://onto.neo4j.com/rail#> .

:Station a owl:Class ;
    rdfs:label "Station" ;
    rdfs:comment "A railway station where trains stop." .

:ConnectedTo a owl:ObjectProperty ;
    rdfs:domain :Station ;
    rdfs:range  :Station ;
    rdfs:label  "connected to" .

Importing Ontologies into Neo4j with Neosemantics (n10s)

The Neosemantics plugin (n10s) bridges the RDF and property graph worlds. It maps RDF triples to Neo4j nodes and relationships, and exposes procedures for importing SKOS taxonomies, OWL ontologies, and arbitrary RDF datasets.

Step 1: Configure the Graph

Before importing any RDF, you must initialise the n10s graph configuration and create the required uniqueness constraint. This is done once per database:
// Create the uniqueness constraint required by n10s
CREATE CONSTRAINT n10s_unique_uri ON (r:Resource) ASSERT r.uri IS UNIQUE;

// Initialise n10s: map SKOS classes to :Concept nodes,
// and skos:broader to a :broader relationship
CALL n10s.graphconfig.init({
  handleVocabUris: "IGNORE",
  classLabel:      "Concept",
  subClassOfRel:   "broader"
});
The handleVocabUris: "IGNORE" setting strips namespace prefixes so that skos:prefLabel becomes the property key prefLabel rather than the full URI. This produces a much more readable graph for Cypher queries.

Step 2: Import a SKOS Taxonomy

// Import the Going Meta SKOS vocabulary (used in Session 2)
CALL n10s.skos.import.fetch(
  "https://raw.githubusercontent.com/jbarrasa/goingmeta/main/session02/resources/goingmeta-skos.ttl",
  "Turtle"
);
This single call reads the Turtle file, parses every triple, and creates:
  • A :Concept node for each skos:Concept in the file
  • prefLabel and altLabel properties on each concept
  • :broader relationships between concepts following the skos:broader triples

Step 3: Remove Redundant Hierarchy Shortcuts

SKOS vocabularies imported from sources like Wikidata often contain transitive broader shortcuts (A broader C when A broader B and B broader C already exists). Remove them to keep the hierarchy clean:
MATCH (s:Concept)-[shortcut:broader]->(:Concept)<-[:broader*2..]-(s)
DELETE shortcut;

Step 4: Import an OWL Ontology

For full OWL ontologies (classes, object properties, datatype properties, restrictions), use n10s.onto.import.fetch:
// Import the software stacks ontology
CALL n10s.onto.import.fetch(
  "http://www.nsmntx.org/2020/08/swStacks",
  "Turtle"
);
After import, OWL classes become nodes with a :Class label, and object properties become nodes with an :ObjectProperty label, all connected by :SCO (subClassOf) and :SPO (subPropertyOf) relationships.

Ontologies as Schemas for LLM Extraction

From Season 2 onward, Going Meta uses OWL ontologies not just for data import but as dynamic schemas that guide LLM entity extraction. The pattern works as follows:
1

Load the ontology into Neo4j

Use n10s.onto.import.fetch to load the domain ontology. The graph now contains the class hierarchy and property definitions.
2

Query the ontology for the extraction schema

Cypher queries read the ontology graph to produce a structured schema description — a list of classes, their properties, and their relationships — which is passed to the LLM as part of the system prompt.
3

LLM extracts entities conforming to the schema

Because the LLM is given an explicit ontology-derived schema, its output is grounded in the domain model. Pydantic models (from session 30 onward) enforce structure on the LLM’s JSON output.
4

Write extracted entities back to Neo4j

The extracted entities and relationships are written to the knowledge graph as MERGE statements, using the ontology class names as Neo4j labels.
This ontology-driven extraction pattern is the central innovation of Going Meta Season 2 and is covered in depth across sessions 28–32. The ontology acts as both a schema validator and a prompt engineering tool simultaneously.

Practical Ontology Tools

Protégé

The most widely used desktop ontology editor. Used in sessions 15 and 19 for creating and versioning OWL ontologies visually before importing them into Neo4j.

RDFLib (Python)

A Python library for parsing, querying, and serialising RDF graphs. Used extensively in sessions 5, 12, 18, 29, and 30 for programmatic ontology processing before loading into Neo4j.

Build docs developers (and LLMs) love