Semantically Reflected Programs

📅 2025-09-03
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Existing approaches suffer from a formal disconnect between program structural knowledge and behavioral knowledge, limiting the integration of domain semantics into executable code. Method: This paper proposes Semantic Lifting—a novel technique that enables dynamic, type-safe mapping of object-oriented program runtime states to knowledge graphs directly at the programming language level. Implemented in the SMOL language, it introduces an embedded semantic reflection layer unifying ontology modeling, static typing, and runtime program analysis. Contribution/Results: The approach natively supports domain knowledge representation, real-time semantic querying, and virtualized intervention, bridging the formal gap between system structure and behavior—extending reflection beyond syntactic constructs. An open-source implementation and a geological modeling case study demonstrate guaranteed query type safety and substantial improvements in both expressivity and operability of domain knowledge within programs.

Technology Category

Application Category

📝 Abstract
This paper addresses the dichotomy between the formalization of structural and the formalization of behavioral knowledge by means of semantically lifted programs, which explore an intuitive connection between programs and knowledge graphs. While knowledge graphs and ontologies are eminently useful to represent formal knowledge about a system's individuals and universals, programming languages are designed to describe the system's evolution. To address this dichotomy, we introduce a semantic lifting of the program states of an executing program into a knowledge graph, for an object-oriented programming language. The resulting graph is exposed as a semantic reflection layer within the programming language, allowing programmers to leverage knowledge of the application domain in their programs. In this paper, we formalize semantic lifting and semantic reflection for a small programming language, SMOL, explain the operational aspects of the language, and consider type correctness and virtualisation for runtime program queries through the semantic reflection layer. We illustrate semantic lifting and semantic reflection through a case study of geological modelling and discuss different applications of the technique. The language implementation is open source and available online.
Problem

Research questions and friction points this paper is trying to address.

Bridging formalization gap between structural and behavioral knowledge
Integrating knowledge graphs with object-oriented programming languages
Enabling runtime program queries through semantic reflection layers
Innovation

Methods, ideas, or system contributions that make the work stand out.

Semantic lifting of program states
Knowledge graph reflection layer integration
Runtime program queries via reflection
🔎 Similar Papers
No similar papers found.