1. Introduction
The Internet has evolved beyond a platform for communication, transactions, and cloud storage. It is now a large and continuously expanding knowledge repository, where both humans and machines create, share, and analyze information. The Semantic Web was proposed to enable machine-understandable data and automated reasoning through the Semantic Web Layer Cake framework [
1]. At the core of this framework lies the Resource Description Framework (RDF), which provides a standard model for representing knowledge as triples of the form
.
Despite its simplicity and widespread adoption, standard RDF is limited to representing binary relationships. Modeling more complex n-ary relationships often requires reification or additional extensions, which increase modeling complexity and may introduce performance overhead. These limitations become more pronounced when RDF is used to represent dynamic and evolving knowledge.
Temporal information is a fundamental aspect of many real-world applications, including legal records, financial systems, scientific data management, and historical knowledge bases. Temporal data can generally be classified into two types: valid time, which indicates when a fact holds in the real world, and transaction time, which records when that fact is stored, updated, or deleted in a data store. Temporal relational databases emphasize the importance of managing both dimensions of time to support auditing, historical queries, and data consistency.
Similarly, there is a growing need to support temporal semantics in RDF and RDF Schema. Temporal RDF extensions aim to capture the evolution of knowledge over time and enable historical reasoning. However, many existing approaches treat time as an attribute, rely heavily on reification, or support only a single temporal dimension. As a result, these models often suffer from increased structural complexity, limited extensibility, or unclear implementation strategies.
The BiTemporal RDF model (BiTRDF) addresses these challenges by uniformly extending RDF with both valid time and transaction time. In this model, time is treated as a reference, embedding temporal semantics directly into RDF resources rather than appending timestamps as auxiliary attributes. This design avoids the complexity of reification-based approaches for managing temporal knowledge [
2,
3]. In BiTRDF, all resources and relationships are inherently bitemporal, leading to cleaner semantics and stronger temporal consistency. While prior work has established the theoretical foundation of BiTRDF, practical questions remain open. In particular, it is unclear how BiTRDF can be efficiently implemented, stored, queried, and scaled using existing programming languages and data management technologies.
The goal of this paper is to bridge this gap between theory and practice. We explore multiple implementation strategies for BiTRDF by combining object-oriented programming techniques with database-oriented designs. Rather than proposing a single implementation, we investigate and compare six alternative approaches, each representing a different trade-off among flexibility, performance, memory consumption, and scalability. Through systematic experimentation, we evaluate these approaches using datasets of varying sizes and analyze their behavior under common operations such as data loading and querying.
To achieve the above goals, the following three considerations guided our study:
Mapping BiTRDF effectively to the relational and object-oriented structures while maintaining temporal coherence.
The performance trade-offs between memory-centric and storage-centric designs.
Scaling various implementations when dataset sizes exceed physical memory.
The remainder of this paper is organized as follows.
Section 2 reviews related work on temporal RDF extensions and bitemporal data management.
Section 3 summarizes the key definitions and principles of the BiTemporal RDF model.
Section 4 presents the design and implementation of the six BiTRDF approaches, including a running example and query illustrations.
Section 5 describes the experimental setup and evaluation methodology, followed by a comparative analysis of performance results and a discussion of the findings in
Section 6. Finally,
Section 7 concludes the paper with recommendations and directions for future work.
4. Implementation Design
An RDF store is responsible for persistently storing, managing, and querying RDF graphs. Since BiTRDF extends the standard RDF model with bitemporal semantics, its implementation must support the creation, storage, retrieval, and querying of
bitemporal resources and
bitemporal triples, while preserving temporal coherence and acceptable query performance. Building upon the formal definitions of
and
introduced in
Section 3, we now translate these theoretical constraints, particularly the Triple Integrity Rule, into concrete data structures and logic.
This section presents two implementation strategies for BiTRDF. The first strategy adopts a relational database perspective using PostgreSQL and emphasizes persistence, indexing, and scalability. The second strategy follows an object-oriented programming (OOP) design implemented in Python (Version:3.8.8) and emphasizes flexibility, modularity, and in-memory performance. These approaches demonstrate trade-offs among performance, memory usage, extensibility, and system complexity. Particular attention is given to indexing and search mechanisms, since query processing is a central requirement of temporal knowledge stores.
4.1. Relational Database Implementation Using PostgreSQL
Relational database systems provide a mature and robust foundation for managing structured and persistent data. While native RDF stores exist, many systems cannot efficiently support complex interval-based logic [
2]. In particular, most RDF engines are designed around fixed triple-based schemas and typically support temporal information through reification, named graphs, or annotation patterns, which introduce additional structural overhead and complicate query processing. PostgreSQL was specifically chosen due to its support of custom composite data types and GiST indexing, which are better suited for bitemporal interval arithmetic than standard triple-store indexing [
17]. These features enable bitemporal attributes to be modeled directly and evaluated efficiently using native database operations, rather than being encoded indirectly within RDF structures. Furthermore, this choice enables precise control over storage layout and indexing strategies, which is essential for systematically evaluating the performance trade-offs of different BiTRDF implementations.
The database schema follows established principles of temporal database design [
18] and maps BiTRDF concepts directly to relational constructs. The design consists of one composite data type and three core tables.
Bitemporal Resource Data Type: PostgreSQL allows users to define custom composite data types using the CREATE TYPE statement. To represent bitemporal resources, we define a composite type named BiTemporalResource, which encapsulates both valid-time and transaction-time intervals:
![Informatics 13 00061 i001 Informatics 13 00061 i001]()
The Name field represents a standard RDF resource identifier, while the remaining fields capture its valid-time and transaction-time intervals. This data type directly corresponds to the BiTRDF resource model and is reused across tables to ensure consistency and simplify temporal query processing.
Bitemporal Triple Table: Bitemporal triples are stored in a dedicated table named BiTemporalTripleTable:
![Informatics 13 00061 i002 Informatics 13 00061 i002]()
Each row represents a single bitemporal triple. The Id column uniquely identifies a triple and supports indexing and future extensions. Subjects and objects are stored as resource identifiers, while predicates are stored using the BiTemporalResource type to capture their temporal semantics. This design preserves the temporal integrity of relationships while avoiding unnecessary duplication of entity-level temporal data.
Entity and Predicate Tables: To manage temporal metadata for entities and predicates independently, two additional tables are defined:
![Informatics 13 00061 i003 Informatics 13 00061 i003]()
These tables store the temporal lifespans of subjects, objects, and predicates. Primary key constraints enforce uniqueness and allow efficient lookup of bitemporal resources during query execution and integrity validation.
Indexing and Query Efficiency: Efficient query processing is critical for RDF stores. PostgreSQL automatically creates B-tree indexes for primary keys, enabling fast retrieval of entities and predicates. Additional indexes are defined on the triple table to support common RDF access patterns:
![Informatics 13 00061 i004 Informatics 13 00061 i004]()
These indexes correspond to standard subject–predicate–object permutations and allow queries constrained by any triple component to be evaluated efficiently. B-tree indexes provide logarithmic-time complexity and support both exact matching and range-based temporal conditions.
4.2. Object-Oriented Implementation Using Python
In addition to the database-oriented approach, BiTRDF can be implemented using an object-oriented design in Python. This approach emphasizes modularity, extensibility, and ease of experimentation, making it well-suited for prototyping and in-memory analytics.
Input Processing and Parsing: The implementation reads BiTRDF graphs expressed in Turtle syntax [
19]. Each input line represents a bitemporal triple. The input processor parses the file sequentially and decomposes each line into RDF resources, temporal intervals, and structural relationships. For simplicity, input files are assumed to be syntactically correct.
Construction of Bitemporal Components: The object-oriented design decomposes BiTRDF construction into several modular components:
Resource Constructor, which converts IRIs, literals, or blank nodes into RDF resource objects;
Temporal Data Constructor, which extracts temporal annotations and constructs valid-time and transaction-time intervals;
Bitemporal Resource Constructor, which combines RDF resources with temporal intervals;
Bitemporal Triple Constructor, which assembles bitemporal subjects, predicates, and objects while enforcing BiTemporal Triple Integrity.
This modular structure makes it straightforward to extend the system with additional dimensions, such as confidence values or spatial attributes. The overall input–process–output workflow is summarized in
Table A1.
Query Processing and Serialization: A unified query processor supports pattern-based searches over bitemporal triples. Queries may constrain subjects, predicates, objects, valid time, transaction time, or combinations of these dimensions. The processor is designed to be generic and parameter-driven, enabling flexible query formulation.
The system also supports serialization, allowing stored knowledge to be exported back into Turtle format. This ensures consistency between input and output representations and supports interoperability with other RDF tools. The BiTRDF model is defined at the conceptual level and is independent of any specific RDF serialization format. While Turtle is used in our implementation for readability, the underlying bitemporal semantics can be preserved in alternative formats such as N-Triples or JSON-LD, provided that valid-time and transaction-time intervals are explicitly encoded as part of the resource representation. In this implementation, temporal intervals are represented as structured literal values, which can be consistently serialized across formats. As long as the temporal components and integrity constraints of BiTRDF are maintained, the choice of serialization does not affect the correctness of the model.
In-Memory Indexing with Dictionaries: To support fast in-memory queries, the OOP implementation uses Python dictionaries as indexing structures. Dictionaries provide hash-based access with constant-time lookup on average. Three nested dictionary indexes are maintained:
Subject-indexed:
Predicate-indexed:
Object-indexed:
This design enables efficient queries but increases memory usage and update overhead because all indexes must remain synchronized. This reflects a common space–time trade-off in knowledge store design.
5. Experiments
The goals of the experimental evaluation are threefold: (1) to demonstrate that BiTRDF knowledge stores can be correctly constructed and queried; (2) to validate the correctness of bitemporal querying under valid-time and transaction-time constraints; (3) to compare the performance of different implementation alternatives in terms of memory usage, loading time, and query efficiency.
7. Conclusions
This paper presents the first systematic study of practical implementation methods for the BiTemporal RDF model. Through a comprehensive experimental evaluation of six implementation alternatives, we examined how different design choices affect memory consumption, loading time, and query performance across knowledge stores of increasing size.
The results show that, for small-scale knowledge stores, all alternatives perform similarly. When sufficient RAM is available (up to approximately one million triples), loading times remain under 30 s and query times remain below 0.5 s for all implementations. At this scale, the choice of implementation has little impact on overall system performance, allowing developers to prioritize design clarity and extensibility.
Performance differences become pronounced once the knowledge store exceeds available memory. For datasets larger than two million triples, database-oriented implementations consistently outperform object-oriented ones in both loading and querying. At the largest scale tested (16 million triples), the OOP + Dictionary alternative requires 2849 s to load the data, while the Database + Dictionary alternative completes loading in only 91.9 s. A similar gap is observed in query performance, where OOP + Dictionary requires 67 s, compared to 15.25 s for the PostgreSQL-based implementation. The results show that the storage strategy is critical for scalability.
Beyond quantitative performance, the architectural trade-offs among the alternatives are critical. While database-oriented designs favor retrieval efficiency, the Object-oriented implementations closely align with the BiTRDF conceptual model and provide strong flexibility and extensibility. These methods allow developers to modify bitemporal resource definitions, introduce additional dimensions, or adapt parsing and serialization logic with minimal effort. For applications that operate on moderate-sized knowledge stores or emphasize rapid development and experimentation, these methods offer a practical and maintainable solution.
Unlike SPARQL and its extensions, such as C-SPARQL, which primarily address temporal aspects at the query level through filtering or stream processing, our implementation focuses on embedding bitemporal semantics directly at the data model and storage level. This resource-level approach avoids reliance on reification or auxiliary structures to represent temporal information, thereby reducing structural overhead and improving efficiency. As a result, the proposed implementation provides a practical storage and indexing foundation that can support existing or future temporal SPARQL extensions.
The main contributions of this paper are summarized as follows:
Presenting the first comprehensive study of practical implementation strategies for the BiTemporal RDF model.
Designing and implementing six alternative approaches for storing and managing BiTRDF knowledge stores using Python and PostgreSQL.
Empirically evaluating these approaches based on memory consumption, data loading time, and query performance across multiple dataset scales.
Analyzing the strengths and limitations of each approach and providing practical guidance for selecting suitable implementation strategies under different system requirements.
Rather than delivering a fully production-ready BiTRDF system, this study demonstrates the feasibility of the BiTRDF model and highlights key design considerations for its implementation. Several directions remain open for future work, including support for update and deletion operations, conversion between BiTRDF and standard RDF, integration with SPARQL-based querying, and the development of temporal inference mechanisms. Together, these extensions would further advance the adoption of bitemporal semantics in RDF-based knowledge systems.