Knowledge Graph Reasoning Made Simple [3 Technical Methods & How To Handle Uncertanty]

by | Feb 5, 2024 | Artificial Intelligence, Data Science, Machine Learning

What is Knowledge Graph Reasoning?

Knowledge Graph Reasoning refers to drawing logical inferences, making deductions, and uncovering implicit information within a knowledge graph. A knowledge graph is a structured representation of knowledge, typically organized as a graph where relationships connect entities, and each entity and relationship have associated attributes.

In simpler terms, knowledge graph reasoning involves using the existing information in a knowledge graph to derive new insights, answer queries, or make predictions that may not be explicitly stated but can be logically inferred from the available data. This process is essential for enhancing the capabilities of artificial intelligence systems, enabling them to go beyond basic data retrieval and understand the underlying relationships and context in the information they process.

Several types of reasoning can be applied to knowledge graphs:

  1. Deductive Reasoning: Drawing specific conclusions from general information. For example, if a knowledge graph states that all mammals are animals and a particular entity is a mammal, deductive reasoning would conclude that the entity is also an animal.
  2. Inductive Reasoning: Making generalizations based on specific instances. In the context of a knowledge graph, this might involve predicting or generalizing new relationships between entities based on observed patterns in existing data.
  3. Abductive Reasoning: Inferring the best explanation for a given set of observations. A knowledge graph could involve hypothesizing relationships or attributes for entities that best explain the observed data.
types of reasoning; deductive reasoning, inductive reasoning and abductive reasoning

Knowledge graph reasoning is crucial for various applications, including semantic search, question-answering systems, recommendation engines, and more. It enables AI systems to go beyond keyword matching and retrieve information contextually and meaningfully. Advanced reasoning techniques, such as rule-based reasoning and machine learning-based reasoning, are often employed to enhance the accuracy and efficiency of knowledge graph reasoning in different domains.

Technical Approaches to Knowledge Graph Reasoning

Knowledge graph reasoning (KGR) is a crucial aspect of knowledge representation and reasoning (KRR) that enables the extraction of implicit knowledge from explicit knowledge stored in knowledge graphs. KGR can derive new facts, identify relationships between entities, and make predictions by employing logical rules and inferences. Various technical approaches have been developed to implement KGR, each with strengths and limitations.

Symbolic-based Reasoning

Symbolic-based reasoning approaches utilize formal logic systems, such as first-order logic (FOL), to represent knowledge and perform reasoning. FOL provides a rigorous mathematical foundation for expressing complex relationships and reasoning rules. Common techniques include:

  • Horn Clause Logic: Focuses on Horn clauses, a subset of first-order logic expressions well-suited for efficient reasoning.
  • Prolog (Programming in Logic): A declarative programming language based on Horn clause logic, widely used for implementing KGR tasks.
  • Answer Set Programming (ASP): A declarative programming paradigm that extends Prolog to handle non-monotonic reasoning and incomplete knowledge.

Embedding-based Reasoning

Embedding-based reasoning approaches represent knowledge as vectors in a high-dimensional space, capturing the semantic relationships between entities and relations. These vectors are then used to perform reasoning tasks, often using machine learning techniques.

Popular approaches include:

  • Neural Tensor Networks (NTNs): Employ neural networks to learn distributed representations of entities and relations, enabling reasoning on complex knowledge graphs.
  • Graph Neural Networks (GNNs): Utilize GNNs to propagate information through the graph structure, capturing contextual information and enabling reasoning on incomplete knowledge.
  • Recurrent Neural Networks (RNNs): Employ RNNs to handle sequential data, such as temporal relationships in knowledge graphs, for reasoning tasks.

Mixed Reasoning Approaches

Mixed reasoning approaches combine symbolic and embedding-based methods to leverage the strengths of both approaches. This allows for reasoning on both structured and unstructured knowledge, improving the overall performance of KGR systems. Some examples include:

  • Hierarchical Reasoning: Combines symbolic reasoning with embedding-based reasoning techniques to handle complex relationships and incomplete knowledge.
  • Rule-based Reasoning with Embeddings: Incorporates embedding representations into rule-based reasoning systems, enhancing their ability to handle real-world knowledge.
  • Hybrid Reasoning Systems: Develop hybrid systems that seamlessly integrate symbolic and embedding-based reasoning techniques to tackle diverse KGR tasks.

The choice of the KGR approach depends on the specific application requirements and characteristics of the knowledge graph. Symbolic-based approaches may be suitable for large, structured knowledge graphs due to their computational efficiency and formal reasoning capabilities. For knowledge graphs with complex relationships and uncertainty, embedding-based approaches can provide a more flexible and expressive representation. Mixed reasoning approaches offer a promising avenue for combining the strengths of both paradigms.

Examples of Knowledge Graph Reasoning

Here are some examples of each type of knowledge graph reasoning approach:

Symbolic-based Reasoning:

  • Answering a simple question about a knowledge graph: “Which city is the capital of France?” This question can be answered by using a symbolic-based reasoning approach that searches the knowledge graph for the entity “France” and then follows the relationship “capitalOf” to find the corresponding entity “Paris.”
  • Computing the shortest path between two entities in a knowledge graph: This can be solved using a symbolic-based reasoning approach that employs Dijkstra’s algorithm to traverse the graph and find the shortest path between the two entities.
  • Identifying all entities in a knowledge graph with a particular property: This can be accomplished using a symbolic-based reasoning approach that repeatedly follows relationships from each entity in the graph until it finds a path to an entity that satisfies the desired property.
knowledge graph python example plot with nodes and edges

Simple knowledge graph in Python with entities and relationships, which can answer the question “Which city is this person born in?”

Embedding-based Reasoning:

  • Recommending products to a user based on their purchase history: This can be performed using an embedding-based reasoning approach that learns a representation of the user’s preferences and then uses that representation to identify products similar to the ones they have previously purchased.
  • Detecting fraud in financial transactions: This can be accomplished using an embedding-based reasoning approach that learns a representation of each transaction and then identifies outliers based on their similarity to other transactions.
  • Classifying documents based on their content: This can be performed using an embedding-based reasoning approach that learns a representation of each document and then uses that representation to classify the document into a predetermined category.
Content-Based Recommendation System where a user is recommended similar movies to those they have already watched

Knowledge graphs can be used for content-based recommendation systems.

Mixed Reasoning Approaches:

  • Answering a complex question about a knowledge graph requiring reasoning about structured and unstructured data: This can be tackled using a mixed reasoning approach that combines symbolic reasoning with embedding-based reasoning to extract relevant information from structured knowledge bases and unstructured text documents.
  • Predicting the future stock price of a company: This can be accomplished using a mixed reasoning approach that utilizes embedding-based reasoning to identify patterns in historical stock data and symbolic reasoning to incorporate external factors such as economic indicators and political events.
  • Developing a virtual assistant that can understand natural language and respond intelligently: This can be addressed using a mixed reasoning approach that combines symbolic reasoning with embedding-based reasoning to parse natural language queries, extract relevant information from knowledge bases, and generate appropriate responses.
knowledge graph reasoning can be used to predict the future stock price of a company

Deep Dive Into Embedding-Based Reasoning

Foundations of Embedding-based Reasoning

In artificial intelligence, embedding-based reasoning is a potent approach, fundamentally altering how entities and relationships within a knowledge graph are represented. Departing from the traditional discrete symbols used in knowledge graphs, embedding-based reasoning transforms these symbols into continuous vector spaces, assigning numerical values to entities and relationships.

Capturing Semantic Relationships

The crux of embedding-based reasoning lies in its ability to capture the nuanced semantic relationships between entities. Unlike symbolic representations, embeddings offer a more nuanced understanding of the similarities and meanings associated with entities and relationships, providing a richer context for reasoning tasks.

Diverse Embedding Models

To achieve this, various embedding models come into play, each with unique characteristics. Models like TransE, TransR, ComplEx, and DistMult are designed to learn embeddings that preserve the structure and semantics of the underlying knowledge graph.

Inference Capabilities in Vector Space

The raison d’être of embedding-based reasoning is its capacity to perform inference operations directly in the embedding space. By manipulating vectors, the model can make logical deductions, predict missing links in the form of triple completion, and identify patterns that may not be explicitly stated in the original data.

Applications and Scalability

Embedding-based reasoning finds application in diverse scenarios, from triple completion to link prediction. Its scalability and efficiency make it suitable for representing vast knowledge graphs and facilitating downstream tasks such as semantic search, recommendation systems, and question-answering.

link prediction in graphical neural networks

Challenges and Ongoing Research

Despite its success, embedding-based reasoning encounters challenges, including the complexity of capturing intricate relationships and addressing issues like the cold-start problem for new entities. Ongoing research explores extensions, such as temporal embeddings, to incorporate temporal information for reasoning about evolving relationships over time.

Transfer Learning and Versatility

Transfer learning is crucial in embedding-based reasoning, allowing pre-trained embeddings to be fine-tuned or transferred to related knowledge graphs. The versatility of embedding-based reasoning extends beyond knowledge graphs, reaching into domains like natural language processing, where word embeddings capture semantic relationships between words.

Evaluation Metrics and Interpretability

The performance of embedding-based reasoning models is assessed using accuracy, precision, recall, and F1 score metrics. Understanding the interpretability of learned embeddings is critical for comprehending the reasoning process.

Future Directions and Open Questions

As the field progresses, embedding-based reasoning remains a focal point of research. Open questions persist around handling uncertainty, improving interpretability, and developing models that can adapt to evolving knowledge graphs. The continuous exploration of these dimensions ensures that embedding-based reasoning remains at the forefront of advancing knowledge representation and reasoning in artificial intelligence.

What is Query2box?

Query2box is an embedding-based framework for reasoning over arbitrary queries with conjunctions, disjunctions, and existential quantification in massive and incomplete knowledge graphs (KGs). It is based on embedding queries as boxes (i.e., hyper-rectangles) in a vector space, where a set of points inside the box corresponds to a set of answer entities of the query.

Query2vec is an example of knowledge graph reasoning. Conjunctive queries: Where did Canadian citizens with Turing Award Graduate?

Query2box example: source Stanford

Key Features of Query2box:

  • Efficient query embedding: Query2box embeds queries as boxes by leveraging the principle of feature hashing.
  • Handling disjunctions: Query2box addresses the challenge of handling disjunctions in queries by transforming them into a Disjunctive Normal Form (DNF).
  • Scalability: Query2box is scalable to large and incomplete KGs due to its efficient embedding and box-based reasoning approach.

Applications of Query2box:

  • Query answering over KGs: Query2box can answer complex logical queries over large-scale knowledge graphs.
  • Entity recommendation: Query2box can recommend relevant entities to users based on their queries.
  • Knowledge graph completion: Query2box can complete missing links in knowledge graphs by reasoning over existing knowledge and queries.

Comparison with Other Approaches:

Query2box compares favourably to other approaches for reasoning over knowledge graphs in several aspects:

  • Efficiency: Query2box is more efficient than traditional query processing approaches and can handle large and incomplete KGs.
  • Accuracy: Query2box achieves high accuracy in answering complex logical queries over knowledge graphs.
  • Scalability: Query2box is scalable to large-scale knowledge graphs and can be applied to real-world applications.

Overall, Query2box is a promising approach for reasoning over knowledge graphs with complex queries. It is efficient, accurate, and scalable, making it a valuable tool for various knowledge graph applications.

8 Ways to Handle Uncertainty in Knowledge Graph Reasoning

Handling uncertainty in knowledge graph reasoning is critical, as real-world data often contains incomplete or uncertain information. Dealing with uncertainty ensures that knowledge graph reasoning systems can provide more accurate and reliable results. Here are some strategies for handling uncertainty in knowledge graph reasoning:

1. Probabilistic Graphical Models

Incorporate probabilistic graphical models like Bayesian networks into knowledge graph reasoning. These models allow for the representation of uncertainty by assigning probabilities to different states of entities and relationships.

Application: Probabilistic graphical models are beneficial when there’s uncertainty in the presence or absence of relationships between entities.

2. Fuzzy Logic

Integrate fuzzy logic, which allows for representing partial truths or degrees of membership. This approach is suitable when dealing with imprecise or vague information in the knowledge graph.

Application: Fuzzy logic is valuable for scenarios where the exact boundaries of relationships or entity attributes are not well-defined.

3. Uncertainty-aware Embeddings

Enhance knowledge graph embeddings to model uncertainty explicitly. This can be achieved by associating confidence scores with embeddings or incorporating probabilistic embeddings.

Application: Uncertainty-aware embeddings are beneficial when the certainty of relationships or entity associations is variable and needs to be considered during reasoning.

4. Rule-Based Reasoning with Confidence Levels

Combine rule-based reasoning with confidence levels attached to rules. This allows for a more nuanced understanding of the reliability of regulations in the presence of uncertainty.

Application: When specific rules may have higher or lower reliability based on the quality or completeness of data, this approach helps make more informed decisions.

5. Monte Carlo Methods

Employ Monte Carlo methods to estimate uncertainty. This involves sampling possible scenarios from a distribution of uncertainties to understand the range of possible outcomes.

Application: Monte Carlo methods can be used for reasoning tasks where uncertainty arises due to the variability in available data or when dealing with noisy information.

6. Ontological Reasoning with Uncertainty

Extend ontological reasoning to handle uncertainty by associating confidence levels with ontological concepts. This allows for more flexible and adaptive reasoning.

Application: In scenarios where the ontology contains uncertain or evolving concepts, this approach helps accommodate changes and updates.

7. Expert Systems and Human Feedback

Combine automated reasoning with human feedback or expert systems. Integrate mechanisms for users or domain experts to provide feedback on uncertain statements in the knowledge graph.

Application: In situations where specific knowledge is subject to change or interpretation, incorporating human feedback helps refine the reasoning process.

8. Dynamic Updating of Certainties

Implement a system that dynamically updates certainties as new information becomes available. This ensures that the knowledge graph reasoning system adapts to evolving data and uncertainties.

Application: This is particularly useful in dynamic environments where the knowledge graph is subject to frequent updates and changes.

Handling uncertainty in knowledge graph reasoning is a complex but essential aspect of building robust and reliable systems. The choice of method depends on the specific characteristics of the uncertainty present in the data and the requirements of the reasoning tasks.

What Are Some Real-world Examples of Knowledge Graph Reasoning Applications?

Knowledge graph reasoning finds application in various real-world scenarios, enhancing systems’ capabilities to extract insights, answer complex queries, and make informed decisions. Here are some notable examples:

  1. Semantic Search Engines: Knowledge graph reasoning is employed in semantic search engines to provide more contextually relevant search results. These systems can deliver more accurate and meaningful search results by understanding the relationships between entities and the query context.
  2. Question Answering Systems: AI-driven question-answering systems utilize knowledge graph reasoning to comprehend the semantics of questions and retrieve precise answers. This is particularly valuable in domains where information is interconnected, such as medical literature or legal documents.
  3. Recommendation Systems: Knowledge graph reasoning enhances recommendation systems by considering user preferences and item relationships. For example, in e-commerce, a system can recommend products based on the implicit relationships between items frequently purchased together.
  4. Healthcare Decision Support: In healthcare, knowledge graph reasoning aids in clinical decision support systems. It can analyze patient records, medical literature, and treatment protocols to recommend personalized treatment plans or identify potential drug interactions.
  5. Financial Fraud Detection: Knowledge graph reasoning is used in financial systems to detect fraud by analyzing the relationships between transactions, accounts, and entities. Unusual patterns or connections that may indicate fraudulent activities can be identified through reasoning.
  6. Biomedical Research: Knowledge graph reasoning is applied to analyze complex relationships between genes, proteins, diseases, and drugs. It aids researchers in understanding the underlying mechanisms of diseases and identifying potential targets for drug development.
  7. Supply Chain Optimization: In supply chain management, knowledge graph reasoning helps optimize logistics and inventory decisions by considering relationships between suppliers, products, and distribution networks. This ensures more efficient and responsive supply chain operations.
  8. Smart Cities and IoT: Knowledge graph reasoning plays a role in smart cities and Internet of Things (IoT) applications. It can analyze data from various sensors and devices to optimize traffic flow, energy consumption, and other city services by reasoning about the relationships between different entities in the urban environment.
  9. Legal Information Retrieval: Knowledge graph reasoning aids in legal information retrieval by understanding the connections between legal concepts, cases, and statutes. This enables more precise and context-aware searches within legal databases.
  10. Educational Systems: In education, knowledge graph reasoning can be applied to personalize learning paths for students. Educational systems can offer tailored recommendations and interventions by understanding the relationships between topics, student performance, and learning resources.

These examples demonstrate the versatility of knowledge graph reasoning across diverse domains, showcasing its ability to extract valuable insights and facilitate intelligent decision-making in various real-world applications. As technology advances, the impact of knowledge graph reasoning is likely to expand further into new domains and industries.


In this blog post, we delved into the intriguing world of knowledge graph reasoning, uncovering its essence, types, and pivotal role in advancing artificial intelligence systems. The journey started with a foundational understanding of knowledge graphs as structured representations of information, where entities are connected by relationships, forming a web of interconnected knowledge.

Knowledge graph reasoning emerged as the critical process of drawing logical inferences, making deductions, and unveiling implicit information within these knowledge graphs. This reasoning capability is fundamental for empowering AI systems to transcend basic data retrieval and comprehend the intricate relationships and contexts within the information they process.

The blog post dissected various types of reasoning, from deductive and inductive to abductive reasoning, showcasing how knowledge graph reasoning can unfold. These reasoning types equip AI systems with the ability to answer complex queries, make predictions, and derive new insights from the existing information within a knowledge graph.

Technical approaches to knowledge graph reasoning were explored, highlighting the distinction between symbolic-based reasoning, embedding-based reasoning, and hybrid approaches. Each approach brings unique strengths, from the formal logic systems of symbolic reasoning to the vector space representations of embedding-based reasoning. The choice of approach depends on the application requirements and the characteristics of the knowledge graph at hand.

Examples illuminated how each reasoning approach manifests in real-world scenarios, from answering questions about knowledge graphs to recommending products based on user queries. The versatility of these approaches was evident in tasks ranging from document classification to predicting stock prices, showcasing their applicability across diverse domains.

Query2box, an embedding-based framework, made a special appearance, offering an efficient solution for reasoning over queries with conjunctions, disjunctions, and existential quantification in massive and incomplete knowledge graphs. This highlighted the continuous evolution and innovation within the field, addressing specific challenges with scalable and efficient solutions.

Handling uncertainty in knowledge graph reasoning emerged as a central theme, and strategies were outlined, ranging from probabilistic graphical models to fuzzy logic and dynamic updating of certainties. These strategies equip knowledge graph reasoning systems with the resilience to navigate the complexities of real-world data, where uncertainty is inherent.

In conclusion, the synergy between knowledge graph reasoning and semantic web technologies is transformative. It propels AI systems to new heights of reasoning sophistication and fosters a web where information is not just linked but semantically meaningful. As the journey continues, the symbiotic relationship between these technologies promises to unlock further possibilities for intelligent information processing, decision-making, and problem-solving. Knowledge graph reasoning is a beacon, guiding us toward a future where AI systems possess vast amounts of information and the wisdom to reason and derive meaningful insights.

About the Author

Neri Van Otten

Neri Van Otten

Neri Van Otten is the founder of Spot Intelligence, a machine learning engineer with over 12 years of experience specialising in Natural Language Processing (NLP) and deep learning innovation. Dedicated to making your projects succeed.

Recent Articles

ROC curve

ROC And AUC Curves In Machine Learning Made Simple & How To Tutorial In Python

What are ROC and AUC Curves in Machine Learning? The ROC Curve The ROC (Receiver Operating Characteristic) curve is a graphical representation used to evaluate the...

decision boundaries for naive bayes

Naive Bayes Classification Made Simple & How To Tutorial In Python

What is Naive Bayes? Naive Bayes classifiers are a group of supervised learning algorithms based on applying Bayes' Theorem with a strong (naive) assumption that every...

One class SVM anomaly detection plot

How To Implement Anomaly Detection With One-Class SVM In Python

What is One-Class SVM? One-class SVM (Support Vector Machine) is a specialised form of the standard SVM tailored for unsupervised learning tasks, particularly anomaly...

decision tree example of weather to play tennis

Decision Trees In ML Complete Guide [How To Tutorial, Examples, 5 Types & Alternatives]

What are Decision Trees? Decision trees are versatile and intuitive machine learning models for classification and regression tasks. It represents decisions and their...

graphical representation of an isolation forest

Isolation Forest For Anomaly Detection Made Easy & How To Tutorial

What is an Isolation Forest? Isolation Forest, often abbreviated as iForest, is a powerful and efficient algorithm designed explicitly for anomaly detection. Introduced...

Illustration of batch gradient descent

Batch Gradient Descent In Machine Learning Made Simple & How To Tutorial In Python

What is Batch Gradient Descent? Batch gradient descent is a fundamental optimization algorithm in machine learning and numerical optimisation tasks. It is a variation...

Techniques for bias detection in machine learning

Bias Mitigation in Machine Learning [Practical How-To Guide & 12 Strategies]

In machine learning (ML), bias is not just a technical concern—it's a pressing ethical issue with profound implications. As AI systems become increasingly integrated...

text similarity python

Full-Text Search Explained, How To Implement & 6 Powerful Tools

What is Full-Text Search? Full-text search is a technique for efficiently and accurately retrieving textual data from large datasets. Unlike traditional search methods...

the hyperplane in a support vector regression (SVR)

Support Vector Regression (SVR) Simplified & How To Tutorial In Python

What is Support Vector Regression (SVR)? Support Vector Regression (SVR) is a machine learning technique for regression tasks. It extends the principles of Support...


Submit a Comment

Your email address will not be published. Required fields are marked *

nlp trends

2024 NLP Expert Trend Predictions

Get a FREE PDF with expert predictions for 2024. How will natural language processing (NLP) impact businesses? What can we expect from the state-of-the-art models?

Find out this and more by subscribing* to our NLP newsletter.

You have Successfully Subscribed!