← Docs Hub

Knowledge Graph

Schema-driven KG building, vector embeddings, semantic search, impact analysis

Overview

The Knowledge Graph (KG) is a schema-driven graph built automatically from PostgreSQL sources via the 3-schema system. It provides semantic search, impact analysis, and natural language chart generation for manufacturing data.

Unlike traditional ETL approaches, the KG builder reads domain configuration templates and autonomously discovers, maps, and synchronizes data into a Neo4j graph database — with vector embeddings for semantic retrieval.

Architecture

// KG Architecture
PostgreSQL Sources (ERP, BDE, MES)
├── PG LISTEN/NOTIFY (real-time sync)
KG Builder (3-Schema System)
├── Pass 1: Build Nodes
├── Pass 2: Build Edges
Neo4j (Graph Database)
├── Vector Embeddings (LLM)
├── Cypher Queries
MCP Tools (8 KG + 2 Discovery)

The two-pass build ensures all nodes exist before edges are created, avoiding dangling references. PG LISTEN/NOTIFY provides real-time synchronization when source data changes.

Node Types

Node types are configurable via domain templates. A typical discrete manufacturing setup includes:

  • Machine — CNC centers, assembly stations, test fields
  • Article — Finished products, semi-finished goods
  • Order — Production orders, customer orders
  • Material — Raw materials, purchased parts
  • Supplier — Material and component suppliers
  • Tool — Cutting tools, fixtures, gauges
  • Sensor — OPC-UA tags, MQTT variables
  • CNC Program — NC programs linked to operations

Relationships

Edges encode manufacturing semantics and supply chain dependencies:

PRODUCESMachine → Article
WORKS_ONMachine → Order
USES_TOOLMachine → Tool
HAS_BOMArticle → Material
SUPPLIED_BYMaterial → Supplier
REQUIRES_PROGRAMMachine → CNC Program
HAS_SENSORMachine → Sensor
DEPENDS_ONOrder → Order

MCP Tools (8 KG Tools)

The Knowledge Graph exposes 8 tools via MCP for LLM-driven queries:

kg_search

Semantic search across all node types using vector embeddings

kg_get_node

Retrieve a specific node by ID with all properties and edges

kg_get_neighbors

Get all neighbors of a node, optionally filtered by type or relationship

kg_shortest_path

Find the shortest path between two nodes in the graph

kg_impact_analysis

Trace upstream/downstream impact of a node change (e.g., supplier delay)

kg_cypher_query

Execute arbitrary Cypher queries for advanced analysis

kg_statistics

Get node/edge counts, type distributions, graph health metrics

kg_chart

Natural language → Cypher → interactive chart (bar, line, pie, scatter)

Discovery Tools

Two additional tools support machine and sensor discovery:

kg_discovered_machines

List all machines discovered from OPC-UA, MQTT, and database sources with their connection status and metadata.

kg_machine_sensors

List all sensors and variables attached to a specific machine, including data types, units, and current values.

Domain Templates

The KG builder ships with configurable domain templates for different industries:

  • Discrete Manufacturing — CNC, assembly, BOM, OEE
  • Pharma — Batch records, GMP compliance, equipment qualification
  • Chemical — Process units, recipes, SIL levels, material flows
  • Medical Devices — UDI tracking, DHR, CAPA, sterilization
Info
Templates define which node types, relationships, and source tables to use. Switch templates to adapt the KG to your industry without code changes.

Vector Search

Every node in the graph is enriched with a vector embedding generated by the local LLM. This enables semantic search using natural language:

// Example: natural language query
"Which machines had quality issues with aluminum parts last week?"
// → Embedding → cosine similarity → top-k nodes
// → Traverse edges → full context for LLM

Vector search is used by the kg_search tool and automatically falls back to keyword search when embeddings are unavailable.

Chart Engine

The kg_chart tool converts natural language questions into Cypher queries, executes them against Neo4j, and returns interactive chart configurations:

  • Bar charts — OEE by machine, defects by type
  • Line charts — Production trends, sensor data over time
  • Pie charts — Material distribution, order status breakdown
  • Scatter plots — Correlation analysis (cycle time vs. quality)

OPC-UA & MTP Integration

The KG integrates with OPC-UA and MTP (VDI 2658) to automatically extract equipment models from AutomationML files and CESMII Smart Manufacturing Profiles. Parsed modules, services, and variables are merged into the graph schema with full ISA-95 hierarchy.

Tip
See the dedicated OPC-UA & MTP Integration article for the full architecture, parser details, domain templates, and MQTT UNS bridge.

This site uses a cookie to remember your preferences. Analytics are anonymous and cookie-free. Privacy Policy