OrgPad logo

GraphRAG

Created by Lucie Pavlová

GraphRAG

Hybrid - Rule based first

Rule-first strategies use rules to identify high-confidence extractions and route only ambiguous cases to neural models for refinement

Levenshtein (edit) distance

Name variation and synonymy

Abbreviations, transliterations, historical names, and local names all refer to the same entity but have different surface forms.

Knowledge Interlinking and Entity Alignment

Most KGs are built from multiple sources, requiring interlinking: connecting entities across sources, merging data, and resolving conflicts.

Features might include: string similarity between names, overlap in attributes, similarity of descriptions (using embeddings), structural similarity (neighborhood overlap), and other signals

mentions (he, she, it, they),

Jaccard similarity (tokenoverlap)

Neural-first strategies

Neural-first strategies apply neural models to all cases, then use rules for post-processing validation and correction. Rules can check extracted facts for logical consistency

entity linking

Entity linking typically proceeds through four stages: (1) mention detection-identify entity mentions in text (handled by NER), (2) candidate retrieval-retrieve possible KG entities that could correspond to the mention using string similarity, alias lists, or retrieval models, (3) ranking and disambiguationscore candidates using context, entity popularity, and background knowledge, and select the highest-scoring candidate, (4) out-ofvocabulary handling-determine if the mention refers to no KG entity (an emerging or novel entity) or conflate similar entities incorrectly.

entity disambiguation

“Washington” could refer to the state, the capital city, the person George Washington, or other entities. Without disambiguation, a KG might incorrectly conflate different things.

Neural systems

Neural systems are flexible and adaptive, learning patterns from data, but require labeled training data and provide less explainability

Embedding-based approaches

Hybrid

Same neighborhood structure

Building KG from unstructured text

Ensemble approaches

Ensemble approaches combine multiple extraction methods, scoring candidates based on agreement.

knowledge refinement

knowledge refinement - handling contradictions, conflicts, and quality assurance

instance-based matching

Ruled based system

Rulebased systems are interpretable, efficient, and precise for cases they explicitly handle, but lack coverage and struggle with novel phenomena.

Information extraction

NLP (Natural Language Processing)

Temporal reasoning

“Albert Einstein worked at Princeton from 1933-1955”. Querying temporal linked data-“Who was at Princeton in 1940?”-requires temporal reasoning.

Struktura DP

Consistency

Consistency assesses whether the KG violates logical constraints or contains contradictory facts.

Question-answering system

Decision support tool

LLM Capabilities for Extraction tasks

LLMs like GPT-4, Claude, and PaLM exhibit emergent capabilities for structured information extraction that weren’t explicitly taught during training but emerge from their general language understanding.

Coverage

what fraction of facts in the domain are captured by the constructed KG.

domain-specific vocabulary in prompts

Named Entity Recognition

Ontologie

Search engine

Relation extraction

Event extraction

Event extraction is more complex than entity or relation extraction because events have temporal dimensions, involve multiple participants in structured roles, and often require understanding causality and temporal ordering

Reasoning and multi-step extraction

Recommendation system

Populate KG nodes

Knowledge representation

Populate KG edges

Domain-specific relation extraction

Domain-specific relation extraction faces additional challenges. For example, in biomedical text, recognizing protein-interaction relations requires specialized knowledge and terminology understanding.

Subject

Predicate

Object

ML (Machine learning)

FAbric IQ ontologie

jaký je tým v Microsoftu, koupený startup?

Expert curation

Odlišovat koncepty a jednotliviny

Temporal and dynamic properties

Temporal and dynamic properties become necessary when facts change over time. “John is CEO of Apple” is true from 2011- 2023 but false in 2010 and 2024.

Each approach has tradeoffs: snapshots lose information about what changed; valid-time attributes proliferate attributes and complicate queries; temporal properties require special reasoning; event-based approaches add complexity but capture transitions explicitly

Active learning

Active learning systems rank uncertain extractions by confidence (using model uncertainty, disagreement between ensemble members, or other signals) and present top uncertain examples to humans for labeling. This focuses human effort on cases where learning is most valuable, improving the system more efficiently than random sampling.

Learning from human feedback

feedback is collected and used to continuously improve the system

Co jde do kontextu když používám KG n-hop načítání informací

RDF Triple

Every single piece of information in an RDF database is broken down into a statement consisting of three parts:

Examples of RDF Triples:

URI

Uniform Resource Identifier

Crowedsourcing

leverages non-expert human workers for verification and curation tasks.  Multiple workers can validate the same fact, providing confidence scores from inter-rater agreement.

Structured data

OWL DL (DescriptionLogics)

Human in the loop

integrate human judgment into extraction and curation loops, leveraging the complementary strengths of automated systems (speed, consistency) and humans (reasoning, judgment, domain expertise).

Ontology learning from text

LLOD

Linquivistic …

Turtle(.ttl)

Data representation format

Domain / Range constraints

JSON-LD (.jsonld)

RDF Formats (Syntaxes)

serialized in multiple syntax

Turtle

Individuals (Instances)

These are the actual real-world data points or "objects" belonging to classes.

Transitive

If Prague isLocatedIn Czechia and Czechia isLocatedIn Europe, then Prague isLocatedIn Europe is automatically implied.

Recall

extracting all entities

Symmetric

If Alice isSiblingOf Bob, then Bob isSiblingOf Alice is automatically implied.

Ontology merging and alignment

combines ontological structures from multiple sources, a critical need in enterprise KG construction where different departments or data sources may have partial ontologies. Given ontologies A and B with potentially overlapping coverage, alignment determines whether entities/classes/relations in A correspond to entities/classes/relations in B

RDF/XML (.rdf)

RDF

Resource Description Framework.  RDF is an abstract framework, meaning it is a way of thinking about data, not a specific file format.

Automatic and semi-automatic ontology construction

automated and semi-automated approaches to ontology construction that reduce expert burden while maintaining quality

Data Governance

Inverse

You can state that hasEmployer is the inverse of hasEmployee. If Google hasEmployee Bob, the system knows Bob hasEmployer Google.

Crowdsourced ontology design

Data product

false positives

N-Triples (.nt)

SHACL

Shapes Constraint Language,   allows you to enforce strict business rules on top of your flexible graph database. 

JSON-LD schemas

OWL

Web Ontology Language is a formal, logic-based language designed to define and instantiate Web ontologies.

Properties (Relationships)

Object Properties

Link an individual to another individual (e.g., hasEmployee, isMarriedTo).

Cross-document Entity traversal

Ontology enrichment and extension

takes an existing ontology and identifies missing classes or relations

Semantic model

Sparql

Data Properties

Link an individual to a specific data value (e.g., hasAge, hasTaxID).

Inheritance

LLM-based ontology generation

Long term organizational memory

Taxonomy

Descrition logic

This separation, originating from Description Logics, enables reasoning: given a set of rules in the TBox, we can derive new facts (inferences) from known ABox facts

Gremlin

Classes (Concepts)

The abstract categories or "nouns" of the domain.

Query language

Hierarchies and taxonomies

Hierarchies and taxonomies-subsumption relationships where one class is a more specific type of another

FOAF

Dublin Core

Unstructured data

Business vocabulary

Cypher

RDFS

RDF Schema (RDFS) provides simpler schema representation with basic class and property hierarchies.

Formal ontology representation languages

provide the syntactic frameworks for expressing ontologies.

BIBO

bibliographic

FIBO

Schema.org

Noe4J

SW

RDF KG

Reusability

ABox

(Assertion Box) contains the actual facts-entity instances, property values, and relations

E.G.

Interoperability

Use standard vocabularies-employ shared ontologies like Dublin Core (for publication metadata), FOAF (Friend-of-a-Friend, for people),

Standard vocabularies and schema

LangChain

LangChain is an open-source development framework designed to simplify the creation of applications that use Large Language Models (LLMs).

LangGraph

LangGraph is an open-source orchestration framework developed by LangChain Inc. It is specifically designed for building production-grade, stateful, multi-agent AI applications using a graph-based structure.

LangGraph treats the workflow as a standard graph composed of:

  1. Nodes: Python functions that perform actions (e.g., calling an LLM, searching a database, running a code snippet).
  2. Edges: The paths that connect nodes. These can be conditional edges, allowing the graph to dynamically decide which node to go to next based on the LLM's output.
  3. Cycles: The superpower of LangGraph. It natively allows the system to route data backwards (e.g., Node A calls an LLM $\rightarrow$ Node B checks the code for errors $\rightarrow$ If errors exist, it loops back to Node A to try again).

Human-in-the-loop

You can configure the graph to completely freeze its state right before a specific node executes, wait indefinitely for a human to review, edit, or approve the data, and then resume execution seamlessly.

TBox

TBox (terminology box) represents the schema-the classes, relations, and constraints defining what kinds of facts can exist.

TBox (Terminology Box) or schema defines the ontology-what classes, properties, and constraints govern valid facts in the knowledge graph [29, 42]. Publishing a well-engineered TBox is crucial for KG reusability and external integration: external users must understand the KG structure to query effectively and integrate external data.

Ontology design patterns

Named Entity Extraction

FAIR Data

FAIR Data stands for data that meet four foundational principles to make them more useful for humans and computers.

The acronym stands for:

In short, it is a global standard for good data management, especially in science and research, ensuring that digital assets are shared responsibly and efficiently.

Neptune

Constraints and axioms

Constraints and axioms-logical rules governing valid facts (cardinality constraints like “a Person can have at most one birthDate”, disjointness

Ontology advantages

Property graph

Protégé

KG Visualization

Domain ontology

Mapping

Static data

E.g. Patient name, surname, date of birth. NOt changing very often

reasoning and consistency checking

formal languages enable automatic reasoning and consistency checking but require expertise to use correctly

Fabric IQ Ontology

Microsoft Azure Fabric tool. Fabric IQ is designed to turn your data platform into an "Intelligence Platform" by overlaying a business-friendly Ontology layer and automated Knowledge Graph on top of your physical data (stored in OneLake, Lakehouses, or Data Warehouses).

Data types

Ontology

An ontology is a formal representation of knowledge that explicitly defines the concepts, relationships, and constraints within a specific domain. It acts as a semantically rich specification used to structure data when complex reasoning and system interoperability are required. In the context of Knowledge Graphs, ontologies serve as the foundational blueprints that guide graph construction, enabling a consistent and hierarchical representation of information.

An ontology is a formal, explicit specification of a shared conceptualization. In the context of KGs, an ontology defines: (1) the classes (entity types) that exist in the domain, (2) the relations that can connect entities, (3) properties and attributes of entities, (4) constraints and rules that govern valid facts, and (5) hierarchies of concepts (e.g., “Person” is a parent class of “Employee” and “Patient”).

Ontology Tools

Structured data source

Time series

E.g. information from life function monitor, it sends the new value every 10 seconds

Agents

Persistent Shared State

Named Entity Disambiguation (NED)

Ontologies resolve ambiguity by linking generic mentions in text (e.g., "Zika") to precise canonical entities in a knowledge base (e.g., distinguishing between "Zika virus" and "Congenital Zika syndrome")

Multi-Agent Orchestration

Tom Sawyer Software

Local Search (For Entity-Specific Queries)

When a user asks about a specific concept or person, embed the user query to perform a vector similarity search to find the closest starting nodes. Then, traverse the graph to retrieve that node's neighbors, associated relationships, and original text chunks

Knowledge graph

Ontology defines the schema of KG

Ontologies form the schema layer of knowledge graphs, defining what kinds of entities, relations, and facts can exist and constraining the structure of extracted information

Tools

Ontology enhancing

Multi-Hop Reasoning

Data validation

We can define the rules in ontology and verify if the extracted entities are complained to this rules.

Semantic model

Power BI

linked data registries

-central directories listing available linked data KGs

false negatives

Global Search (For Thematic Queries)

When a user asks a broad question (e.g., "What are the main themes in this dataset?"), use a map-reduce approach. The system passes the pre-generated community summaries to the LLM to generate partial answers in parallel (the map step), and then aggregates them into a final comprehensive response (the reduce step)

KG Retriever

Data agent is using the ontology find the relevant data sources and build the query

Conceptual and Structured Search

Users can perform structured searches that navigate ontology paths to retrieve implicitly connected information across multiple documents

Generating the ontology in Fabric IQ from Power BI Semantic model

community portals

-domain-specific portals listing relevant KGs

Map reduce

Google KG

Precision

extracting only correct entities

GraphRAG

F1-score

search engines for RDF

-systems that index linked data and enable keyword search

Publicly known KGs

Text2Cypher

If it requires strict data aggregations or counts (e.g., "How many contracts expire in 2026?"), implement a tool that allows the LLM to translate natural language into a formal Cypher database query based on the graph schema

Search metrics

RAG (Retriaval Augmented Generation)

A standard RAG pipeline works like an open-book exam. When you ask a question, a retriever fetches relevant documents from a database and pastes them into a prompt for the LLM to read.

"just enough semantics"

This pragmatic method selects only the necessary ontology features to solve current business problems, allowing the ontology to expand organically over time

Data agent

Agent serves as an AI-driven "virtual data analyst" that can translate natural language into technical data operations.

Zero-shot prompting

Zero-shot means you ask the LLM to perform a task without giving it any examples of the expected input and output. You rely entirely on the model's pre-existing knowledge and its ability to understand instructions.

Wikipedia KG

Search

Chunk

In Retrieval-Augmented Generation (RAG) and vector search pipelines, the industry standard sweet spot for a typical chunk size is 256 to 512 tokens (roughly 1,000 to 2,000 characters), usually paired with a 10% to 20% chunk overlap (about 50 to 100 tokens).

Choosing a chunk size requires balancing a fundamental trade-off: semantic granularity (precision) versus surrounding context (recall).

Vector search

Blueprint for Knowledge graphs

Ontologies act as the foundational reference schemas and standard vocabularies for building Knowledge Graphs (KGs). Ontologies introduce complex logical interconnections—such as specifying synonyms, mutually exclusive concepts, and cardinality restrictions. By acting as an intermediary, an ontology allows systems to integrate and harmonize semantically heterogeneous information from diverse, siloed data sources into a unified, coherent view.

Prompting

GDELT Project

https://www.gdeltproject.org/

Semantic search

Instead of looking for exact keyword matches, a search engine converts your query into an embedding and finds documents with the closest vector coordinates. This allows it to find an article about "felines" even if you searched for "cats."

Cosine similarity

This measures the angle between two vectors and is considered the best fit for text-based applications like chatbots. It returns a score between 0 and 1, where 0 means the texts are completely different and 1 means they are identical in meaning

LLM

Large Language Model

Costs

Few-shot prompting

Few-shot means you provide the model with a few high-quality examples (usually between 2 to 5) of the task being performed correctly before asking it to do the actual task.

Knowledge acquisition

Collecting information from data sources, the environ ment, or domain experts

Intelligent autonomous system

Caching and memoization

Synonyms

Embeddings

a long string of numbers (a vector),  Instead of just treating words as arbitrary symbols, embeddings capture the semantic relationships between them.  Embeddings solve this by placing items into a high-dimensional vector space (often hundreds or thousands of dimensions wide). In this space, each dimension represents a specific, abstract feature or characteristic. Because embeddings capture geometric relationships based on meaning, you can actually perform mathematical equations on words:

King - Man + Woman = Queen

Embeddings solve both problems: They compress massive vocabularies into dense, fixed-size vectors (e.g., 768 or 1536 numbers) while preserving the shared meaning between words.

Chain of thought (CoT)

Chain of Thought (CoT) is an LLM prompting technique that forces a model to output its step-by-step reasoning process before delivering a final answer.

By breaking complex problems down into intermediate logical steps, it significantly improves the model's accuracy on math, logic, and multi-step tasks.

Max tokens

LLMs are frozen in time

They don't have access to your private data, local files, or real-time internet data.

Reasoning

Converting acquired knowledge into actionable expertise

Context window

The context window is essentially the "short-term memory" or the maximum capacity of the Large Language Model (LLM) at the heart of the system. It dictates how much total text—including the prompt, the retrieved documents, and the model's generated response—the LLM can process in a single interaction.

Popular LLM Context Window Sizes (As of 2026)

Total tokens the AI can “see” (your prompt + its response combined)

Internal knowledge for popular entities

There is internal knowledge in LLM models, when the entity or information was part of training data. LMs naturally fall back on their pre-trained parametric memory for well-known subjects.

Intelligent system

Intelligent advisory system

Word2Vec

model to convert raw words into dense, mathematically meaningful vectors (embeddings).

critical application

where hallucination is problem, medical, legal, ...

LLM Configuration

Temperature

"Shot term memory"

Top-K

Top-P

Reasoning

Hallucination

LLMs generate plausible-sounding facts not actually present in the source text, inventing details or conflating information from their training

Training data contamination

Cost and latency

The larger the context window you fill, the more expensive and slower the generation becomes.

Context window Pitfalls

Answering from general knowledge not from context window

the model might output training knowledge rather than extracting from the provided text.

Inductive reasoning

abstracts patterns from available observations.  LLMs can use their probabilistic reasoning capabilities to generate contextually relevant suggestions even when critical information is missing

Quality-cost tradeoffs

Vulnerability to noise and redundancy

extracting only from provided text

Solving hallucination

Ensemble and consensus-based approaches

reduce hallucination through redundancy. Prompt multiple LLM instances with slightly different prompts.  Facts appearing in multiple outputs are likely correct;  ensembling costs are higher: multiple model calls and integration complexity. This approach is practical for high-stakes extraction where hallucination risk is unacceptable.

Deductive reasoning

require complete knowledge bases and explicit rules,

"Lost in the Middle" Phenomenon

Just because an LLM can accept 128k tokens doesn't mean it reads all of them equally well. Studies have shown that LLMs are great at recalling information at the very beginning or the very end of their context window, but they tend to overlook or "forget" details buried right in the middle of a massive chunk of text.

Confidence and uncertainty estimation

Some LLMs can output confidence scores or probability estimates, but these are not always well-calibrated

Explainability and auditability

Requiring citations and grounding

requesting explanations

Knowledge base

Chunking

Large documents are broken down into smaller, digestible pieces (e.g., 500-token chunks) before being stored in the vector database.

Strategies to optimize Context window

ensemble methods

-use multiple models to identify common vs. model-specific decisions

attribution-require

the LLM to cite supporting text

Linked data

Linked Data is a vision for the semantic web where knowledge is published in standardized, interconnected form, enabling machines to discover, integrate, and reason over distributed data

temporal validity

temporal validity-when each fact was true (startDate, endDate, creation timestamp), (4) extraction method-how the fact was obtained

Open World

Reranking

A secondary model re-orders the retrieved chunks to ensure the absolute most relevant information is placed at the very beginning or end of the context window to combat the "lost in the middle" effect.

Using Implicit knowledge when depricated

should KGs include only explicit knowledge (stated in text) or implicit knowledge that can be inferred?

Closed World

Top-K Retrieval

The system only retrieves the top $K$ most relevant chunks (e.g., the top 5 or 10 chunks) to feed into the context window, rather than sending entire documents.

Summarization strategies

Traditional vector similarity retrieval can sometimes overwhelm fixed context windows with redundant or loosely related text. Packing the context window with too much noise can confuse the LLM and degrade the quality of the answer

Implicit knowledge

comes from the LLM’s training (background knowledge)

Inference

LLMs naturally infer implicit knowledge. From “John is the CEO of Apple”, inferring “John works for Apple”

Definovat co je Knowledge Base v kontextu agentního řešení

Knowlegde base v tomoto smyslu je nestrukturovaná skupina dokumentů. Nebo lightway strukturovaná. Spadá pod to i taxonomie. Neotologicky definovaná ZB.