1. Introduction
Path reasoning in knowledge graphs (KGs) is a fundamental technique with broad applications, including power electronics, where understanding complex relational insights is essential for advancing topology design and application. In modern power systems, such as smart grids and IoT-based electronic frameworks, the ability to infer and reason over dynamic and temporally sensitive data is critical for optimizing performance, detecting faults, and enabling adaptive control mechanisms. By leveraging path reasoning, power electronic systems can uncover hidden relationships between components, enhance decision-making processes, and support predictive maintenance.
Knowledge graphs structure entities and relationships, offering a rich data source for tasks such as knowledge completion, event prediction, and semantic search. However, effective reasoning within KGs remains challenging, particularly in scenarios with limited data or temporally driven relationships [
1].
Path reasoning can be categorized into single-hop and multi-hop reasoning. Single-hop reasoning derives insights from a single relationship or edge in the KG. It is efficient and well suited for tasks requiring direct, explicit connections, such as retrieving attributes or identifying immediate relationships. However, it is inherently limited in its ability to uncover deeper, more intricate connections.
In contrast, multi-hop reasoning traverses multiple edges and nodes, uncovering complex and indirect relationships. This approach is essential for tasks such as compositional question answering and inferring latent connections between entities. Despite its utility, multi-hop reasoning faces challenges like combinatorial explosion and logical uncertainty, which become particularly pronounced over longer reasoning paths.
Recent advancements in neural–symbolic models, reinforcement learning, and graph neural networks (GNNs) aim to address these challenges. These methods enhance reasoning efficiency and generalization, enabling robust inferences over dynamic and resource-constrained environments. Their integration with power electronics opens the door to new capabilities in designing adaptive and efficient systems, thereby aligning with emerging needs in topology optimization, control refinement, and event-driven applications.
Traditional models often struggle with generalization and capturing complex logical dependencies in dynamic knowledge [
2]. Models like TransE [
3], DistMult [
4], and RotatE [
5] aim to learn low-dimensional vector representations of entities and relations to facilitate reasoning. While these models have achieved notable results in various knowledge graph tasks, they are limited in their ability to handle multi-hop path reasoning, particularly when relationships span across time or events. Furthermore, these methods rely on static embeddings that fail to capture the temporal dynamics of entities and relationships over time.
Recent advancements in path reasoning have primarily relied on deep learning models, particularly graph neural networks (GNNs) and transformer-based architectures. The introduction of graph neural networks (GNNs) has improved the ability to capture structural dependencies in KGs. Models such as GCN [
6], GraphSAGE [
7], and GAT [
8] have enhanced scalability and performance in reasoning tasks by leveraging neighborhood aggregation techniques to propagate information across the graph. However, GNNs still face challenges in integrating higher-order logical features and temporal/event-driven relationships, which are crucial for reasoning in dynamic KGs. Additionally, GNNs require extensive computational resources and large amounts of labeled data for effective training, making them less suitable for path reasoning learning scenarios. Transformer-based models such as BERT [
9] have revolutionized the field of natural language processing and knowledge graph reasoning by using self-attention mechanisms to capture long-range dependencies and contextual relationships across entire sequences. Recent advancements show their potential in handling more complex reasoning tasks. For example, Saavedra-Mercado et al. [
10] use transformers for temporal-case-based reasoning, enhancing retrieval in dynamic environments. Tan et al. [
11] propose a Transformer-based Relational Inference Network for visual relational reasoning, while Fang et al. [
12] leverage transformers to model the evolutionary chain of events in temporal knowledge graphs. These models have demonstrated better performance in path reasoning tasks, considering the contextual relationship between entities across multiple hops. However, they are computationally expensive and often require large-scale training datasets, limiting their applicability in resource-constrained environments and path reasoning learning scenarios [
13].
As shown in
Figure 1, we can understand the importance of temporal and event-based reasoning in knowledge graph path inference. Consider the following example involving a company, its product, and consumer interactions. The sequence of events is defined by both temporal progression and causal dependencies.
Base logic of event sequence: On 1 May 2021, a company initiates the development of a new product (company develops product). Several months later, on 1 October 2021, the product is announced to the public (product announced_by company). Shortly after, consumers begin purchasing the product on 14 March 2022 (consumers purchase product), providing feedback on 1 November 2022 (consumers provide feedback). Based on this feedback, the company updates the product on 1 December 2022 (company updates product).This sequence illustrates a chain of interconnected events where temporal dependencies drive logical inferences. For example, the action product announced_by company logically follows company develops product, as a product must exist before it can be announced. Similarly, consumer feedback (consumers provide feedback) depends on prior product purchases (consumers purchase product), which in turn are influenced by the product announcement. These dependencies highlight the critical role of temporal reasoning and event logic in understanding and inferring paths within knowledge graphs. Models capable of leveraging such contextual relationships can better capture the dynamics of multi-hop reasoning tasks.
To better utilize these important feature, we propose a novel framework, Path-Reasoning Logic (PRlogic), which integrates logic-based reasoning with deep learning techniques to enhance path inference in knowledge graphs. PRlogic incorporates a context-aware logical association network, which is designed to capture both temporal and event-based relationships between entities, enabling more accurate multi-hop reasoning. By combining rule-based logical reasoning with deep neural networks, PRlogic is able to learn complex relationships in a more interpretable and efficient manner. Furthermore, the framework includes a multi-stage feature refinement process that improves the model’s ability to capture logical dependencies and contextual features, even in resource-limited settings.
The advantages of PRlogic are as follows:
Enhanced multi-hop reasoning: PRlogic improves multi-hop path inference by incorporating a context-aware logical association network. This network captures both temporal and event-based relationships between entities, enabling more accurate and efficient reasoning over complex knowledge graph structures. This is especially beneficial for tasks requiring deeper, more intricate relationships.
Combination of logic and deep learning: PRlogic uniquely combines rule-based logical reasoning with deep neural networks. This combination enables the model to learn complex relationships while offering interpretability and flexibility that purely data-driven models lack. This results in improved explainability and adaptability across a variety of tasks.
Multi-stage feature refinement: PRlogic incorporates a multi-stage feature refinement process that enhances its ability to capture logical dependencies and contextual features. This is particularly advantageous in resource-limited settings, allowing the model to maintain high performance despite computational constraints.
In summary, PRlogic is a novel framework that combines logic-based reasoning with deep learning techniques to enhance path inference in knowledge graphs. By integrating context-aware logical networks, multi-hop reasoning, and feature refinement, PRlogic enables more accurate, interpretable, and efficient reasoning, even in resource-constrained environments.
2. Related Work
Path reasoning in knowledge graphs (KGs) is a fundamental task in a variety of artificial intelligence applications, including knowledge completion, event prediction, and semantic search. This task involves inferring indirect relationships between entities by traversing multiple edges in a graph, which enables the discovery of hidden connections and new facts not explicitly stated in the graph. Over the years, path reasoning has significantly evolved, driven by advancements in machine learning techniques such as embedding-based models, reinforcement learning, graph neural networks (GNNs), and transformer models. These methods have enabled more efficient and scalable reasoning, improving the ability to handle complex graph structures and relationships. However, despite these notable advancements, several challenges persist, particularly in capturing temporal dynamics and event-based relationships, which are essential for modeling knowledge graphs that evolve over time. Temporal reasoning is especially critical, as the relationships within knowledge graphs may change, making it necessary to model not just static connections but also the temporal evolution of entities and their interactions. Path reasoning plays a pivotal role in ensuring that knowledge graphs can adapt to new information, predict future events, and support more nuanced and contextually relevant queries, highlighting its importance in advancing artificial intelligence systems.
2.1. Embedding-Based Methods for Path Reasoning
Embedding-based approaches have been foundational in path reasoning tasks. These methods focus on learning low-dimensional vector representations for entities and relationships in the knowledge graph. By leveraging these representations, path inference is performed by measuring the similarity between different entities or relationships. A common approach is to model relationships as translations or transformations in the vector space. Methods like TransE [
3] learn embeddings where the relationship between entities is modeled as a translation, whereas DistMult [
4] uses a bilinear form to better capture complex interactions between entities. Extending DistMult, ComplEx [
14] incorporates complex-valued embeddings to capture asymmetric relations. RotatE [
5] further extends these methods by modeling relations as rotations in a complex vector space. To enhance traditional embedding-based methods, ConvE [
15] introduces convolutional neural networks, allowing for more flexible and expressive representation learning. Despite their success in many tasks, embedding-based methods struggle to effectively capture complex temporal dynamics or event-driven relationships, which are essential for real-world applications.
2.2. Reinforcement Learning for Path Reasoning
Reinforcement learning (RL) has been applied to path reasoning tasks, treating path selection as a sequential decision-making process. In these approaches, an agent learns to choose the most relevant relations to reach a target entity, making them suitable for tasks such as event prediction and path discovery. PathNet [
16] is one such method that uses RL to identify the optimal paths in a knowledge graph, but it faces scalability issues, particularly in large knowledge graphs. Graph Convolutional Reinforcement Learning (GCRL) [
17] combines reinforcement learning with graph convolutional networks to improve path reasoning in dynamic graphs, but these methods often struggle to handle the evolving nature of KGs, especially when dealing with sparse reward signals or long-term dependencies in large-scale knowledge graphs. Finally, models like CURL [
18] leverage contrastive learning techniques to improve knowledge graph reasoning by focusing on distinguishing positive and negative entity relationships, enhancing the model’s performance on reasoning tasks. RKLE [
19] introduces a knowledge graph embedding approach that incorporates both relational and entity-based learning, providing a more comprehensive understanding of the graph structure and improving path reasoning accuracy.
2.3. Neural Networks for Path Reasoning
Graph neural networks (GNNs) have gained popularity for path reasoning due to their ability to capture relational dependencies in KGs. By propagating information through nodes and edges, GNNs learn rich entity representations that can be used for path inference. Methods like GCN [
6] and GraphSAGE [
7] utilize graph convolutional layers to aggregate information from neighboring nodes, while graph attention networks (GATs) [
8] use attention mechanisms to prioritize the most relevant neighbors during message passing. These methods perform well in capturing structural dependencies, but they fall short when it comes to modeling temporal changes or event-based reasoning. Temporal graph neural networks (TGNs) [
20,
21] have been proposed to incorporate time-aware reasoning into GNNs, yet they remain limited in capturing complex event-driven relationships that evolve over time.
Additionally, neural–symbolic models like NeuralLP [
22] combine logic programming with neural networks for reasoning, allowing for a more interpretable and robust inference mechanism in path reasoning tasks. The M-walk [
23] model merges random walk-based methods with deep learning techniques, enabling more flexible and efficient graph traversal and reasoning. Models like MINERVA [
24] also leverage attention mechanisms to enhance graph-based reasoning by focusing on the most relevant parts of the graph, improving the accuracy and efficiency of path inference.
Transformer models, especially those based on the self-attention mechanism, have revolutionized many natural language processing tasks, including path reasoning in KGs. Models like BERT [
9] have been fine-tuned for knowledge graph tasks, effectively learning contextual relationships across multi-hop paths. Recently, the application of transformers has expanded to more complex reasoning tasks. For instance, Saavedra-Mercado et al. [
10] proposed a transformer-based approach for temporal-case-based reasoning, improving retrieval accuracy in dynamic environments. Tan et al. [
11] introduced a Transformer-based Relational Inference Network to handle complex visual relational reasoning. Additionally, Fang et al. [
12] applied transformers to model the evolutionary chain of events in temporal knowledge graphs, showcasing their strength in dealing with dynamic data and temporal relationships. These models excel in capturing long-range dependencies and complex sentence structures, making them effective in understanding multi-hop relationships in static KGs. However, they struggle with scalability, requiring large datasets and significant computational resources. Additionally, they face challenges in capturing the temporal and event-driven dynamics crucial for real-world applications involving dynamic knowledge graphs. Event-centric models, like those discussed by Knez and Žitnik [
25], emphasize the importance of incorporating temporal and event-based features into knowledge graph construction. They highlight the need for methods that can model the evolving nature of events and relationships over time, which is essential for applications requiring dynamic reasoning, such as fault diagnosis in power distribution networks [
26].
Moreover, the integration of temporal reasoning with logical inference has emerged as a key research direction. For instance, TEILP [
27] proposes a novel approach for time prediction over knowledge graphs using logical reasoning, thereby enhancing the temporal accuracy of graph-based models. This is particularly relevant for multi-hop reasoning tasks where the temporal aspects of relationships must be considered. Similarly, the framework proposed by Zhu et al. [
28] focuses on hierarchical multi-hop reasoning using reinforcement learning, providing a robust mechanism for dealing with complex temporal dependencies in knowledge graphs. In dynamic scenarios, few-shot learning techniques have proven effective in addressing challenges associated with sparse data. Zheng et al. [
29] explore multi-hop knowledge graph reasoning in few-shot scenarios, leveraging meta-reinforcement learning to adapt to new and unseen relations, which is especially crucial when temporal knowledge is sparse. Their work suggests that multi-hop reasoning can be effectively enhanced in dynamic and evolving knowledge graphs by incorporating such few-shot learning techniques.
By combining event-centric knowledge graph construction, temporal reasoning, and few-shot learning, the field is moving towards more efficient and scalable solutions for dynamic knowledge graph tasks. These advancements provide a foundation for improving multi-hop reasoning and temporal inference in complex real-world applications.
While embedding-based, reinforcement learning, GNNs, and transformer models have advanced path reasoning, they often fail to incorporate the logical dependencies that govern complex, dynamic, and event-driven KGs. Recent studies have demonstrated that combining logic-based reasoning with machine learning techniques can help address this gap. By integrating logical reasoning into path inference, models can better handle multi-hop reasoning and temporal dependencies in dynamic graphs.
Our proposed approach, PRlogic, integrates logical rule-based reasoning with deep learning models to enhance path inference. PRlogic incorporates structured logical rules to guide the reasoning process, allowing it to capture both structural and temporal dependencies within the graph. This integration not only improves interpretability but also enhances the efficiency and accuracy of path reasoning in resource-constrained environments. By leveraging the strengths of logical reasoning and deep learning, PRlogic addresses the limitations of existing models, offering a more robust solution for path reasoning in dynamic and event-driven knowledge graphs.
3. Methodology
3.1. Problem Description
Path reasoning in knowledge graphs involves uncovering and inferring intricate relationships between entities, which is crucial for advanced reasoning tasks. This complexity escalates when considering temporal and event-based dependencies, as these dependencies heavily influence entity relationships and the paths through which these relationships should be reasoned. For example, consider the following statement:
“The employee’s resignation was effective after the promotion was announced”. In this case, the model must recognize that the event of announcing the promotion precedes the resignation, and that the promotion event indirectly influences the employee’s decision to resign. Accurately capturing such temporal and event-driven dependencies is crucial for robust path reasoning [
30]. PRlogic addresses this challenge by integrating deep learning with both temporal and event logics, allowing the model to simultaneously account for entity relationships and the complex temporal and causal interdependencies governing these interactions.
The core challenge in path reasoning, particularly within dynamic knowledge graphs, is modeling how entities evolve and interact over time through events. Temporal logic provides a formal framework to express relationships such as “before”, “after”, or “during” between entities or events, which enables the model to understand the sequencing and timing of these relationships. Event logic, in contrast, enables the model to capture causal dependencies between events, allowing it to reason about how one event influences others and the entities involved in those events.
For instance, consider the following statement: “The project was delayed after the funding approval was postponed”. Here, “funding approval” and “project” represent events, while “delayed” and “postponed” describe their respective outcomes. To reason correctly, the model must understand that the delay in the project occurred after the approval was postponed. Temporal logic formalizes these temporal relationships, while event logic captures the causal dependency between the funding approval and the subsequent delay in the project. By integrating both temporal and event logics, PRlogic provides a comprehensive framework for reasoning over such complex knowledge graph paths.
Incorporating path reasoning learning into dynamic knowledge graphs, where labeled examples are limited, introduces an additional challenge. Specifically, in the path reasoning learning task, we are provided with a small training set , where N denotes the number of training examples, represents an instance, and the corresponding label. The goal is to learn a model that can generalize to new entity types or relationships using a small number of labeled examples, i.e., a support set .
In the context of path reasoning, we are given a support set
, where
K is the number of labeled examples per entity type. The model’s task is to predict the label
for a query instance
from a new task
, formulated as follows:
where
represents the model parameters. The objective is to maximize the likelihood of predicting the correct label
for the query instance
, conditioned on the support set
. This framework enables the model to generalize to unseen entity types and relationships, even with limited training data.
To enhance performance in path reasoning, particularly in settings where data is sparse, PRlogic extends this framework by incorporating both temporal and event logic. Temporal logic allows the model to reason about relationships between time-based entities, while event logic models the causal dependencies between events. By integrating both logics into the reasoning process, PRlogic creates a more robust approach for navigating complex paths in dynamic knowledge graphs.
For example, consider the following statement:
“The employee’s resignation was effective after the promotion was announced”. Correctly identifying the entities “employee” and “promotion” requires understanding both their temporal relationship (the promotion was announced before the resignation) and the event relationship (the promotion announcement triggered the resignation). These dependencies can be expressed formally through temporal and event logic as follows:
where
and
represent the timestamps of the respective events, and
and
represent the promotion and resignation events, respectively. By incorporating such temporal and event-based logical structures, PRlogic enables the model to reason not only about the temporal ordering of events but also about the causal relationships between them, thereby improving its ability to perform accurate path reasoning in dynamic knowledge graphs.
This integration of temporal and event logic into path reasoning represents a significant advancement in the ability to reason over complex relationships in dynamic knowledge graphs. PRlogic provides a more effective and scalable framework for addressing these challenges, especially when working with limited labeled data in path reasoning tasks.
3.2. Method Definition
The PRLogic framework is designed to enhance path reasoning in knowledge graphs by incorporating temporal and event-based logic. As shown in
Figure 2, this framework is built upon four core modules, each playing a crucial role in extracting, processing, reasoning, and validating the relationships among entities, events, and temporal data. Through the integration of deep learning techniques with temporal and event-driven knowledge, PRLogic is capable of modeling complex dependencies within dynamic knowledge graphs, improving both accuracy and interpretability in path reasoning tasks.
Figure 2 illustrates the core architecture of our model and how it processes a query using the knowledge graph:
Nodes: The nodes in
Figure 2 represent the entities in the knowledge graph. Each node corresponds to an individual entity, such as a person, place, or event, that is part of the knowledge graph.
Lines: The lines between the nodes represent the relationships between these entities. These relationships are encoded as edges in the graph, and they denote various types of associations such as temporal dependencies, causal links, or spatial relationships.
Inputs and outputs: The model’s inputs and outputs are explicitly marked in the figure. Inputs include the query or the task-specific question, and the outputs are the inferred relations or entities based on the reasoning process.
Each entity in Level l has representation : This refers to the representation of the entity e in relation to the relationship r at level l, capturing a particular aspect or feature of the entity at that layer.
The method include four modules as follows:
Temporal and event detection module: This module is responsible for identifying temporal expressions and event triggers within the dataset. Temporal expressions like dates and durations, and event triggers such as actions (e.g., “announced” and “scheduled”) are crucial for understanding the chronological and causal structure of text. Regular expressions and linguistic rules are applied to identify these key features. The knowledge graph further enriches this detection process by linking recognized entities with additional contextual information, laying the groundwork for downstream reasoning tasks.
Feature extraction and transformation module: The feature extraction module processes raw textual data to extract both entity-specific features and features representing temporal and event-driven relationships. In addition to traditional entity recognition, this module integrates the extracted temporal expressions and event triggers, thus enabling the model to understand how entities and events interact over time. The features are then transformed into a form suitable for neural network processing, ensuring context-aware representation of temporal and event-based data.
Path inference module: This module forms the heart of the PRLogic framework, where sequential dependencies between entities, events, and their temporal relationships are captured using recurrent neural networks (RNNs). By encoding temporal and event-based logic into the RNN structure, the module tracks the unfolding of events and the movement of entities through time, allowing the model to reason about causal and temporal relationships between events and their corresponding entities. Additionally, knowledge graph embeddings are leveraged to further strengthen reasoning capabilities.
Validation and correction module: After reasoning, the model’s outputs are validated against ground truth data to ensure the temporal and event-based relationships are correctly captured. This validation process includes evaluating the model’s predictions with respect to the correctness of entity identification, temporal ordering, and event dependencies. Any discrepancies detected during this evaluation are corrected to refine the model’s reasoning process, ensuring both high accuracy and reliability in knowledge graph path inference.
These four modules interact synergistically, enabling PRLogic to perform complex path reasoning by leveraging both temporal and event-based logic to uncover hidden relationships and insights within the knowledge graph.
3.2.1. Temporal and Event Detection Module
The first step in PRLogic involves identifying and detecting temporal expressions and event triggers within the input data. Temporal expressions provide the chronological context for the events and entities, while event triggers represent the actions or occurrences that link entities in the graph. The detection of these elements is fundamental for establishing the temporal and event-driven structure that guides subsequent reasoning.
Temporal expressions are detected through regular expressions, which can be formalized as follows:
where
is a function that matches word
w with a predefined temporal pattern
. This process ensures that words representing dates, times, or durations are correctly recognized.
Similarly, event triggers are identified using a different set of patterns aimed at detecting action-indicating verbs or event-specific terms. The event detection process is formalized as follows:
where
identifies whether a word
w matches an event pattern
, such as “scheduled”, “canceled”, or “delayed”.
By combining the detection of temporal and event triggers, this module helps build a structured representation of the temporal relationships and event dependencies within the text, enabling more accurate subsequent processing.
3.2.2. Feature Extraction and Transformation Module
In the feature extraction and transformation module, the raw text is processed to extract the relevant features that represent both the entities and their relationships in terms of time and events. The module performs dual feature extraction to capture both entity-specific characteristics as well as temporal and event-driven logic.
Combined Feature Set
After extracting temporal and event features, the combined feature set is created by concatenating entity-specific features
, temporal features
, and event features
:
This feature set serves as the input for the path reasoning module, where it will be processed further to uncover complex dependencies between entities and events in the knowledge graph.
3.2.3. Path Inference Module
At the core of the PRLogic framework is the path inference module, which leverages recurrent neural networks (LSTMs) to capture sequential dependencies between entities, events, and temporal relationships. By incorporating event-based and temporal logic into the LSTMs, the model can track the unfolding of events and understand how entities move through time.
The LSTMs is structured to process sequential data, where at each time step
t, the hidden state
is updated as follows:
Here, is the hidden state at time step t, and are the learned weight matrices, is the input feature vector at time step t, and is an activation function such as tanh or ReLU.
This LSTM-based architecture enables the model to track both the temporal progression of events and the causal relationships between them, making it suitable for reasoning in dynamic, event-driven environments.
Event-Temporal Logic Integration
The model also incorporates event-temporal logic, which defines how events interact in terms of causal and temporal relationships. The relationship between two events
and
can be captured by logical expressions such as follows:
This allows the model to reason about the ordering of events and their impact on entity relationships, further enhancing the model’s capability to handle complex temporal event reasoning tasks.
3.2.4. Validation and Correction Module
The final stage in PRLogic involves validating the inferred paths. By comparing predicted event sequences and temporal relationships to ground truth data, the model ensures that all event orderings and entity relationships are correctly reasoned. Any discrepancies identified are corrected through further refinements to the model’s reasoning process, thus ensuring high-quality path inference for knowledge graph-based applications.
3.3. PRlogic for Path Reasoning in Temporal Knowledge Graphs
Path reasoning in temporal knowledge graphs (TKGs) is a critical task that involves understanding how entities and their relationships evolve over time. We propose a novel framework, PRlogic, that effectively integrates temporal logic and event-based reasoning for performing path inference within these knowledge graphs. PRlogic is designed to address the complexities of path reasoning by leveraging both temporal relationships and event-driven features, ensuring robust predictions even in dynamic environments.
3.3.1. Core Idea of PRlogic
PRlogic combines two distinct yet complementary reasoning mechanisms: temporal logic reasoning and event-based reasoning. Temporal logic allows PRlogic to model the sequence and temporal order of events, while event-based features capture the specific actions or occurrences that drive transitions in the knowledge graph. By integrating these two components, PRlogic achieves a more comprehensive understanding of temporal relations and entity interactions, which is essential for path reasoning tasks.
The core components of PRlogic are:
1. Temporal logic for event ordering: Temporal logic operators such as Before, After, Eventually, and Next are used to model the ordering and eventual occurrence of events across time. 2. Event-based features for entity relationships: Event-driven features represent the interactions between entities, enabling the model to capture causal and consequential relationships between events. 3. Graph-based temporal representation: A temporal knowledge graph is used to structure the relationships between entities and their temporal evolution, making it possible to infer paths between them.
3.3.2. Temporal Logic Operators in PRlogic
The temporal logic operators in PRlogic are designed to formalize and quantify the relationships between events in time. These operators help the model capture the inherent dependencies between events and actions within the knowledge graph. The following temporal logic operators are central to the PRlogic framework:
Before Operator (U)
The
Before operator captures the notion that one event
must occur before another event
at a later time step. This operator ensures the continuity of event relationships and is defined as follows:
This condition ensures that event holds until event occurs. It enables the RNN to track the persistence of until becomes true, supporting path reasoning by modeling the dependencies between successive events.
Sometimes Operator (□)
The
Sometimes operator expresses that an event
must hold at every point in the future from time
t onward. This is crucial for capturing long-term dependencies in path reasoning tasks. Formally, it is expressed as follows:
By using this operator, PRlogic can model the persistence of entities or relationships over extended time horizons, which is critical for path completion and inference in dynamic knowledge graphs.
Finally Operator (◊)
The
Finally operator asserts that an event
will eventually hold true at some time step in the future. This is useful for predicting future events and completing paths in TKGs. The formal definition is as follows:
In path reasoning tasks, this operator helps to infer the eventual occurrence of events even when not all intermediate steps are known.
Future Operator (◯)
The
Future operator models the immediate successor of an event
, i.e., what happens next. This operator captures the direct transition from one event to the next. It is expressed as follows:
In PRlogic, this operator enables the model to predict future states based on the current entity or relationship, a key feature for accurate path prediction and completion in TKGs.
3.3.3. Demonstrating Temporal and Event-Based Logic Operators
In this section, we integrate temporal and event-based logic into deep learning frameworks. To clarify their practical usage, we present a step-by-step example, where we demonstrate the operators Finally and Sometimes in a real-world scenario. This example highlights how these operators are applied and their corresponding input–output mappings.
Operator “Finally”: The Finally operator is used to assert that a certain event will eventually occur at some point in the future. Consider the following scenario:
Input: A sequence of time-stamped events where each event corresponds to a sensor reading.
Goal: We want to ensure that the sensor will eventually report a value greater than a threshold.
Output: We compute the temporal path that guarantees the sensor will eventually reach or exceed the threshold value.
Finally can be represented by a formal operator in our framework:
For example, if the sensor readings are represented as , where t denotes time, the Finally operator ensures that at some point, holds.
Operator “Sometimes”: The Sometimes operator asserts that an event will occur at least once within a certain time window. In our example, we consider the following:
Input: A sequence of time-stamped event triggers that represent different user actions.
Goal: We want to check if a certain user action, say a “click” event, happens at least once in a given time window.
Output: We compute whether a “click” event occurs within the specified window of time.
Sometimes can be expressed as follows:
For instance, if user actions are represented as , the Sometimes operator checks whether a “click” event occurs at least once within the time window of interest.
Step-by-Step Example: Integration with Deep Learning Models To demonstrate the integration of these operators with deep learning, we present a step-by-step example in which we incorporate temporal logic constraints into a recurrent neural network (RNN) model. The goal is to predict sensor readings while ensuring that the predictions satisfy temporal logic constraints.
Step 1: Preprocess the sensor data to generate time-stamped sequences.
Step 2: Define the temporal logic constraints for the model, such as “Finally” and “Sometimes”.
Step 3: Train the RNN to predict the sensor readings while adhering to the constraints.
Step 4: Evaluate the model’s output by checking if the temporal constraints are satisfied.
This step-by-step integration allows us to showcase how the temporal operators influence the model’s behavior, providing explicit mappings between inputs (sensor data) and outputs (predicted sensor readings) while ensuring that temporal logic constraints are respected.
3.3.4. Event-Based Features in PRlogic
In addition to temporal reasoning, PRlogic also integrates event-based features, which capture the actions and relationships between entities that occur within the knowledge graph. These event-driven features are critical for modeling transitions between entities and facilitating path reasoning.
Event-based features are extracted based on linguistic patterns, such as verbs or action words, which trigger the occurrence of events. These features are formalized as follows:
where
represents the set of event features, and
is a function that maps each event trigger
(such as a verb or action) to a corresponding feature usable by the model. By combining event-based features with temporal logic, PRlogic improves its ability to reason about how entities and events relate over time, which is crucial for path reasoning tasks.
3.3.5. Graph-Based Temporal Representation
PRlogic utilizes a temporal knowledge graph to represent the entities and the temporal relationships between them. The knowledge graph captures the evolution of events over time and their causal relationships. Temporal relationships, such as “before”, “after”, or “overlapping”, are modeled as edges between nodes representing entities at different time steps.
The relationship between two entities
and
at time steps
and
is captured as follows:
where TemporalRelation defines the temporal relationship between entities based on their respective time steps. This allows PRlogic to make accurate predictions about paths and infer missing information within the temporal structure of the knowledge graph.
3.3.6. Handling Data Sparsity in Temporal Knowledge Graphs
In temporal knowledge graphs (TKGs), one of the key challenges is data sparsity, where certain entities, relationships, or temporal connections are either missing or underrepresented. To address this challenge, we introduce a multi-stage refinement process designed to improve reasoning in data-scarce environments. The process employs a combination of graph-based regularization and temporal smoothing techniques, ensuring robust reasoning even with sparse data.
Graph-based Regularization: The graph-based regularization technique plays a crucial role in mitigating data sparsity by leveraging the structural relationships present in the knowledge graph. During the refinement process, regularization is applied to encourage the model to make inferences that align with the existing relationships in the graph. This technique ensures that even if certain connections are missing or underrepresented, the model can still reason effectively by relying on the inherent structure of the knowledge graph.
Temporal Smoothing: Temporal smoothing is another key component in the refinement process, designed to handle the temporal dynamics of knowledge graphs. In sparse temporal environments, where data on the timing or sequencing of events may be incomplete, temporal smoothing helps to maintain the consistency of temporal relationships. By smoothing over time-based relationships, the model can infer missing temporal dependencies with greater confidence, ensuring that the reasoning process remains consistent even when only partial data are available.
Improved Inference with Structural and Temporal Consistency: By combining graph-based regularization and temporal smoothing, the multi-stage refinement process improves the model’s ability to infer missing links and temporal relationships. These techniques work in tandem to maintain both structural and temporal consistency in the knowledge graph, even when certain data points are sparse or missing. This results in more accurate and robust reasoning, allowing the model to uncover hidden relationships and make predictions despite the challenges posed by data scarcity.
This refined approach ensures that PRlogic can handle data-scarce environments effectively, leading to more reliable path reasoning in temporal knowledge graphs.
3.3.7. Objective Function and Path Reasoning
The model incorporates a temporal encoding function
T to embed time-related information into a vector space. Each event
in the sequence is associated with a temporal embedding
, which is computed by a temporal encoding function
. The temporal embedding captures the dynamic context of the event relative to others in the sequence, particularly focusing on the time intervals between successive events. The temporal encoding is defined as follows:
where
represents the time difference between event
and the previous event
, and
is a function that encodes temporal information, such as sinusoidal embeddings or temporal recurrent networks. These temporal embeddings allow the model to differentiate between events based on their time-related features, enabling it to reason about the evolution of the knowledge graph over time.
The model uses the logical rules to update the hidden state
at each event. This update function can be formulated as follows:
where
is the hidden state of the network at event
, and
is a function that incorporates the event’s logical rules into the hidden state update. This function can be implemented using rule-based reasoning networks. By incorporating event logic, PRlogic ensures that the reasoning process accounts for both the temporal dynamics and the logical dependencies between events.
Once the temporal and event logic embeddings have been computed, the model integrates these representations to form a unified vector that encodes both the temporal context and logical reasoning. This integrated representation is denoted as
, and it is formed by concatenating the temporal embedding
and the updated hidden state
:
where
denotes concatenation. The resulting vector
serves as the input for further processing in the network, enabling the model to make predictions about event relationships or to complete knowledge graph entries.
Finally, the integrated temporal event representation
is passed through the remaining layers of the neural network to predict relationships between entities or to complete missing links in the knowledge graph. A typical prediction function for knowledge graph completion is a scoring function
S, which computes the score for a predicted relationship between entities
and
:
where
W is a learnable weight matrix,
b is a bias term, and
is a non-linear activation function (e.g., sigmoid or softmax). The scoring function ensures that the temporal and logical dependencies between entities are considered when predicting the likelihood of a relationship.
The objective function for PRlogic is designed to optimize both entity recognition and the accuracy of temporal event relationships. The total loss function is a weighted sum of the following components:
where:
- -
is the KGPR loss, focusing on correctly identifying entities in the knowledge graph.
- -
is the loss associated with accurately predicting temporal event relationships between entities.
- -
is a regularization term that prevents overfitting by penalizing overly complex models.
By combining these components, PRlogic is able to effectively reason about paths, infer missing links, and make predictions about the future states of entities within a temporal knowledge graph. This makes it a powerful tool for a wide range of applications, such as event forecasting, knowledge graph completion, and sequential reasoning tasks.
4. Experimental Setup
In this section, we describe the experimental setup used to evaluate the proposed PRlogic model on various path reasoning (KGPR) tasks. The focus is on PRlogic’s ability to integrate temporal knowledge effectively. We compare the performance of PRlogic with several state-of-the-art models across multiple benchmarks, with particular emphasis on its performance in path reasoning learning scenarios. The results demonstrate the model’s effectiveness, particularly in handling temporally sensitive entities and relations in knowledge graphs.
4.1. Dataset Selection and Experiment Hyperparameters
To evaluate the efficacy of PRlogic, we selected several well-established knowledge graph datasets, each offering unique challenges related to temporal reasoning and path-based entity recognition. The datasets span a range of domains and data types, ensuring a comprehensive evaluation of PRlogic’s generalization ability in KGPR tasks.
The following knowledge graph datasets were selected for this study:
FB15K-237: This is a large-scale knowledge graph with 14,951 entities and 237,965 relationships, representing real-world facts and entities. It is particularly useful for evaluating models on a diverse set of entities and relationships.
WN18RR: This is a graph derived from WordNet, consisting of 40,943 entities and 151,442 relationships. This dataset is particularly suited for evaluating models on generalization to unseen relationships, emphasizing the challenge of reasoning with rare and unobserved entities.
NELL-995: This is a dynamic and complex knowledge graph containing a variety of entities and relationships. It is particularly valuable for assessing a model’s robustness in reasoning over sparse and noisy data.
These datasets allow us to comprehensively assess PRlogic’s ability to perform temporal reasoning, handle diverse entities and relationships, and manage the challenges posed by path reasoning learning settings.
Hyperparameters
In all our experiments, we used the following hyperparameters:
Learning Rate: 0.001 for all experiments, optimized using Adam optimizer.
Batch Size: 32 for all datasets.
Epochs: 5000 for each experiment, with early stopping based on validation performance.
These hyperparameters were selected based on preliminary experiments to ensure optimal performance across all datasets.
Training Duration
The training duration varied slightly across different experiments, depending on the dataset and complexity of the tasks. On average:
The training duration per experiment was between 4 and 8 h on a single GPU.
For larger datasets like NELL-995, training took approximately 6 h due to the larger input size and more complex reasoning tasks.
We monitored the model’s performance during training to prevent overfitting, using both training and validation metrics.
Computational Resources
The experiments were conducted on a machine equipped with the following specifications:
GPU: NVIDIA GPU 3090 (24 GB memory) for efficient training of deep learning models.
CPU: Intel i7-11800K for data preprocessing and non-GPU computations.
RAM: 32 GB for handling large datasets during training.
Storage: SSD with 4 TB capacity for fast data access and storage.
The GPU was utilized for training all models, while the CPU handled data loading and preprocessing tasks. These resources ensured that the experiments could run efficiently within the given time constraints.
By including these details, we aim to provide readers with the necessary information to reproduce the experiments accurately and understand the computational setup used in our study.
4.2. Evaluation Metrics
We use several standard evaluation metrics to assess the models’ performance in knowledge graph completion tasks:
MRR (Mean Reciprocal Rank): Measures the rank of the correct entity in a list of candidate entities.
Hits@1, Hits@3, and Hits@10: These metrics assess the model’s ability to rank the correct entity in the top 1, 3, or 10 positions, respectively.
4.3. Comparison Methods
We compare PRlogic to a set of state-of-the-art models, each representing a different approach to path reasoning learning:
TransE: A baseline model using simple translational embedding for knowledge graph completion.
DistMult: A bilinear model for modeling the interactions between entities and relations.
ComplEx: An extension of DistMult that incorporates complex-valued embeddings to capture asymmetric relations.
ConvE: A convolutional model that enhances traditional embedding-based methods by leveraging convolutional neural networks.
NeuralLP: A logic programming-based model for knowledge graph reasoning.
M-walk: A model combining random walk-based methods with deep learning for graph traversal and reasoning.
MINERVA: A graph-based reasoning model leveraging attention mechanisms.
CURL: A model that employs contrastive learning for knowledge graph reasoning.
RKLE: A knowledge graph embedding model that incorporates relational and entity-based learning.
GQE: A novel approach for embedding logical queries on knowledge graphs, aimed at effectively handling complex logical queries and enhancing reasoning capabilities over knowledge graphs.
Q2B: The Query2Box model, which uses box embeddings in vector space for reasoning over knowledge graphs, addressing the multi-hop reasoning problem and improving the expressiveness and accuracy of the model.
BetaE: The Beta embeddings method, which improves multi-hop logical reasoning in knowledge graphs by providing stronger representational capabilities, thereby enhancing both the efficiency and accuracy of complex reasoning tasks.
PRlogic (our model): The proposed model, which integrates temporal reasoning through knowledge graphs and attention-enhanced RNNs.
4.4. Experimental Results and Analysis
The performance of PRlogic is evaluated against baseline models across the three selected datasets, as shown in
Table 1 and
Table 2. In this section, we discuss the results in detail, focusing on the average scores and dataset-specific performance in path reasoning learning scenarios.
4.4.1. Overall Performance Analysis
PRlogic consistently outperforms all baseline models across all evaluation metrics. In particular, it achieves the highest MRR and Hits@1, Hits@3, and Hits@10 scores across the FB15K-237, WN18RR, and NELL-995 datasets, indicating its strong ability to rank the correct entities and relationships.
For instance, on the FB15K-237 dataset, PRlogic achieves an MRR of 0.420, surpassing the next best model (ConvE) by 0.010. Similarly, on WN18RR, PRlogic outperforms the competition with an MRR of 0.465. This pattern holds across all datasets, with PRlogic achieving the highest scores for Hits@1, Hits@3, and Hits@10 in both the FB15K-237 and WN18RR datasets.
4.4.2. Detailed Analysis of Results
FB15K-237 Dataset:
On the FB15K-237 dataset, which contains a large number of entities and relationships, PRlogic consistently performs well across all metrics. In addition to the superior MRR score, PRlogic achieves higher Hits@1, Hits@3, and Hits@10 scores compared to the baseline models. This demonstrates that PRlogic not only ranks the correct entities highly but is also more robust at correctly predicting entities in the top ranks.
For example, PRlogic’s Hits@1 score of 0.322 is higher than ConvE, highlighting its superior precision in ranking the correct entities in the top-1 position. This result is especially significant in large-scale knowledge graphs, where traditional models often struggle with ranking accuracy. PRlogic’s higher MRR also reflects its improved ranking ability, where the model is better at placing correct entities in higher ranks even when they do not appear in the top positions.
WN18RR Dataset:
The WN18RR dataset poses a different set of challenges, primarily due to its focus on generalization to unseen relationships. In this case, PRlogic outperforms ConvE and other baselines by a noticeable margin. With an MRR of 0.465, PRlogic’s ability to generalize across unseen relationships is particularly impressive. The Hits@1, Hits@3, and Hits@10 scores are also higher, indicating that PRlogic is better at predicting unseen relationships between entities.
Notably, PRlogic excels in handling sparse data and rare relationships, where the baseline models like TransE and DistMult tend to underperform. This is a crucial strength of PRlogic, as it leverages its temporal reasoning capabilities to effectively generalize to relationships that might not have been frequently observed during training. This feature is essential for real-world applications where data are often incomplete or rare.
NELL-995 Dataset:
The NELL-995 dataset contains more complex and dynamic entities, which require advanced reasoning capabilities. PRlogic again outperforms all baseline models across all evaluation metrics. The model achieves an MRR of 0.758, surpassing ConvE by 0.011. This is particularly significant as NELL-995 involves more diverse and noisy data, which typically challenge models like TransE and DistMult that rely on straightforward embeddings.
PRlogic’s ability to handle noisy and dynamic entities is demonstrated by its consistent performance in both the path reasoning and full-shot learning settings. In the path reasoning setting, PRlogic achieves impressive results in ranking entities related to dynamic events or newly added data, where other models struggle to make accurate predictions.
In NELL-995, the dataset is not only larger but also more dynamic, with entities and relationships continuously evolving. This continuous change introduces substantial noise and uncertainty into the data. Models that are designed purely for embedding-based learning often fail to generalize well in these settings, as they struggle to adapt to new or partially observed data. On the other hand, PRlogic’s ability to integrate logical reasoning with learned embeddings allows it to maintain high performance despite these challenges. The model’s success is especially evident when ranking entities in tasks involving dynamic events, where PRlogic consistently outperforms baseline methods.
Additionally, the contrast in performance between datasets with varying levels of noise—such as the relatively cleaner datasets like FB15k-237 and the noisier NELL-995—demonstrates that PRlogic is not only suitable for controlled environments but also excels when confronted with real-world, noisy data. This adaptability underscores the model’s potential for broader applications, including knowledge graph completion and entity linking in dynamic, real-time scenarios, where data often shift rapidly and unpredictably. The ability of PRlogic to generalize effectively across such environments marks a significant advancement in the field of knowledge graph reasoning, particularly for tasks that require both logical inference and robustness to noisy data.
4.4.3. Comparison with Neural–Symbolic Approaches
In this section, we expand the comparison between PRlogic and existing neural–symbolic approaches, particularly focusing on NeuralLP, a prominent model in the neural–symbolic framework, while both PRlogic and NeuralLP aim to integrate neural networks with symbolic reasoning, PRlogic excels in tasks that involve temporal and event-based reasoning, where NeuralLP faces significant limitations from
Figure 1. For example, in the dataset FB15K-237 (with more noisy temporal data), MRR, Hits@1, Hits@3, and Hits@10 have significant improvement with PRlogic methods compared to NeuralLP methods.
NeuralLP, as a neural–symbolic system, utilizes logical rules and reasoning processes to derive conclusions from structured knowledge. However, it primarily focuses on static relationships between entities, and its ability to reason about time-sensitive events and temporal dynamics is limited. Specifically, NeuralLP struggles to model complex temporal relationships such as “Before” and “After”, and it lacks the flexibility to handle event-based reasoning where occurrences may not follow a strict chronological order.
For example, in scenarios where events have temporal constraints (e.g., a task must be completed before another, or an event may happen at different times), NeuralLP does not natively support the encoding of such relationships in a way that allows it to efficiently infer the necessary temporal dependencies. This makes it less effective in applications that require nuanced understanding of time-sensitive interactions or where events may occur intermittently.
PRlogic, on the other hand, is specifically designed to handle temporal and event-based reasoning tasks. By integrating temporal and event-based logic directly into its reasoning framework, PRlogic can model dynamic relationships such as “Finally” (ensuring that a task or event eventually occurs) and “Sometimes” (allowing for events to occur intermittently or under certain conditions). These logical operations are incorporated into the learning process, allowing the model to reason effectively about time-sensitive data. For instance, when applied to time-sensitive tasks, PRlogic can not only infer whether certain events will eventually occur (e.g., “Finally”) but also predict when they might happen based on learned temporal patterns, something that NeuralLP cannot easily achieve. In tasks where temporal dependencies are crucial, PRlogic outperforms NeuralLP by a considerable margin, confirming that its integration of temporal logic operators is key to its success.
The detailed comparison between PRlogic and NeuralLP illustrates that while both approaches share some common principles, PRlogic is better suited for applications requiring fine-grained temporal and event-based reasoning. By overcoming the limitations of NeuralLP in this domain, PRlogic provides a more effective solution for real-world tasks involving dynamic and time-sensitive knowledge.
4.4.4. Temporal Knowledge Integration
One of the key strengths of PRlogic is its ability to integrate temporal knowledge effectively. In both the FB15K-237 and WN18RR datasets, where temporal aspects play an important role in entity relationships, PRlogic demonstrates a marked improvement over traditional models. By incorporating temporal reasoning into the knowledge graph, PRlogic is able to handle time-dependent entities more effectively, leading to higher accuracy in predicting relationships that depend on specific temporal contexts.
This temporal reasoning is particularly beneficial in the path reasoning learning settings, where PRlogic shows improved performance when trained with entities related to specific time frames or events. For example, in scenarios involving rare or newly introduced time-based events, PRlogic can learn quickly and make accurate predictions, outperforming baseline models like DistMult and ConvE, which do not explicitly account for temporal dependencies. As shown in
Figure 3, in most of the examples, surface–time event logic is more effective when dealing with static, historical facts. However, for events or relationships that evolve over time (e.g., actors in different movie installments, changes in invention), incorporating temporal reasoning could improve the model’s ability to capture dynamic changes and provide more accurate, context-specific answers.
4.4.5. Interpretability Through Visualizations
In
Figure 4, we present a new logical flowchart that visually breaks down the reasoning steps of PRlogic. This flowchart illustrates the sequence of operations involved in the reasoning process, highlighting how PRlogic applies temporal and event-based logic operators to deduce relationships and infer outcomes from the knowledge graph.
The flowchart includes the following components:
Input data: The initial knowledge graph containing entities and their relationships.
Logical operators: Temporal and event-based logic operators that guide the reasoning, such as “Finally” and “Sometimes”.
Reasoning steps: The step-by-step application of these operators to infer new relationships or verify conditions.
Output: The final inferred results based on the logical reasoning applied to the graph.
This flowchart helps to visually explain how PRlogic processes temporal and event-based information, providing readers with a clear understanding of how the model arrives at its conclusions.
By providing these visualizations, we aim to improve the transparency and interpretability of PRlogic.
4.4.6. Limitations
While PRlogic shows superior performance, there are still areas where the model can be improved. For instance, although PRlogic excels in handling time-sensitive entities, its performance could be further enhanced by incorporating external temporal knowledge sources, such as external time–series data or event-based annotations, to increase its reasoning capacity.
Another limitation is the scalability of PRlogic to very large scale knowledge graphs with a broader range of entities and relationships, while it performs well on the selected datasets, scaling the model to even larger knowledge graphs with thousands of new entities and relationships remains a challenge.
5. Conclusions and Future Work
This study introduces PRlogic, a lightweight framework for path reasoning that leverages temporal and event-based knowledge. By employing a rule-based reasoning approach, PRlogic effectively addresses the challenges posed by temporal data, achieving high performance with minimal computational cost. This design enables real-time applications where both speed and accuracy are essential. PRlogic simplifies the integration of temporal and event-driven features, utilizing a rule-based method that avoids the complexities of traditional feature extraction. This approach is especially effective in path reasoning learning scenarios, where it can perform precise reasoning despite limited data. Furthermore, PRlogic’s lightweight structure ensures high adaptability across various knowledge graph tasks, balancing generalization and efficiency—critical for applications requiring fast, scalable inference.
While PRlogic shows strong results, there are several avenues for further improvement. Enhancing its ability to handle more complex temporal and event relationships through advanced contextual embeddings could increase its effectiveness in diverse domains. Additionally, scaling PRlogic to manage larger knowledge graphs and improve real-time inference is a crucial next step. Future work could also explore integrating external knowledge sources, such as real-time events or time–series data, to further improve accuracy in dynamic environments. Our work, PRlogic, offers an efficient and scalable solution for path reasoning, particularly in tasks involving temporal and event-based relationships. Its high accuracy and low resource consumption make it suitable for real-time, dynamic applications. With further research, PRlogic has the potential to take the lead in knowledge graph reasoning, offering robust performance in evolving environments.