diniscruz.ai / writing / Knowledge Graphs

FAQ - Evolving Semantic Graphs and Ontologies with LLMs and MGraph-DB

By Dinis Cruz and ChatGPT Deep Research · · 24 min read

PDF LinkedIn post

Contents · 6 sections
  1. Q1: How does your semantic graph approach handle concept identifiers compared to OWL?
  2. Q2: How are the various confidence or relevance scores calculated and what do they mean?
  3. Q3: What kind of reasoning is used in your system? Do you rely on Description Logic like OWL, or take a stochastic/LLM-driven approach?
  4. Q4: How are the graphs produced by the LLM stored, managed, and evolved over time? What is the role of the knowledge base?
  5. Q5: What is meant by the concept of an "ontology of ontologies"?
  6. Conclusion

Introduction:

This FAQ-style white paper addresses key technical questions about Dinis Cruz’s approach to building and evolving semantic knowledge graphs using Large Language Models (LLMs) and the MGraph-DB platform. The focus is on how this architecture differs from traditional Semantic Web frameworks (like OWL ontologies) and how it leverages MGraph-DB’s unique design. We will discuss concept identification, confidence scoring, reasoning methods, graph lifecycle management, and the idea of an “ontology of ontologies.” Each section below poses a question and provides an expanded answer, highlighting the professional and business value of this approach for a technically literate audience.

Q1: How does your semantic graph approach handle concept identifiers compared to OWL?

Handling of Concept Identifiers: In a traditional OWL ontology, each concept is identified by a global IRI/URI – a strict, often lengthy identifier ensuring unambiguous reference across datasets. Dinis Cruz’s semantic graph approach takes a more flexible and organic path in assigning concept identifiers. Instead of predefining every concept with a fixed global ID, the system allows LLMs to propose concepts in natural language and uses context or mappings to resolve their identities over time. Key differences include:

Implications: This approach trades a bit of up-front formality for agility. It acknowledges that in practical, evolving systems, you often encounter the same idea described in different ways. Instead of insisting on one name from day one, it captures all the variations and then unifies them through analysis. MGraph-DB supports this by allowing duplicate or similar labels internally (since each node has its own GUID) and by making it easy to add equivalence links or merge nodes later. The result is a semantic graph that starts with the language people actually use and systematically moves toward consolidation, rather than starting with a rigid ontology that might not fit all future data. In summary, concept identifiers in this system are handled more fluidly than in OWL: they are initially simple and contextual, and they become persistent and globally unique through iterative refinement and mapping, rather than being fully predetermined.

Q2: How are the various confidence or relevance scores calculated and what do they mean?

Origin of Scores in the System: Throughout the LLM-driven graph pipeline, the system attaches numeric scores to certain outputs – these can represent confidence, relevance, or strength of a relationship. Unlike deterministic ontologies where a fact is either present or not, an LLM-generated knowledge graph benefits from having a gradation of certainty or importance. Here’s how these scores are produced and used:

Meaning and Usage of Scores: A score is only as meaningful as the process behind it. In this system, scores are used to prioritize and filter knowledge:

In summary, confidence and relevance scores in this system are quantitative signals of certainty and importance attached to graph elements. They are calculated either by the LLM (based on its internal assessment) or by auxiliary logic, and they mean to guide the flow of information – what gets emphasized, what gets secondary treatment, and what might require human confirmation. This adds an important layer of transparency and tunability to LLM-generated knowledge graphs: stakeholders can see why a piece of information was included (it had a high score), and they can decide to adjust the process (for instance, “only include articles with score >7” or “double-check any relationship below 0.8 confidence”). It’s a pragmatic way to blend the fuzzy intuition of AI with the precision needs of a business.

Q3: What kind of reasoning is used in your system? Do you rely on Description Logic like OWL, or take a stochastic/LLM-driven approach?

The reasoning in this architecture is largely LLM-driven and pragmatic rather than based on formal description logic. Traditional OWL ontologies utilize description logic reasoners to infer new facts (e.g., deducing class hierarchies, checking consistency, applying transitive properties automatically). In contrast, Dinis Cruz’s system leans on the power of LLMs combined with lightweight code-based rules for reasoning. Here is how it works:

In summary, the system favors an LLM-driven approach to reasoning, augmented by deterministic, rule-based checks and human oversight. It does not use OWL’s description logic engines for automated inference; instead, it uses the intelligence of the LLM to propose links and the rigor of code to enforce clear rules. This results in a solution that is both creative and flexible (thanks to AI) and controlled and explainable (thanks to a transparent pipeline). For a business context, this means we get the best of both worlds: rapid, AI-generated insights and a clear audit trail of how conclusions were reached, without the black-box complexity that formal semantic reasoners can introduce.

Q4: How are the graphs produced by the LLM stored, managed, and evolved over time? What is the role of the knowledge base?

Storage in MGraph-DB (Knowledge Base): Graphs produced by the LLM are not just ephemeral structures held in memory; they are persisted and managed in what we call the knowledge base. In this architecture, the knowledge base is essentially a collection of versioned graph data stored using MGraph-DB’s format (JSON). Concretely, when an LLM finishes a task (say extracting entities and relationships from an article or generating a mapping between two ontologies), the result is saved as a JSON file (or set of files) representing a graph – nodes, edges, properties, and even the LLM-generated metadata like scores. Because MGraph-DB is file-backed and schema-aware, each JSON snapshot can be checked into Git or cloud storage. This means:

Management and Evolution: Managing these graphs over time involves both automated processes and human-in-the-loop processes:

  1. Extraction Phase: LLM reads raw input (RSS feed, document, etc.) and outputs an initial graph (saved as JSON).
  2. Enrichment/Mapping Phase: Another LLM call or a script takes those graphs and links them, adding mapping nodes or edges (output another JSON).
  3. Curation Phase: Optionally, a human reviews the combined graph and edits it (either via a UI or by editing the JSON directly or through a Git commit).
  4. Utilization Phase: The final graph is loaded to answer questions or to generate a report.

Each phase’s output is stored, and because the pipeline is deterministic given the same inputs, we can always reproduce a graph version by rerunning the pipeline. This structure makes the graph evolution repeatable and debuggable. If a certain relationship appears incorrect, we can trace it to the stage (and even the prompt) that produced it and adjust that stage.

Role of the Knowledge Base: The knowledge base is the single source of truth for all derived knowledge. It’s not just a cache or temporary memory – it’s a persistent, queryable repository that applications and users can draw upon. For example, if a question arises (“Has concept X ever been linked to concept Y in our analyses?”), one can query the knowledge base (via an MGraph-DB query or even an NLP query if a layer is added) to find the answer. The knowledge base also serves to feed the LLM context for future operations. Instead of prompting the LLM from scratch each time, we can retrieve relevant portions of the knowledge base (graph subtrees) and provide them as context to the LLM for more informed output (this is similar to Retrieval-Augmented Generation).

Moreover, the knowledge base is designed to be human-friendly despite being machine-readable. Stakeholders can browse it – either by loading it into graph visualization tools or even by reading the structured JSON – to understand what knowledge has been captured. This transparency fosters trust in the system’s outputs because one can always drill down from an answer back to the source graphs and ultimately to the original data (provenance). In essence, the knowledge base built on MGraph-DB is the backbone of an explainable AI system: it holds all the intermediate knowledge that explains why the AI makes certain recommendations or conclusions.

In summary, graphs from the LLM are stored as JSON-based knowledge graphs in a version-controlled repository, managed through deterministic pipelines and MGraph-DB’s in-memory capabilities. The knowledge base acts as a growing, evolving library of interconnected data – curated by LLMs and humans – which can be efficiently updated, queried, and trusted over time. This approach ensures that as the system learns and accumulates information, it remains scalable, cost-efficient, and auditable, in stark contrast to treating the LLM as a one-off black box whose outputs vanish after use. Here, nothing is lost – every piece of inferred knowledge is captured and can contribute to future reasoning.

Q5: What is meant by the concept of an "ontology of ontologies"?

The term “ontology of ontologies” refers to a meta-level organization of knowledge – essentially a framework that manages multiple ontologies and the relationships between them. In Dinis Cruz’s strategy, this is a core principle to achieve scalability and flexibility in knowledge representation. Instead of enforcing one giant, “one-size-fits-all” ontology for everything (which is often untenable in practice), the idea is to allow many individual ontologies to coexist and then create an overarching structure that links them together.

In practice, an “ontology of ontologies” means:

MGraph-DB’s Role: MGraph-DB is particularly well-suited for an ontology of ontologies approach. Its file-based, modular nature means you can literally have one file per ontology and another file capturing the mappings. This modular storage mirrors the logical separation of domains. Traditional single-store graph databases struggle here: they often encourage throwing all data into one schema, which can get messy with overlapping terminologies. In our approach, since MGraph-DB is stateless and JSON-based, combining data from two ontologies is as simple as loading two JSON graph files into memory together. We don’t have to force their schemas to merge; we can operate on both and create a third structure (mappings) that references elements of each. Performance-wise, MGraph-DB can handle these multi-graph traversals in memory with type safety, and then we persist the combined insights if needed.

Benefits of an Ontology of Ontologies:

In summary, an “ontology of ontologies” is about managing knowledge at scale through federation rather than centralization. It is a strategy to keep graphs organic, modular, and easily evolvable. Dinis Cruz’s vision uses this concept to avoid the classic failure of big ontology projects (which often collapse under their own weight). With the help of MGraph-DB, this vision is implemented as a set of interconnected JSON-based graphs – each authoritative in its domain – tied together by a curated layer of mappings. This results in a semantic graph ecosystem that is both robust and adaptable, where explainability is preserved (one can always see which sub-graph a piece of knowledge came from) and yet the collective intelligence of all graphs can be utilized when needed.

Conclusion

Dinis Cruz’s approach to evolving semantic graphs and ontologies with LLMs and MGraph-DB represents a modern, agile take on knowledge management. It emphasizes flexibility, explainability, and human collaboration at every step. Concepts are introduced dynamically and identified through context before being consolidated – a contrast to the rigid upfront schema design of traditional OWL ontologies. Confidence and relevance scores are woven into the fabric of the graphs, providing a quantitative handle on the inherently uncertain outputs of AI and helping prioritize what the system (and its users) should pay attention to. Reasoning in this framework is driven by LLMs for intuitive leaps, backed by deterministic rules and human oversight to ensure reliability – effectively blending artificial intelligence with expert domain knowledge.

Crucially, MGraph-DB serves as the enabling technology that makes this all possible at scale. Its serverless, memory-first design allows knowledge graphs to be spun up, used, and torn down on demand, which aligns perfectly with cost-efficient cloud operations. By persisting data as JSON and integrating with tools like Git, it brings software engineering rigor (version control, testing, reproducibility) into the world of semantic graphs. This means the knowledge base is always auditable and improvements are trackable. Graph versioning and human-in-the-loop workflows ensure that the knowledge stays accurate, current, and aligned with business needs – the graphs improve over time instead of decaying.

The concept of an “ontology of ontologies” encapsulates the strategy of organizing knowledge in a federated yet connected way. It acknowledges the reality of complex enterprises: different groups speak in different ontologies, and that’s okay. By mapping these together, the organization gains a powerful “graph of graphs” – a holistic knowledge network that remains comprehensive without being monolithic.

In essence, the principles at play here – use LLMs where they excel, treat knowledge as code, prefer evolution over upfront perfection, and keep the human in the loop – come together to create a semantic graph ecosystem that is robust, scalable, and business-friendly. This approach turns knowledge graphs from static repositories into living, breathing assets: they grow with new information, adapt to new domains, and continually support decision-making through clear provenance and intelligent reasoning. For a LinkedIn-savvy audience of professionals, the message is clear: by combining cutting-edge AI with sound engineering (in the form of MGraph-DB and thoughtful ontological design), we can unlock the full potential of organizational knowledge, making it more accessible, actionable, and aligned with how people actually think and work.

Released under CC BY 4.0. First published on docs.diniscruz.ai; this page as markdown.