What is Magritte?

The Magritte framework is a versatile tool designed to facilitate the execution of Tara models. Its functionality lies in its ability to combine core code with generated code, adapting to various model definitions. Magritte enables efficient execution of Tara models, regardless of the specific specifications of these models. Among its notable features is the ability to identify and manage fundamental concepts essential for the execution of Tara models. Additionally, it provides support for handling dynamic polymorphism, allowing for effective management of dynamic addition and removal of facets in nuclear concepts. In summary, Magritte offers a practical and flexible solution for executing Tara models, standing out for its ability to adapt to different contexts and user needs.

Architecture

Magritte consists of two essential components: the codebase and the code generator. The codebase forms the bedrock of the framework, offering crucial support for executing Tara models. Within this foundational library, core concepts are meticulously crafted to meet the specific needs of model execution. These core concepts encapsulate the fundamental structures, functions, and interactions essential for the seamless functioning of Tara models. With a robust and purpose-built codebase, Magritte ensures a reliable and efficient execution process.

The code generator complements the codebase by dynamically building classes based on interpreted Tara models. It acts as a bridge between abstract definitions within a Tara model and practical implementation details in programming languages like Java. Proficient at parsing Tara models intricacies, the code generator autonomously generates classes aligning with the model's domain concepts. This automation accelerates implementation and equips programmers with a ready-to-use set of classes. By seamlessly translating Tara models into executable code, Magritte's code generator enhances the accessibility and usability of Tara models, offering a more intuitive and developer-friendly experience.

Architecture.
Architecture.

Codebase

Let's break down the architecture of Magritte's codebase in a user-friendly manner. At the heart of Magritte's design is a graph-based structure, visualized through a Unified Modeling Language (UML) diagram. This structure revolves around classes and nodes, which together form the backbone of your model.

  • Graph Structure: The class graph is central to Magritte's architecture. It's like a map that guides the behavior of your model. Imagine you're modeling a city. Magritte's graph wrappers help you navigate through essential elements like buildings, cars, and roads. These wrappers are dynamically generated by Magritte's code generator, ensuring they fit seamlessly into your specific model.
  • Concepts and Nodes: In Magritte, concepts are like the guiding principles of your model, similar to how Java uses reflection. They define relationships, attributes, and parameters. Nodes, on the other hand, are instances of concepts. They represent specific objects within your model, like a particular building or car. Nodes can dynamically adapt, with layers representing different aspects that can be added or removed during runtime. This flexibility allows your model to evolve without starting from scratch, a feature known as dynamic polymorphism. For instance, in a school setting, a teacher might temporarily take on the role of a parent, and Magritte allows you to adjust the node accordingly.
  • Code Generation: Magritte's code generator is a key player. It automatically creates classes tailored to your model's specifications. For example, if your model includes different types of cars, the code generator generates classes for each type, like a regular car and an electric car. These generated classes enable smooth interaction with nodes in your model, ensuring everything runs seamlessly.
  • Graph Persistence: Magritte's codebase offers a convenient way to persist your graph data into smaller, more manageable packages called stashes. These stashes logically organize root nodes based on their stash identifier. What's neat is that you can implement this persistence system using various methods like in-memory data storage, hard disk, or cloud storage, thanks to its adherence to a Liskov contract.
  • Cloning Graphs and Nodes: Sometimes, you might need to work with copies of your graphs or nodes for specific purposes. Magritte's codebase allows you to clone both graphs and nodes effortlessly. This feature comes in handy when loading the entire structure into memory isn't feasible, or when you need to diverge graphs or nodes for different applications.
  • Executing Inserted Functions: Magritte's codebase also empowers you to execute functions that you've inserted into your Tara models. These Tara models can integrate native code, usually in Java, which the code generator translates into Java classes. These classes can then be executed by the codebase, performing tasks like initializing variables or acting as callable methods that you can query at different stages of execution. This capability adds a layer of flexibility to your model execution, allowing you to incorporate custom functionalities seamlessly.