NeoMaPy: A Framework for Computing MAP Inference on Temporal Knowledge Graphs

Victor David, Raphaël Fournier-S'niehotta, Nicolas Travers

Introduction

Reasoning about historical data or predicting future events often involves navigating "noisy" datasets—collections of facts that are frequently uncertain or contradictory. For instance, conflicting historical records might place an individual in two different locations simultaneously. While Markov Logic Networks (MLNs) are a standard tool for handling such uncertainty by merging logic with probability, they often struggle with the dimension of time. Traditional temporal extensions tend to be "pessimistic," attempting to mine every possible rule application to identify valid "worlds," a process that scales poorly as the volume of facts increases.

NeoMaPy addresses this challenge by introducing an efficient, "optimistic" framework for resolving temporal conflicts. Instead of exhaustive mining, it focuses on identifying inconsistencies and determining the most probable, consistent set of facts—a process known as Maximum A Posteriori (MAP) inference.

Methodology: The NeoMaPy Pipeline

The NeoMaPy framework operates through a three-stage pipeline designed to offload computational complexity to optimized graph engines.

The NeoMaPy framework pipeline, from graph extraction to MAP inference.
  1. TMLN Formalization: The system extends standard MLNs into Temporal Markov Logic Networks (TMLNs). This extension introduces "sorts" (types such as 'person' or 'time'), weights for both rules and facts, and specific temporal consistency constraints (e.g., "a player cannot play for two teams simultaneously").
  2. Conflict Graph Extraction: Rather than performing exhaustive mining, NeoMaPy transforms raw data into a property graph within a Neo4j database. Facts are represented as nodes, and logical rules are converted into Cypher queries. These queries identify "conflicts" between facts—such as overlapping timeframes for mutually exclusive events—and establish edges between them.
  3. Heuristic MAP Inference: Once the conflict graph is constructed, the MaPy algorithm takes over. It decomposes the graph into independent connected components and employs a heuristic search to identify the "maximal consistent subset" of facts. This "optimistic" approach prioritizes building compatible worlds over searching through the entire space of possibilities.

Temporal Semantics and Consistency

A key innovation of NeoMaPy is its support for parametric semantics, allowing users to define the "strictness" of temporal logic based on the domain's requirements.

Definitions of temporal consistency and inconsistency used in the framework.

Users can toggle between different levels of consistency:

  • Partial Temporal Consistency: Allows for some degree of overlap between facts.
  • Total Temporal Consistency: Enforces strict non-overlap for mutually exclusive events.
  • Temporal Inconsistency: Identifies scenarios where facts explicitly clash in time.

This flexibility ensures that the framework can be tailored to various types of temporal data, from rigid historical timelines to more fluid event logs.

Case Study: Analyzing the Career of Pelé

The authors demonstrated the framework using a dataset of football (soccer) facts centered on the career of the legendary player Pelé. The dataset included facts about the teams he played for (e.g., Santos, New York Cosmos, Brazil national team) and the corresponding years. Logical rules were applied to resolve discrepancies, such as ensuring a player is not recorded as playing for two different clubs at the same time or playing before their birth date.

Key Results and Insights

NeoMaPy shifts MAP inference away from heavy, exhaustive data mining toward a more scalable graph-based approach. By leveraging Neo4j and Cypher, the framework offloads pattern matching to a highly optimized engine, significantly improving performance. Furthermore, the decomposition of the conflict graph into connected components allows the MaPy algorithm to solve sub-problems in parallel.

The framework also emphasizes explainability. Because the system is graph-based, users can interactively explore why certain facts were excluded. If a fact is deemed "false," the user can trace the specific rules and conflicting facts that led to that decision. The authors also developed a functional GUI that provides real-time statistics on graph quality and consistency during the inference process.

Limitations and Future Work

While NeoMaPy offers significant efficiency gains, it relies on a heuristic search to maintain speed, which may find "near-optimal" rather than absolute mathematical maximums in highly complex cases. Additionally, the current version requires rules to be predefined. Future research could integrate automated rule mining to discover temporal constraints directly from the data before running the inference engine.

Summary updated

BibTeX
@inproceedings{david2023neomapy,
  author = {Victor David and Raphaël Fournier-S'niehotta and Nicolas Travers},
  title = {{NeoMaPy: A Framework for Computing MAP Inference on Temporal Knowledge Graphs}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/831},
}
Figure