diff --git a/.editorconfig b/.editorconfig
index ec73f67a5..390b1939d 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -14,13 +14,6 @@ ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false
-[*.{kt,kts}]
-ij_kotlin_allow_trailing_comma = false
-ij_kotlin_allow_trailing_comma_on_call_site = false
-ij_kotlin_name_count_to_use_star_import = 999
-ij_kotlin_name_count_to_use_star_import_for_members = 999
-
-
[*.java]
ij_java_align_consecutive_assignments = false
ij_java_align_consecutive_variable_declarations = false
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
deleted file mode 100644
index 027d689b5..000000000
--- a/.github/workflows/deploy.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: Maven Deploy
-
-on:
- push:
- branches:
- - 'main' # Build the latest develop-SNAPSHOT
- paths:
- - '**/src/**'
- - '**/pom.xml'
- - 'pom.xml'
-
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-jobs:
- publish:
- uses: ardoco/actions/.github/workflows/maven.yml@main
- with:
- deploy: true
- with-submodules: true
- runs-on: ubuntu-latest
- secrets:
- OSSRH_USER: ${{secrets.OSSRH_USER}}
- OSSRH_TOKEN: ${{secrets.OSSRH_TOKEN}}
- GPG_KEY: ${{secrets.GPG_KEY}}
-
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
deleted file mode 100644
index 8735d90fc..000000000
--- a/.github/workflows/docs.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-name: Documentation
-
-on:
- push:
- branches:
- - main
- tags: "v**"
- paths:
- - 'docs/**'
- - '.github/workflows/docs.yml'
- workflow_dispatch:
-
-jobs:
- docs:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- with:
- token: ${{ secrets.SDQ_TOKEN }}
- - uses: actions/checkout@v4
- with:
- repository: ${{ github.repository }}.wiki
- path: wiki
- token: ${{ secrets.SDQ_TOKEN }}
-
- - name: Remove contents in Wiki
- working-directory: wiki
- run: ls -A1 | grep -v '.git' | xargs rm -r
-
- - name: Copy Wiki from Docs folder
- run: cp -r ./docs/. ./wiki
-
- - name: Deploy 🚀
- uses: stefanzweifel/git-auto-commit-action@v5
- with:
- repository: wiki
diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
deleted file mode 100644
index 63113e799..000000000
--- a/.github/workflows/sonarcloud.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Sonar Cloud
-
-on:
- push:
- branches:
- - main
- pull_request:
- types: [opened, synchronize, reopened]
-
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-jobs:
- sonarcloud:
- if: ${{ github.actor != 'dependabot[bot]' }}
- uses: ardoco/actions/.github/workflows/sonarcloud.yml@main
- with:
- with-submodules: true
- runs-on: ubuntu-latest
- secrets:
- SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
-
diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml
index 530378687..23bcc051e 100644
--- a/.github/workflows/verify.yml
+++ b/.github/workflows/verify.yml
@@ -20,7 +20,7 @@ jobs:
with-submodules: true
runs-on: ubuntu-latest
secrets:
- OSSRH_USER: ""
- OSSRH_TOKEN: ""
+ CENTRAL_USER: ""
+ CENTRAL_TOKEN: ""
GPG_KEY: ""
diff --git a/README.md b/README.md
index 90b90a5a5..4c9de41da 100644
--- a/README.md
+++ b/README.md
@@ -1,55 +1,9 @@
-# ArDoCo Core
+# ArDoCo Core Framework
-[](https://github.com/ArDoCo/Core/actions/workflows/verify.yml)
-[](https://maven-badges.herokuapp.com/maven-central/io.github.ardoco.core/parent)
-[](https://sonarcloud.io/dashboard?id=ArDoCo_Core)
-[](https://github.com/ArDoCo/Core/releases/latest)
-[](https://doi.org/10.5281/zenodo.7274034)
+The goal of this project is to define the core elements for TLR and inconsistency detection in ArDoCo.
+For more information about the ArDoCo project visit the website at [ArDoCo](https://ardoco.de).
-The goal of the ArDoCo project is to connect architecture documentation and models with Traceability Link Recovery (TLR) while identifying missing or deviating elements (inconsistencies).
-An element can be any representable item of the model, like a component or a relation.
-To do so, we first create trace links and then make use of them and other information to identify inconsistencies.
-
-ArDoCo is actively developed by researchers of the _[Modelling for Continuous Software Engineering (MCSE) group](https://mcse.kastel.kit.edu)_ of _[KASTEL - Institute of Information Security and Dependability](https://kastel.kit.edu)_ at the [KIT](https://www.kit.edu).
-
-This **Core** repository contains the framework and core definitions for the other approaches.
-As such, there is the definition of our pipeline and the data handling as well as the definitions for the various pipeline steps, inputs, outputs, etc.
-
-For more information about the setup, the project structure, or the architecture, please have a look at the [Wiki](https://github.com/ArDoCo/Core/wiki).
-
-## Maven
-
-```xml
-
-
-
- io.github.ardoco.core
- framework
- VERSION
-
-
-```
-
-For snapshot releases, make sure to add the following repository
-
-```xml
-
-
-
-
- false
-
-
- true
-
- mavenSnapshot
- https://s01.oss.sonatype.org/content/repositories/snapshots
-
-
-```
-
-## Relevant repositories
-The following is an excerpt of repositories that use this framework and implement the different approaches and pipelines of ArDoCo:
-* [ArDoCo/TLR](https://github.com/ArDoCo/TLR): implementing different traceability link recovery approaches
-* [ArDoCo/InconsistencyDetection](https://github.com/ArDoCo/InconsistencyDetection): implementing inconsistency detection approaches
-* [ArDoCo/LiSSA](https://github.com/ArDoCo/LiSSA): implementing processing of sketches and diagrams for, e.g., TLR
\ No newline at end of file
+ArDoCo is actively developed by researchers of
+the _[Modelling for Continuous Software Engineering (MCSE) group](https://mcse.kastel.kit.edu)_
+of _[KASTEL - Institute of Information Security and Dependability](https://kastel.kit.edu)_ at
+the [KIT](https://www.kit.edu).
diff --git a/docs/Home.md b/docs/Home.md
deleted file mode 100644
index 5189f724b..000000000
--- a/docs/Home.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# ArDoCo
-
-
-
-
-
-ArDoCo (Architecture Documentation Consistency) is a framework to connect architecture documentation and models while
-identifying missing or deviating elements (inconsistencies). An element can be any representable item of the model, like
-a component or a relation. To do so, ArDoCo first creates trace links and then makes use of them and other information
-to identify inconsistencies.
-
-You can find ArDoCo on the [website](https://ardoco.de) and [on GitHub](https://github.com/ArDoCo).
-
-Before contributing, please read the [Quickstart Guide](quickstart).
-
-
-
-To get to know the project, please read the following pages:
-
-* [Core Pipeline Definition](pipeline)
-* [Intermediate Artifacts](intermediate-artifacts)
-* [Text Preprocessing Microservice](Text-Preprocessing-Microservice)
-* [Traceability Link Recovery (TLR)](traceability-link-recovery)
-* [Inconsistency Detection (ID)](inconsistency-detection)
-* [LiSSA Retrieval-Augmented TLR](LiSSA)
-
-## Project Structure
-
-* [Core](https://github.com/ArDoCo/Core): Core framework with framework and API definitions
-* Pipelines
- * [TLR](https://github.com/ArDoCo/TLR): Traceability Link Recovery (TLR) Modules
- * [StanfordCoreNLP-Provider-Service](https://github.com/ArDoCo/StanfordCoreNLP-Provider-Service): RESTful web service for text preprocessing
- * [InconsistencyDetection](https://github.com/ArDoCo/InconsistencyDetection): Inconsistency Detection (ID) Modules
- * [LiSSA-RATLR](https://github.com/ArDoCo/LiSSA-RATLR): LiSSA - A Framework for Generic Traceability Link Recovery
-* Testing and Evaluation
- * [IntegrationTests](https://github.com/ArDoCo/IntegrationTests): Integration Tests
- * [Benchmark](https://github.com/ArDoCo/Benchmark): Benchmarks
- * [Evaluator](https://github.com/ArDoCo/Evaluator): Evaluation code that compares CSVs (e.g., output and gold standard)
- * [SimpleTracelinkDiscovery](https://github.com/ArDoCo/SimpleTracelinkDiscovery): Baseline approach
-* GUIs, CLIs, etc.
- * [TraceView](https://github.com/ArDoCo/TraceView): WIP visualisation of the outputs for TLR and ID
- * *outdated* [CLI](https://github.com/ArDoCo/CLI): Command Line Interface (*outdated*)
-* [actions](https://github.com/ArDoCo/actions): Reusable GitHub Actions
-
-## System Requirements
-
-The project requires **JDK 21**.
-Furthermore, we advise at least **4 GB of RAM**.
-
-## Benchmarks
-
-You can test ArDoCo using the projects provided in our [Benchmark repository](https://github.com/ArDoCo/Benchmark).
-
-## Related Publications
-
-* J. Keim, S. Corallo, D. Fuchß, T. Hey, T. Telge und A. Koziolek. "Recovering Trace Links Between Software Documentation And Code". 2024. In: Proceedings of 46th IEEE International Conference on Software Engineering (ICSE 2024). [doi:10.5445/IR/1000165692](https://doi.org/10.5445/IR/1000165692/post)
-
-* J. Keim, S. Corallo, D. Fuchß und A. Koziolek. "Detecting Inconsistencies in Software Architecture Documentation Using Traceability Link Recovery". 2023. In: IEEE 20th International Conference on Software Architecture (ICSA 2023). [doi:10.1109/ICSA56044.2023.00021](https://doi.org/10.1109/ICSA56044.2023.00021)
-
-* D. Fuchß, S. Corallo, J. Keim, J. Speit und A. Koziolek. "Establishing a Benchmark Dataset for Traceability Link Recovery between Software Architecture Documentation and Models". 2022. In: 2nd International Workshop on Mining Software Repositories for Software Architecture - Co-located with 16th European Conference on Software Architecture.
-
-* J. Keim, S. Schulz, D. Fuchß, C. Kocher, J. Speit, A. Koziolek. "Trace Link Recovery for Software Architecture Documentation". 2021. In: Software Architecture: 15th European Conference (ECSA 2021). [doi:10.1007/978-3-030-86044-8_7](https://doi.org/10.1007/978-3-030-86044-8_7)
-
-* J. Keim and A. Koziolek. "Towards Consistency Checking Between Software Architecture and Informal Documentation". 2019. In: IEEE 16th International Conference on Software Architecture Companion (ICSA-C). [doi:10.1109/ICSA-C.2019.00052](https://doi.org/10.1109/ICSA-C.2019.00052)
-
-
-The initial version of ArDoCo is based on the master thesis [Linking Software Architecture Documentation and Models](https://publikationen.bibliothek.kit.edu/1000126194).
-
-## Contact
-
-This project is currently developed by researchers of the Karlsruhe Institute of Technology (KIT).
-
-You find us on our websites:
-
-* [Jan Keim](https://mcse.kastel.kit.edu/staff_Keim_Jan.php),
-* [Sophie Corallo](https://mcse.kastel.kit.edu/staff_sophie_corallo.php), and
-* [Dominik Fuchß](https://mcse.kastel.kit.edu/staff_dominik_fuchss.php)
diff --git a/docs/Inconsistency-Detection.md b/docs/Inconsistency-Detection.md
deleted file mode 100644
index ef8f23f23..000000000
--- a/docs/Inconsistency-Detection.md
+++ /dev/null
@@ -1,12 +0,0 @@
-
-Currently, there are two kinds of inconsistencies that are supported by the approach: Missing Model Elements (MMEs) and Undocumented Model Elements (UMEs).
-
-Undocumented Model Elements (UMEs) are elements within the Software Architecture Model (SAM) that are not documented in the natural language Software Architecture Documentation (SAD).
-Our heuristic looks for model elements that do not have any (or below a certain threshold, per default 1) trace links associated with them.
-In the configuration options, you can fine tune the threshold as well as set up a regex-based whitelist.
-
-Missing Model Elements (MMEs) are architecture elements that are described within the SAD that cannot be traced to the SAM.
-For this, we make use of the recommendations from the Recommendation Generator within the [Traceability Link Recovery (TLR)](traceability-link-recovery).
-Each of these recommendations that are not linked with a model element are potential inconsistencies.
-To further increase precision, we make use of filters.
-For example, we use a filter to get rid of commonly used software (development) terminology that look similar to, e.g., components but rarely are model elements.
diff --git a/docs/Intermediate-Artifacts.md b/docs/Intermediate-Artifacts.md
deleted file mode 100644
index da69ec7f5..000000000
--- a/docs/Intermediate-Artifacts.md
+++ /dev/null
@@ -1,128 +0,0 @@
-
-Currently, there are three kinds of intermediate artifacts.
-First, the input text has an internal representation (cf. [edu/kit/kastel/mcse/ardoco/core/api/text/Text.java](https://github.com/ArDoCo/Core/blob/main/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/text/Text.java)) to cover all the annotations from the preprocessing.
-Second, there is the intermediate representation of software architecture models (SAMs) that we cover [below](#software-architecture-models).
-Third, we create a uniform representation for code that we also explain [below](#code).
-
-```mermaid
-classDiagram
- class ModelElement
- class Model
- class Entity
- class CodeModel
- class ArchitectureModel
-
- ModelElement <|-- Entity
- ModelElement <|-- Model
- Model <|-- CodeModel
- Model <|-- ArchitectureModel
- Model "0..1" o--"*" Entity: elements
-```
-
-## Software Architecture Models
-
-```mermaid
-classDiagram
- class Entity
- class ArchitectureItem
- class Component
- class Interface
- class Signature
-
- Entity <|-- ArchitectureItem
- ArchitectureItem <|-- Component
- ArchitectureItem <|-- Interface
- ArchitectureItem <|-- Signature
-
- Interface o-- "*" Signature: signatures
- Interface "*" <-- "*" Component: provided
- Interface "*" <-- "*" Component: required
- Component "*" <-- Component: subcomponents
-```
-
-In this software model, each class is categorized as an ArchitectureItem, which inherits properties from Entity, including a name and identifier.
-There are three types of ArchitectureItems: Component, Interface, and Signature.
-
-A Component represents various architectural elements in different modeling languages.
-For instance, it corresponds to a UML Component.
-In the PCM context, it encompasses both BasicComponent and CompositeComponent.
-BasicComponents do not contain sub-components, while CompositeComponents may have sub-components.
-
-Components can either require or provide Interfaces.
-Provided Interfaces are implemented by the Component, while Required Interfaces specify the functionality required by a Component.
-
-An Interface contains multiple method Signatures.
-Signatures are linked to Interfaces in a composite relationship, meaning each Signature is associated with an Interface.
-
-
-## Code
-
-```mermaid
-classDiagram
- class Entity
- class CodeItem
- class Module
- class Package
- class CompilationUnit
- class CodeAssembly
- class ComputationalObject
- class ControlElement
- class Datatype
- class ClassUnit
- class InterfaceUnit
-
- Entity <|-- CodeItem
- CodeItem <|-- ComputationalObject
- CodeItem <|-- Module
- CodeItem <|-- Datatype
- ComputationalObject <|-- ControlElement
- Module <|-- Package
- Module <|-- CompilationUnit
- Module <|-- CodeAssembly
- Datatype <|-- ClassUnit
- Datatype <|-- InterfaceUnit
-
- Module "0..1" o--> "*" CodeItem: codeElements
- ClassUnit "0..1" o--> "*" CodeItem: codeElements
- InterfaceUnit "0..1" o--> "*" CodeItem: codeElements
- Datatype "*" <-- "*" Datatype: implementedTypes
- Datatype "*" <-- "*" Datatype: extendedTypes
-```
-
-The intermediate model for code is based on the source code package within the [Knowledge Discover Model (KDM)](https://www.omg.org/spec/KDM/1.3/PDF).
-
-The different classes in the code model inherit from CodeItem, which itself is a specialized Entity.
-Thus, each class has a name and identifier.
-
-There are three kinds of source code elements: Module, Datatype, and ComputationalObject.
-
-Modules are typically logical components of the system with a certain level of abstraction.
-A Module can contain CodeItems, and there are three differentiations of Modules: CompilationUnit, Package, and CodeAssembly.
-
-A CompilationUnit represents a source file where code is stored.
-It includes a relative path to the file's location on disk and its programming language.
-The CompilationUnit is partly based on the InventoryModel from KDM.
-
-A Package is a logical collection of source code elements (i.e., CodeItems).
-Packages can also contain sub-Packages, similar to the structure commonly found in Java.
-
-A CodeAssembly consists of source code artifacts linked together to make them runnable.
-For example, source code files together with their headers are grouped in a CodeAssembly.
-
-There are two kinds of Datatypes: CodeUnit and InterfaceUnit.
-A CodeUnit is akin to a class in Java and can contain other CodeItems like methods and inner classes.
-Similarly, an InterfaceUnit can also contain code elements like methods.
-
-The relationships implementedTypes and extendedTypes from the KDM model are present in the intermediate model.
-A Datatype can implement an arbitrary number of extendedTypes relations, representing inheritance in object-oriented programming languages.
-
-The construction around extendedTypes and implementedTypes also enables interfaces to extend other interfaces, akin to Java.
-Interfaces can also extend classes, a feature present in some programming languages like TypeScript.
-
-The KDM includes several primitive datatypes like boolean, which are not realized within this model as they are not currently needed.
-If future work extends the approaches with a thorough comparison of datatypes, then the intermediate model may need further sub-classing of the KDM.
-
-Currently, there is only one type of ComputationalObject: the ControlElement.
-The ControlElement represents callable parts with specific behaviors, such as functions, procedures, or methods.
-Unlike the KDM, this work does not make a further distinction between CallableUnits and MethodUnits.
-Additionally, it does not utilize parameters, return types, or similar elements of the KDM and therefore does not model them.
diff --git a/docs/LiSSA.md b/docs/LiSSA.md
deleted file mode 100644
index d793f640d..000000000
--- a/docs/LiSSA.md
+++ /dev/null
@@ -1,112 +0,0 @@
-# LiSSA: A Framework for Generic Traceability Link Recovery
-
-Welcome to the LiSSA project!
-This framework leverages Large Language Models (LLMs) enhanced through Retrieval-Augmented Generation (RAG) to establish traceability links across various software artifacts.
-
-## Overview
-
-In software development and maintenance, numerous artifacts such as requirements, code, and architecture documentation are produced.
-Understanding the relationships between these artifacts is crucial for tasks like impact analysis, consistency checking, and maintenance.
-LiSSA aims to provide a generic solution for Traceability Link Recovery (TLR) by utilizing LLMs in combination with RAG techniques.
-
-The concept and evaluation of LiSSA are detailed in our paper:
-
-> Fuchß, D., Hey, T., Keim, J., Liu, H., Ewald, N., Thirolf, T., & Koziolek, A. (2025). LiSSA: Toward Generic Traceability Link Recovery through Retrieval-Augmented Generation. In Proceedings of the IEEE/ACM 47th International Conference on Software Engineering, Ottawa, Canada.
-
-You can access the paper [here](https://ardoco.de/c/icse25).
-
-## Features
-
-- **Generic Applicability**: LiSSA is designed to recover traceability links across various types of software artifacts, including:
- - [Requirements to code](https://ardoco.de/c/icse25)
- - [Documentation to code](https://ardoco.de/c/icse25)
- - [Architecture documentation to architecture models](https://ardoco.de/c/icse25)
-
-- **Retrieval-Augmented Generation**: By combining LLMs with RAG, LiSSA enhances the accuracy and relevance of the recovered traceability links.
-
-## Getting Started
-
-To get started with LiSSA, follow these steps:
-
-1. **Clone the Repository**:
- ```bash
- git clone https://github.com/ArDoCo/LiSSA-RATLR
- cd LiSSA-RATLR
- ```
-
-2. **Install Dependencies**:
- Ensure you have Java JDK 21 or later installed. Then, build the project using Maven:
- ```bash
- mvn clean package
- ```
-
-3. **Run LiSSA**:
- Execute the main application:
- ```bash
- java -jar target/ratlr-*-jar-with-dependencies.jar eval -c config.json
- ```
-
-### Configuration
-
-1. Create a configuration you want to use for evaluation / execution. E.g., you can find configurations [here](https://github.com/ArDoCo/ReplicationPackage-ICSE25_LiSSA-Toward-Generic-Traceability-Link-Recovery-through-RAG/tree/main/LiSSA-RATLR-V2/lissa/configs/req2code-significance). You can also provide a directory containing multiple configurations.
-2. Configure your OpenAI API key and organization in a `.env` file. You can use the provided template file as a template `env-template`.
-3. LiSSA caches requests in order to be reproducible. The cache is located in the cache folder that can be specified in the configuration.
-4. Run `java -jar target/ratlr-*-jar-with-dependencies.jar eval -c configs/....` to run the evaluation. You can provide a JSON or a directory containing JSON configurations.
-5. The results will be printed to the console and saved to a file in the current directory. The name is also printed to the console.
-
-### Results of Evaluation / Execution
-The results will be stored as markdown files.
-A result file can look like below.
-It contains the configuration and the results of the evaluation.
-Additionally, the LiSSA generate CSV files that contain the traceability links as pairs of identifiers.
-
-
-Example Result
-
-```json
-## Configuration
-{
- "cache_dir" : "./cache-r2c/dronology-dd--102959883",
- "gold_standard_configuration" : {
- "hasHeader" : false,
- "path" : "./datasets/req2code/dronology-dd/answer.csv"
- },
- "... other configuration parameters ..."
-}
-
-## Stats
-* # TraceLinks (GS): 740
-* # Source Artifacts: 211
-* # Target Artifacts: 423
-## Results
-* True Positives: 283
-* False Positives: 1286
-* False Negatives: 457
-* Precision: 0.18036966220522627
-* Recall: 0.3824324324324324
-* F1: 0.24512776093546992
-```
-
-
-
-## Evaluation
-
-LiSSA has been empirically evaluated on three different TLR tasks:
-
-- Requirements to code
-- Documentation to code
-- Architecture documentation to architecture models
-- Requirements to requirements
-
-The results indicate that the RAG-based approach can significantly outperform state-of-the-art methods in code-related tasks.
-However, further research is needed to enhance its performance for broader applicability.
-
-## Acknowledgments
-
-LiSSA is developed by researchers from the Modelling for Continuous Software Engineering (MCSE) group of KASTEL - Institute of Information Security and Dependability at the Karlsruhe Institute of Technology (KIT).
-
-For more information about the project and related research, visit our [website](https://ardoco.de/).
-
----
-
-*Note: This README provides a brief overview of the LiSSA project. For comprehensive details, please refer to the [repository](https://github.com/ArDoCo/LiSSA-RATLR)*
diff --git a/docs/Pipeline.md b/docs/Pipeline.md
deleted file mode 100644
index ee5900b99..000000000
--- a/docs/Pipeline.md
+++ /dev/null
@@ -1,22 +0,0 @@
-
-```mermaid
-classDiagram
- class AbstractPipeline
- class Pipeline
- class PipelineStep
-
- Pipeline--> "*" AbstractPipeline
- Pipeline..|>AbstractPipeline
- PipelineStep..|>AbstractPipeline
-```
-
-For the pipeline definition, we use a composite to allow us to have a multi-level pipeline.
-As such, a pipeline consists of an arbitrary number of either *PipelineStep*s or further *Pipeline*s.
-
-In our approach, we use three levels for our pipeline:
-On the first level, the overall pipeline defines multiple *stages*, e.g., text preprocessing or element connection.
-Each stage is another pipeline that then defines *agents* that have the purpose of initiating the processing and of collecting the information of the various heuristics.
-Agents then use *Informants* as concrete PipelineSteps to execute the processing and heuristics.
-
-A pipeline step (i.e., an Informant) stores results within a repository that can be universally accessed by all pipeline steps, similarly to a blackboard in the blackboard pattern.
-This way, each pipeline step and, thus, each heuristic can access the results of previous steps and provide its results for others.
diff --git a/docs/Quickstart.md b/docs/Quickstart.md
deleted file mode 100644
index 78a4a20aa..000000000
--- a/docs/Quickstart.md
+++ /dev/null
@@ -1,110 +0,0 @@
-
-The ArDoCo is a maven project and can be embedded by using its specs (from the [pom](https://github.com/ArDoCo/Core/blob/main/pom.xml)).
-
-Please acknowledge the [code of conduct](https://github.com/ArDoCo/Core/blob/main/CODE_OF_CONDUCT.md).
-
-## Forking the project & submitting pull requests
-
-This project uses Sonarcloud to check code quality. There are Github Actions that automatically verify the build and
-generate a Sonarcloud-report. Additionally, pull requests are automatically checked. If the build fails or the Quality
-Gate is not passed, it is marked in the Pull Request and you need to fix the PR until it passes. Otherwise, the PR won’t
-get merged.
-
-If you fork the project, make sure to create a Sonarcloud token to make sure everything works for you and the Sonarcloud
-check does not fail. You need to enable Sonarcloud for you and add a Sonarcloud token to the repository of the fork as
-secret.
-
-Follow the following steps to do so:
-
-* Log into SonarCloud and click on your profile and then go to My Account and then Security. Alternatively go directly
- to account/security.
-* Generate your access token for SonarCloud and copy it. The access token will be provided to the build pipeline as a
- secret environment variable.
-* Go to your repository settings in GitHub, then to Secrets
-* Add a new secret with name SONAR_TOKEN and the value of the just generated access token.
-
-### Formatter
-
-Please use the provided [formatter](https://github.com/ArDoCo/Core/blob/main/formatter.xml) when contributing.
-
-Additionally, please make use of the spotless-plugin for maven to format your code. You can run it via `mvn spotless:apply` ([more info about spotless](https://github.com/diffplug/spotless/tree/main/plugin-maven)).
-
-
-### Save Actions (Eclipse)
-
-Go to your Eclipse Workspace folder and open the
-file `.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs`.
-There, exchange all the `sp_cleanup.` properties to the following:
-
-```
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=true
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_functional_interfaces=true
-sp_cleanup.convert_to_enhanced_for_loop=true
-sp_cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
-sp_cleanup.correct_indentation=true
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.insert_inferred_type_arguments=false
-sp_cleanup.lazy_logical_operator=false
-sp_cleanup.make_local_variable_final=true
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.merge_conditional_blocks=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=false
-sp_cleanup.number_suffix=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.push_down_negation=false
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_redundant_modifiers=true
-sp_cleanup.remove_redundant_semicolons=true
-sp_cleanup.remove_redundant_type_arguments=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_array_creation=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.simplify_lambda_expression_and_method_ref=false
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_anonymous_class_creation=false
-sp_cleanup.use_autoboxing=true
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_directly_map_method=false
-sp_cleanup.use_lambda=true
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=true
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=true
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-sp_cleanup.use_unboxing=true
-sp_cleanup.use_var=false
-```
\ No newline at end of file
diff --git a/docs/Text-Preprocessing-Microservice.md b/docs/Text-Preprocessing-Microservice.md
deleted file mode 100644
index 5d5466828..000000000
--- a/docs/Text-Preprocessing-Microservice.md
+++ /dev/null
@@ -1,19 +0,0 @@
-
-Text preprocessing works locally, but there is also the option to host a **microservice** for this.
-The benefit is that the models do not need to be loaded each time, saving some runtime (and local memory).
-
-The microservice can be found at [ArDoCo/StanfordCoreNLP-Provider-Service](https://github.com/ArDoCo/StanfordCoreNLP-Provider-Service/).
-
-The microservice is secured with credentials and the usage of the microservice needs to be activated and the URL of the microservice configured.
-These settings can be provided to the execution via environment variables.
-To do so, set the following variables:
-
-```env
-NLP_PROVIDER_SOURCE=microservice
-MICROSERVICE_URL=[microservice_url]
-SCNLP_SERVICE_USER=[your_username]
-SCNLP_SERVICE_PASSWORD=[your_password]
-```
-
-The first variable `NLP_PROVIDER_SOURCE=microservice` activates the microservice usage.
-The next three variables configure the connection, and you need to provide the configuration for your deployed microservice.
\ No newline at end of file
diff --git a/docs/Traceability-Link-Recovery.md b/docs/Traceability-Link-Recovery.md
deleted file mode 100644
index fddf6de94..000000000
--- a/docs/Traceability-Link-Recovery.md
+++ /dev/null
@@ -1,32 +0,0 @@
-
-There are currently three kinds of TLR approaches that we describe in their corresponding sections:
-
-* [Software Architecture Documentation (SAD) to Model (SAM)](#sad-sam)
-* [Software Architecture Model (SAM) to Code](#sam-code)
-* [SAD to Code via SAM](#sad-sam-code)
-
-
-## SAD-SAM
-
-For Traceability Link Recovery between Software Architecture Documentations (SADs) and Software Architecture Models (SAMs), we use a pipeline approach with different major processing steps:
-
-1. Model Extraction: Processes the architecture model.
-2. Text Preprocessing: Processes the text initially, including basic text processing like tokenization, part-of-speech tagging, dependency parsing.
-3. Text Extraction: Identification of potential parts of interest in the text.
-4. Recommendation Generator: Further processing of interesting parts of text to generate recommendations for parts that should/could be model elements.
-5. Connection Generator: Mapping of recommended parts to model parts.
-
-## SAM-Code
-
-The project ARCOTL (Architecture-Code-Trace Links) aims to automatically generate trace links between Code and a Software Architecture Model (SAM).
-It supports multiple programming languages for the code (Java and Shell) and metamodels for the architecture model (PCM and UML).
-To this end the project introduces intermediate models for the architecture (AMTL - Architecture Model for Trace Links) and Code (CMTL - Code Model for Trace
-Links).
-Trace links are created between instances of these metamodels.
-The trace links each have exactly one architecture endpoint and one code endpoint. This is specified by the TLM (Trace Link Model).
-The AMTL- and CMTL-instances get extracted from the architecture model and from the code.
-
-## SAD-SAM-Code
-
-To recover trace links between SADs and code, we combine the traceability link recovery between [SAD-SAM](#sad-sam) and [SAM-Code](#sam-code).
-Both approaches are executed, and their resulting trace links combined via `TransitiveTraceLinks` that match the parts of the documentation to the parts of code using the model.
diff --git a/docs/_Footer.md b/docs/_Footer.md
deleted file mode 100644
index 41b176f5a..000000000
--- a/docs/_Footer.md
+++ /dev/null
@@ -1 +0,0 @@
-[ArDoCo](https://ardoco.de): **Ar**chitecture **Do**cumentation **Co**nsistency - Providing TLR and Inconsistency Detection between formal models and informal documentation
diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md
deleted file mode 100644
index f2c809422..000000000
--- a/docs/_Sidebar.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Table of Contents
-
-1. [Home](ardoco)
-2. [Quickstart](quickstart)
-3. [Pipeline](pipeline)
-4. [Intermediate Artifacts](intermediate-artifacts)
- 1. [SAM](intermediate-artifacts#software-architecture-models)
- 1. [Code](intermediate-artifacts#code)
-5. [Text Preprocessing Microservice](Text-Preprocessing-Microservice)
-6. [Traceability Link Recovery (TLR)](traceability-link-recovery)
- 1. [SAD-SAM](traceability-link-recovery#sad-sam)
- 1. [SAM-Code](traceability-link-recovery#sam-code)
- 1. [SAD-SAM-Code](traceability-link-recovery#sad-sam-code)
-7. [Inconsistency Detection (ID)](Inconsistency-Detection)
-8. [LiSSA-RATLR](lissa)
\ No newline at end of file
diff --git a/formatter.xml b/formatter.xml
index 93d76cb55..adadf4146 100644
--- a/formatter.xml
+++ b/formatter.xml
@@ -1,380 +1,404 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/framework/common/pom.xml b/framework/common/pom.xml
index 83e402fb8..e90f81c9c 100644
--- a/framework/common/pom.xml
+++ b/framework/common/pom.xml
@@ -28,9 +28,9 @@
commons-io
- org.apache.commons
- commons-compress
- 1.26.2
+ io.github.cdimascio
+ dotenv-java
+ 3.2.0
org.apache.commons
@@ -40,20 +40,16 @@
org.apache.commons
commons-text
-
- org.apache.jena
- jena-arq
- 4.10.0
-
-
- org.apache.jena
- jena-core
- 4.10.0
-
org.apache.opennlp
opennlp-tools
2.3.3
+
+
+ org.slf4j
+ slf4j-api
+
+
org.eclipse.collections
@@ -67,20 +63,11 @@
org.eclipse.jgit
org.eclipse.jgit
+
- org.jgrapht
- jgrapht-core
- ${jgrapht.version}
-
-
- org.jsoup
- jsoup
- 1.17.2
-
-
- org.xerial
- sqlite-jdbc
- 3.46.0.1
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/Disambiguation.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/Disambiguation.java
deleted file mode 100644
index 3a9574bc1..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/Disambiguation.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.*;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-
-import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
-
-/**
- * This class represents an abbreviation with a known set of meanings. An abbreviation is a string such as "ArDoCo" and has the meaning "Architecture
- * Documentation Consistency". The abbreviation that is disambiguated by the meanings of this class is final, but the meanings can be changed. An instance of
- * this class can be serialized and deserialized into JSON using Jackson.
- */
-@Deterministic
-@JsonSerialize(using = Disambiguation.DisambiguationSerializer.class)
-public class Disambiguation implements Comparable, Serializable {
- private final String abbreviation;
- private final SortedSet meanings;
-
- public String getAbbreviation() {
- return abbreviation;
- }
-
- public SortedSet getMeanings() {
- return new TreeSet<>(meanings);
- }
-
- @Override
- public int compareTo(Disambiguation o) {
- return abbreviation.compareTo(o.abbreviation);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj instanceof Disambiguation other) {
- return getAbbreviation().equals(other.getAbbreviation());
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getAbbreviation());
- }
-
- /**
- * Used by the Jackson library to serialize a disambiguation into JSON format.
- */
- public static class DisambiguationSerializer extends JsonSerializer {
- @Override
- public void serialize(Disambiguation abbreviation, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
- jsonGenerator.writeStartObject();
- jsonGenerator.writeStringField("abbreviation", abbreviation.abbreviation);
- jsonGenerator.writeArrayFieldStart("meanings");
- var meanings = abbreviation.meanings;
- for (var meaning : meanings) {
- jsonGenerator.writeString(meaning);
- }
- jsonGenerator.writeEndArray();
- jsonGenerator.writeEndObject();
- }
- }
-
- /**
- * Creates a new disambiguation of the provided abbreviation using the given array of meanings.
- *
- * @param abbreviation the abbreviation that is disambiguated by this instance
- * @param meanings an array of meanings for the abbreviation, may be empty
- */
- @JsonCreator
- public Disambiguation(@JsonProperty("abbreviation") String abbreviation, @JsonProperty("meanings") String[] meanings) {
- this(abbreviation, new TreeSet<>(Arrays.stream(meanings).toList()));
- }
-
- /**
- * Creates a new disambiguation of the provided abbreviation using the given set of meanings.
- *
- * @param abbreviation the abbreviation that is disambiguated by this instance
- * @param meanings a set of meanings for the abbreviation, may be empty
- */
- public Disambiguation(String abbreviation, SortedSet meanings) {
- this.abbreviation = abbreviation;
- this.meanings = new TreeSet<>(meanings);
- }
-
- /**
- * Adds all meanings from another disambiguation to this disambiguation. Be careful, this does not perform any checks regarding the abbreviations.
- *
- * @param other the other disambiguation
- * @return this
- */
- public Disambiguation addMeanings(Disambiguation other) {
- meanings.addAll(other.meanings);
- return this;
- }
-
- /**
- * Searches the text for meanings contained by this disambiguation and replaces them with the abbreviation.
- *
- * @param text the text to search
- * @param ignoreCase whether letter case should be ignored when searching for the meanings
- * @return the abbreviated text
- */
- public String replaceMeaningWithAbbreviation(String text, boolean ignoreCase) {
- var abbreviatedText = text;
- for (String meaning : meanings) {
- String pattern = ignoreCase ? "(?i)" : "";
- pattern += meaning;
- abbreviatedText = abbreviatedText.replaceAll(pattern, abbreviation);
- }
- return abbreviatedText;
- }
-
- /**
- * Merges the first map with the second map in a new map. If a key already exists, the disambiguations are merged non-destructively.
- *
- * @param a the first map
- * @param b the second map
- * @return a mutable map
- */
-
- public static SortedMap merge(SortedMap a, SortedMap b) {
- var mergedMap = new TreeMap<>(a);
- for (var entry : b.entrySet()) {
- mergedMap.merge(entry.getKey(), entry.getValue(), Disambiguation::merge);
- }
- return mergedMap;
- }
-
- /**
- * Merges the first disambiguation with the second disambiguation into a new instance.
- *
- * @param a first ambiguation
- * @param b second ambiguation
- * @return new merged disambiguation
- */
-
- public static Disambiguation merge(Disambiguation a, Disambiguation b) {
- var temp = new TreeSet<>(a.meanings);
- temp.addAll(b.meanings);
- return new Disambiguation(a.abbreviation, temp);
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/InputTextData.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/InputTextData.java
index d166666a5..eb043da65 100644
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/InputTextData.java
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/InputTextData.java
@@ -1,20 +1,38 @@
-/* Licensed under MIT 2023-2024. */
+/* Licensed under MIT 2023-2025. */
package edu.kit.kastel.mcse.ardoco.core.api;
+import java.io.Serial;
+
import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
-public class InputTextData implements PipelineStepData {
+/**
+ * Container for input text data to be used as {@link PipelineStepData} in the pipeline.
+ */
+@SuppressWarnings({ "ClassCanBeRecord", "java:S6206" })
+public final class InputTextData implements PipelineStepData {
+
+ @Serial
+ private static final long serialVersionUID = -5404851121533249349L;
public static final String ID = "InputTextData";
- private String text;
+ private final String text;
+ /**
+ * Constructs a new InputTextData instance.
+ *
+ * @param text the input text
+ */
public InputTextData(String text) {
- super();
this.text = text;
}
+ /**
+ * Returns the input text.
+ *
+ * @return the input text
+ */
public String getText() {
- return text;
+ return this.text;
}
}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/PreprocessingData.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/PreprocessingData.java
index b72629334..ab94180d9 100644
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/PreprocessingData.java
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/PreprocessingData.java
@@ -1,25 +1,38 @@
-/* Licensed under MIT 2022-2024. */
+/* Licensed under MIT 2022-2025. */
package edu.kit.kastel.mcse.ardoco.core.api;
+import java.io.Serial;
+
import edu.kit.kastel.mcse.ardoco.core.api.text.Text;
import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
/**
- * This class serves as container for different data after preprocessing to store as {@link PipelineStepData}. Right now, this includes the preprocessed
- * {@link Text} only.
+ * Container for data after preprocessing, to be stored as {@link PipelineStepData}. Currently, holds the preprocessed {@link Text}.
*/
public class PreprocessingData implements PipelineStepData {
+ @Serial
+ private static final long serialVersionUID = 8103545017098419675L;
+
public static final String ID = "PreprocessingData";
private final Text preprocessedText;
+ /**
+ * Constructs a new PreprocessingData instance.
+ *
+ * @param preprocessedText the preprocessed text
+ */
public PreprocessingData(Text preprocessedText) {
- super();
this.preprocessedText = preprocessedText;
}
+ /**
+ * Returns the preprocessed text.
+ *
+ * @return the preprocessed text
+ */
public Text getText() {
- return preprocessedText;
+ return this.preprocessedText;
}
}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/codetraceability/CodeTraceabilityState.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/codetraceability/CodeTraceabilityState.java
deleted file mode 100644
index 98f26bb31..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/codetraceability/CodeTraceabilityState.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.codetraceability;
-
-import java.util.Collection;
-
-import org.eclipse.collections.api.set.ImmutableSet;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SadCodeTraceLink;
-import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SamCodeTraceLink;
-import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.TransitiveTraceLink;
-import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
-import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
-
-@Deterministic
-public interface CodeTraceabilityState extends PipelineStepData {
- String ID = "CodeTraceabilityState";
-
- /**
- * Add a {@link SamCodeTraceLink} to this state.
- *
- * @param traceLink the trace link to add
- * @return whether the operation was successful
- */
- boolean addSamCodeTraceLink(SamCodeTraceLink traceLink);
-
- /**
- * Add a collection of {@link SamCodeTraceLink SamCodeTraceLinks} to this state.
- *
- * @param traceLinks the trace links to add
- * @return whether the operation was successful
- */
- boolean addSamCodeTraceLinks(Collection traceLinks);
-
- /**
- * Return a set of stored {@link SamCodeTraceLink SamCodeTraceLinks}.
- *
- * @return set of stored {@link SamCodeTraceLink SamCodeTraceLinks}
- */
- ImmutableSet getSamCodeTraceLinks();
-
- /**
- * Add a {@link TransitiveTraceLink} to this state.
- *
- * @param traceLink the trace link to add
- * @return whether the operation was successful
- */
- boolean addSadCodeTraceLink(SadCodeTraceLink traceLink);
-
- /**
- * Add a collection of {@link SadCodeTraceLink SadCodeTraceLinks} to this state.
- *
- * @param traceLinks the trace links to add
- * @return whether the operation was successful
- */
- boolean addSadCodeTraceLinks(Collection traceLinks);
-
- /**
- * Return a set of stored {@link TransitiveTraceLink TransitiveTraceLinks}.
- *
- * @return set of stored {@link TransitiveTraceLink TransitiveTraceLinks}
- */
- ImmutableSet getSadCodeTraceLinks();
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/codetraceability/SadSamCodeTraceabilityState.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/codetraceability/SadSamCodeTraceabilityState.java
deleted file mode 100644
index 9045aecad..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/codetraceability/SadSamCodeTraceabilityState.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.codetraceability;
-
-import java.util.Collection;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SamCodeTraceLink;
-import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.TransitiveTraceLink;
-import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
-
-public interface SadSamCodeTraceabilityState extends PipelineStepData {
- String ID = "SadSamCodeTraceabilityState";
-
- /**
- * Add a {@link SamCodeTraceLink} to this state.
- *
- * @param traceLink the trace link to add
- * @return whether the operation was successful
- */
- boolean addTraceLink(TransitiveTraceLink traceLink);
-
- /**
- * Add a collection of {@link SamCodeTraceLink SamCodeTraceLinks} to this state.
- *
- * @param traceLinks the trace links to add
- * @return whether the operation was successful
- */
- boolean addTraceLinks(Collection traceLinks);
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/connectiongenerator/ConnectionState.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/connectiongenerator/ConnectionState.java
deleted file mode 100644
index 0a6933006..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/connectiongenerator/ConnectionState.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Licensed under MIT 2021-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.connectiongenerator;
-
-import org.eclipse.collections.api.factory.Sets;
-import org.eclipse.collections.api.list.ImmutableList;
-import org.eclipse.collections.api.set.ImmutableSet;
-import org.eclipse.collections.api.set.MutableSet;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.ModelInstance;
-import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.InstanceLink;
-import edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks.SadSamTraceLink;
-import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendedInstance;
-import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
-import edu.kit.kastel.mcse.ardoco.core.configuration.IConfigurable;
-import edu.kit.kastel.mcse.ardoco.core.pipeline.agent.Claimant;
-
-/**
- * The Interface IConnectionState.
- */
-@Deterministic
-public interface ConnectionState extends IConfigurable {
-
- /**
- * Returns all instance links.
- *
- * @return all instance links
- */
- ImmutableList getInstanceLinks();
-
- /**
- * Returns all instance links with a model instance containing the given name.
- *
- * @param name the name of a model instance
- * @return all instance links with a model instance containing the given name as list
- */
- ImmutableList getInstanceLinksByName(String name);
-
- /**
- * Returns all instance links with a model instance containing the given type.
- *
- * @param type the type of a model instance
- * @return all instance links with a model instance containing the given type as list
- */
- ImmutableList getInstanceLinksByType(String type);
-
- /**
- * Returns all instance links with a model instance containing the given recommended instance.
- *
- * @param recommendedInstance the recommended instance to consider
- * @return all instance links found
- */
- ImmutableList getInstanceLinksByRecommendedInstance(RecommendedInstance recommendedInstance);
-
- /**
- * Returns all instance links with a model instance containing the given name and type.
- *
- * @param name the name of a model instance
- * @param type the type of a model instance
- * @return all instance links with a model instance containing the given name and type as list
- */
- ImmutableList getInstanceLinks(String name, String type);
-
- /**
- * Returns a list of tracelinks that are contained within this connection state.
- *
- * @return list of tracelinks within this connection state
- */
- default ImmutableSet getTraceLinks() {
- MutableSet traceLinks = Sets.mutable.empty();
- for (var instanceLink : getInstanceLinks()) {
- var textualInstance = instanceLink.getTextualInstance();
- for (var nm : textualInstance.getNameMappings()) {
- for (var word : nm.getWords()) {
- var traceLink = new SadSamTraceLink(instanceLink, word);
- traceLinks.add(traceLink);
- }
- }
- }
- return traceLinks.toImmutable();
- }
-
- /**
- * Adds the connection of a recommended instance and a model instance to the state. If the model instance is already
- * contained by the state it is extended. Elsewhere a new instance link is created
- *
- * @param recommendedModelInstance the recommended instance
- * @param instance the model instance
- * @param claimant the claimant
- * @param probability the probability of the link
- */
- void addToLinks(RecommendedInstance recommendedModelInstance, ModelInstance instance, Claimant claimant, double probability);
-
- /**
- * Checks if an instance link is already contained by the state.
- *
- * @param instanceLink the given instance link
- * @return true if it is already contained
- */
- boolean isContainedByInstanceLinks(InstanceLink instanceLink);
-
- /**
- * Removes an instance link from the state.
- *
- * @param instanceMapping the instance link to remove
- */
- void removeFromMappings(InstanceLink instanceMapping);
-
- /**
- * Removes all instance links containing the given instance.
- *
- * @param instance the given instance
- */
- void removeAllInstanceLinksWith(ModelInstance instance);
-
- /**
- * Removes all instance links containing the given recommended instance.
- *
- * @param instance the given recommended instance
- */
- void removeAllInstanceLinksWith(RecommendedInstance instance);
-
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/connectiongenerator/ConnectionStates.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/connectiongenerator/ConnectionStates.java
deleted file mode 100644
index 163acd7fc..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/connectiongenerator/ConnectionStates.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Licensed under MIT 2022-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.connectiongenerator;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel;
-import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
-
-public interface ConnectionStates extends PipelineStepData {
- String ID = "ConnectionStates";
-
- ConnectionState getConnectionState(Metamodel mm);
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/ArchitectureEntity.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/ArchitectureEntity.java
new file mode 100644
index 000000000..32956563a
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/ArchitectureEntity.java
@@ -0,0 +1,33 @@
+/* Licensed under MIT 2024-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.entity;
+
+import java.io.Serial;
+
+/**
+ * Abstract base class for entities that are part of the architecture model.
+ */
+public abstract non-sealed class ArchitectureEntity extends ModelEntity {
+
+ @Serial
+ private static final long serialVersionUID = 5118724938904048363L;
+
+ /**
+ * Creates a new architecture entity with the specified name.
+ *
+ * @param name the name of the architecture entity
+ */
+ protected ArchitectureEntity(String name) {
+ super(name);
+ }
+
+ /**
+ * Creates a new architecture entity with the specified name and id.
+ *
+ * @param name the name of the architecture entity
+ * @param id the unique identifier
+ */
+ protected ArchitectureEntity(String name, String id) {
+ super(name, id);
+ }
+
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/ArchitectureEntityImpl.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/ArchitectureEntityImpl.java
new file mode 100644
index 000000000..a7177b47e
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/ArchitectureEntityImpl.java
@@ -0,0 +1,94 @@
+/* Licensed under MIT 2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.entity;
+
+import java.io.Serial;
+import java.util.Objects;
+import java.util.Optional;
+
+import org.eclipse.collections.api.factory.Lists;
+import org.eclipse.collections.api.list.ImmutableList;
+import org.eclipse.collections.api.list.MutableList;
+
+import edu.kit.kastel.mcse.ardoco.core.common.util.CommonUtilities;
+
+/**
+ * Implementation of an architecture entity, representing a concrete instance in the architecture model.
+ */
+public final class ArchitectureEntityImpl extends ArchitectureEntity {
+
+ @Serial
+ private static final long serialVersionUID = 9185325416212743266L;
+
+ private final String fullName;
+ private final String fullType;
+ private final MutableList names;
+ private final MutableList types;
+ private final String uid;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param name name of the instance
+ * @param type type of the instance
+ * @param uid unique identifier of the instance needed for trace linking
+ */
+ public ArchitectureEntityImpl(String name, String type, String uid) {
+ super(name, uid);
+
+ String splitName = CommonUtilities.splitCases(name);
+ this.names = Lists.mutable.with(splitName.split(" "));
+ if (this.names.size() > 1) {
+ this.names.add(name);
+ }
+
+ String splitType = CommonUtilities.splitCases(type);
+ this.types = Lists.mutable.with(splitType.split(" "));
+ if (this.types.size() > 1) {
+ this.types.add(type);
+ }
+ this.uid = uid;
+ this.fullName = name;
+ this.fullType = type;
+ }
+
+ @Override
+ public String getName() {
+ return this.fullName;
+ }
+
+ @Override
+ public Optional getType() {
+ return Optional.of(this.fullType);
+ }
+
+ @Override
+ public ImmutableList getTypeParts() {
+ return this.types.toImmutable();
+ }
+
+ @Override
+ public String getId() {
+ return this.uid;
+ }
+
+ @Override
+ public String toString() {
+ return "Instance [names=" + String.join(", ", this.names) + ", type=" + String.join(", ", this.types) + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.fullName, this.fullType, this.uid);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof ArchitectureEntityImpl other)) {
+ return false;
+ }
+ return Objects.equals(this.fullName, other.fullName) && Objects.equals(this.fullType, other.fullType) && Objects.equals(this.uid, other.uid);
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/CodeEntity.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/CodeEntity.java
new file mode 100644
index 000000000..201cdb7ef
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/CodeEntity.java
@@ -0,0 +1,47 @@
+/* Licensed under MIT 2024-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.entity;
+
+import java.io.Serial;
+import java.util.Optional;
+
+import org.eclipse.collections.api.factory.Lists;
+import org.eclipse.collections.api.list.ImmutableList;
+
+/**
+ * Represents an entity that is part of the code model.
+ */
+public non-sealed class CodeEntity extends ModelEntity {
+ @Serial
+ private static final long serialVersionUID = 5520572653996476974L;
+
+ /**
+ * Creates a new code entity with the specified name.
+ *
+ * @param name the name of the code entity
+ */
+ protected CodeEntity(String name) {
+ super(name);
+ }
+
+ /**
+ * Creates a new code entity with the specified name and id.
+ *
+ * @param name the name of the code entity
+ * @param id the unique identifier
+ */
+ protected CodeEntity(String name, String id) {
+ super(name, id);
+ }
+
+ @Override
+ public Optional getType() {
+ return Optional.empty();
+ }
+
+ @Override
+ public ImmutableList getTypeParts() {
+ Optional type = this.getType();
+ return type.map(s -> splitIdentifierIntoParts(s).toImmutable()).orElse(Lists.immutable.empty());
+ }
+
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/Entity.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/Entity.java
new file mode 100644
index 000000000..74c8dc58b
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/Entity.java
@@ -0,0 +1,102 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.entity;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Objects;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import edu.kit.kastel.mcse.ardoco.core.common.IdentifierProvider;
+
+/**
+ * Abstract base class for entities, the smallest unit of a trace link. Provides identity, name, and comparison logic.
+ */
+public abstract sealed class Entity implements Serializable, Comparable permits TextEntity, ModelEntity {
+
+ @Serial
+ private static final long serialVersionUID = 5916408204883918465L;
+
+ @JsonProperty
+ private final String id;
+
+ @JsonProperty
+ private String name;
+
+ /**
+ * Default constructor for deserialization frameworks.
+ */
+ protected Entity() {
+ // Jackson
+ this(null);
+ }
+
+ /**
+ * Creates a new entity with the specified name.
+ *
+ * @param name the name of the entity to be created
+ */
+ protected Entity(String name) {
+ this(name, IdentifierProvider.createId());
+ }
+
+ /**
+ * Creates a new entity with the specified name and id.
+ *
+ * @param name the name of the entity
+ * @param id the unique identifier
+ */
+ protected Entity(String name, String id) {
+ this.name = name;
+ this.id = Objects.requireNonNull(id);
+ }
+
+ /**
+ * Returns the unique identifier of the entity.
+ *
+ * @return the entity's id
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * Returns the entity's name.
+ *
+ * @return the entity's name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.id, this.name);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof Entity other)) {
+ return false;
+ }
+ //TODO: Check whether it's sufficient to compare only id
+ return Objects.equals(this.id, other.id) && Objects.equals(this.name, other.name);
+ }
+
+ @Override
+ public int compareTo(Entity o) {
+ if (this.equals(o)) {
+ return 0;
+ }
+ return this.id.compareTo(o.id);
+ }
+
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/ModelEntity.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/ModelEntity.java
new file mode 100644
index 000000000..695d0b7ae
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/ModelEntity.java
@@ -0,0 +1,80 @@
+/* Licensed under MIT 2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.entity;
+
+import java.io.Serial;
+import java.util.Optional;
+
+import org.eclipse.collections.api.factory.Lists;
+import org.eclipse.collections.api.list.ImmutableList;
+import org.eclipse.collections.api.list.MutableList;
+
+import edu.kit.kastel.mcse.ardoco.core.common.util.CommonUtilities;
+
+/**
+ * Abstract base class for entities that are part of a model, such as architecture or code entities.
+ */
+public abstract sealed class ModelEntity extends Entity permits ArchitectureEntity, CodeEntity {
+
+ @Serial
+ private static final long serialVersionUID = -3169247087879811254L;
+
+ /**
+ * Default constructor for deserialization frameworks.
+ */
+ protected ModelEntity() {
+ // Jackson
+ super(null);
+ }
+
+ /**
+ * Creates a new entity with the specified name.
+ *
+ * @param name the name of the entity to be created
+ */
+ protected ModelEntity(String name) {
+ super(name);
+ }
+
+ /**
+ * Creates a new entity with the specified name and id.
+ *
+ * @param name the name of the entity
+ * @param id the unique identifier
+ */
+ protected ModelEntity(String name, String id) {
+ super(name, id);
+ }
+
+ /**
+ * Returns the type of the entity, if available.
+ *
+ * @return an Optional containing the type, or empty if not available
+ */
+ public abstract Optional getType();
+
+ /**
+ * Returns the type parts of the entity
+ *
+ * @return a list containing the type parts, or empty if not available
+ */
+ public abstract ImmutableList getTypeParts();
+
+ /**
+ * Returns the parts of the entity's name.
+ *
+ * @return an immutable list of name parts
+ */
+ public ImmutableList getNameParts() {
+ return splitIdentifierIntoParts(this.getName()).toImmutable();
+ }
+
+ protected MutableList splitIdentifierIntoParts(String identifier) {
+ String splitName = CommonUtilities.splitCases(identifier);
+ var names = Lists.mutable.with(splitName.split(" "));
+ if (names.size() > 1) {
+ names.add(identifier);
+ }
+ return names;
+ }
+
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/TextEntity.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/TextEntity.java
new file mode 100644
index 000000000..5251a50bc
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/entity/TextEntity.java
@@ -0,0 +1,23 @@
+/* Licensed under MIT 2024-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.entity;
+
+import java.io.Serial;
+
+/**
+ * Represents an entity that is part of the text model.
+ */
+public non-sealed class TextEntity extends Entity {
+ @Serial
+ private static final long serialVersionUID = 7693834560590279832L;
+
+ /**
+ * Creates a new text entity with the specified name and id.
+ *
+ * @param name the name of the text entity
+ * @param id the unique identifier
+ */
+ protected TextEntity(String name, String id) {
+ super(name, id);
+ }
+
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/InconsistencyState.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/InconsistencyState.java
deleted file mode 100644
index f3a03d89f..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/InconsistencyState.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Licensed under MIT 2021-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.inconsistency;
-
-import java.util.List;
-
-import org.eclipse.collections.api.list.ImmutableList;
-import org.eclipse.collections.api.list.MutableList;
-
-import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendedInstance;
-import edu.kit.kastel.mcse.ardoco.core.configuration.IConfigurable;
-
-/**
- * Inconsistency state holding data and information about inconsistency.
- *
- */
-public interface InconsistencyState extends IConfigurable {
-
- /**
- * Returns a list of inconsistencies held by this state
- *
- * @return list of inconsistencies
- */
- ImmutableList getInconsistencies();
-
- /**
- * Add an Inconsistency to this state
- *
- * @param inconsistency the inconsistency to add
- * @return true if added successfully
- */
- boolean addInconsistency(Inconsistency inconsistency);
-
- /**
- * Remove an Inconsistency from this state
- *
- * @param inconsistency the inconsistency to remove
- * @return true if removed successfully
- */
- boolean removeInconsistency(Inconsistency inconsistency);
-
- default boolean addRecommendedInstances(List recommendedInstances) {
- var success = true;
- for (var recommendedInstance : recommendedInstances) {
- success &= addRecommendedInstance(recommendedInstance);
- }
- return success;
- }
-
- boolean addRecommendedInstance(RecommendedInstance recommendedInstance);
-
- default boolean removeRecommendedInstances(List recommendedInstances) {
- var success = true;
- for (var recommendedInstance : recommendedInstances) {
- success &= removeRecommendedInstance(recommendedInstance);
- }
- return success;
- }
-
- boolean removeRecommendedInstance(RecommendedInstance recommendedInstance);
-
- /**
- * Sets the recommended Instances
- *
- * @param recommendedInstances the recommendedInstances to set
- */
- void setRecommendedInstances(List recommendedInstances);
-
- /**
- * Returns the recommended Instances
- *
- * @return the recommendedInstances
- */
- MutableList getRecommendedInstances();
-
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/InconsistencyStates.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/InconsistencyStates.java
deleted file mode 100644
index 2a5a29f05..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/InconsistencyStates.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Licensed under MIT 2022-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.inconsistency;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel;
-import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
-
-public interface InconsistencyStates extends PipelineStepData {
- String ID = "InconsistencyStates";
-
- InconsistencyState getInconsistencyState(Metamodel mm);
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/InconsistentSentence.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/InconsistentSentence.java
deleted file mode 100644
index f8e38f76f..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/InconsistentSentence.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Licensed under MIT 2022-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.inconsistency;
-
-import java.util.List;
-import java.util.Locale;
-
-import org.eclipse.collections.api.factory.Lists;
-
-import edu.kit.kastel.mcse.ardoco.core.api.text.Sentence;
-
-/**
- * This record represents an inconsistent sentence consisting of a sentence and all the inconsistencies that were found
- * within this sentence.
- */
-public record InconsistentSentence(Sentence sentence, List inconsistencies) {
-
- /**
- * Creates a new instance with only one inconsistency. The underlying list is populated with the given
- * inconsistency.
- *
- * @param sentence the sentence
- * @param inconsistency the inconsistency
- */
- public InconsistentSentence(Sentence sentence, Inconsistency inconsistency) {
- this(sentence, Lists.mutable.of(inconsistency));
- }
-
- /**
- * Adds an inconsistency to the list of inconsistencies of this sentence.
- *
- * @param inconsistency the inconsistency
- * @return whether the inconsistency was added successfully
- */
- public boolean addInconsistency(Inconsistency inconsistency) {
- return inconsistencies.add(inconsistency);
- }
-
- /**
- * Creates and returns an info string that contains the sentence number, the text of the sentence, and the reasons
- * of the inconsistencies
- *
- * @return an info string
- */
- public String getInfoString() {
- StringBuilder reasonsBuilder = new StringBuilder();
- for (var inconsistency : inconsistencies) {
- var reason = inconsistency.getReason();
- reasonsBuilder.append(reason).append("\n");
- }
-
- String formatString = "S%3d: \"%s\"%n\tInconsistent due to the following reasons:%n%s";
- return String.format(Locale.ENGLISH, formatString, sentence.getSentenceNumberForOutput(), sentence.getText(), reasonsBuilder);
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/ModelInconsistency.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/ModelInconsistency.java
deleted file mode 100644
index 4a2787c80..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/ModelInconsistency.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Licensed under MIT 2022-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.inconsistency;
-
-/**
- * This interface extends the interface {@link Inconsistency} by stating that the inconsistency stems from a concrete model instance, i.e., a component.
- * This way, we can output information about the inconsistent model instance.
- */
-public interface ModelInconsistency extends Inconsistency {
-
- /**
- * Return the name of the inconsistent model instance.
- *
- * @return the name of the inconsistent model instance.
- */
- String getModelInstanceName();
-
- /**
- * Return the type of the inconsistent model instance.
- *
- * @return the type of the inconsistent model instance.
- */
- String getModelInstanceType();
-
- /**
- * Return the UID of the inconsistent model instance.
- *
- * @return the UID of the inconsistent model instance.
- */
- String getModelInstanceUid();
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/TextInconsistency.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/TextInconsistency.java
deleted file mode 100644
index c3e3427a2..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/inconsistency/TextInconsistency.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Licensed under MIT 2022-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.inconsistency;
-
-/**
- * This interface extends the interface {@link Inconsistency} by stating that the inconsistency stems from a concrete textual
- * component, i.e., a sentence. This way, we can use information on the text-side to give more details.
- */
-public interface TextInconsistency extends Inconsistency {
-
- int getSentenceNumber();
-
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureComponentModel.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureComponentModel.java
new file mode 100644
index 000000000..13649b02f
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureComponentModel.java
@@ -0,0 +1,81 @@
+/* Licensed under MIT 2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import edu.kit.kastel.mcse.ardoco.core.api.models.architecture.ArchitectureComponent;
+import edu.kit.kastel.mcse.ardoco.core.api.models.architecture.ArchitectureItem;
+
+/**
+ * Represents a model containing only architecture components. Provides access to architecture components and their type identifiers.
+ */
+public final class ArchitectureComponentModel extends ArchitectureModel {
+
+ private final ArchitectureModel architectureModel;
+
+ /**
+ * Creates a new ArchitectureComponentModel.
+ *
+ * @param architectureModel the architecture model
+ */
+ public ArchitectureComponentModel(ArchitectureModel architectureModel) {
+ this.architectureModel = Objects.requireNonNull(architectureModel);
+ }
+
+ /**
+ * Returns the architecture components in this model.
+ *
+ * @return list of architecture components
+ */
+ @Override
+ public List getContent() {
+ List components = new ArrayList<>();
+ for (ArchitectureItem item : architectureModel.getContent()) {
+ if (item instanceof ArchitectureComponent component) {
+ components.add(component);
+ }
+ }
+ return components;
+ }
+
+ /**
+ * Returns the endpoints of this model. In this case, it returns the architecture components as endpoints.
+ *
+ * @return list of model entities
+ */
+ @Override
+ public List extends ArchitectureItem> getEndpoints() {
+ return this.getContent();
+ }
+
+ /**
+ * Returns the metamodel of this model.
+ *
+ * @return the metamodel
+ */
+ @Override
+ public Metamodel getMetamodel() {
+ return Metamodel.ARCHITECTURE_WITH_COMPONENTS;
+ }
+
+ /**
+ * Returns the type identifiers of the architecture components in this model.
+ *
+ * @return sorted set of type identifiers
+ */
+ @Override
+ public SortedSet getTypeIdentifiers() {
+ SortedSet identifiers = new TreeSet<>();
+ for (var component : getContent()) {
+ if (component.getType().isPresent()) {
+ identifiers.add(component.getType().orElseThrow());
+ identifiers.addAll(component.getTypeParts().toList());
+ }
+ }
+ return identifiers;
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureModel.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureModel.java
new file mode 100644
index 000000000..fea6729a3
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureModel.java
@@ -0,0 +1,30 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models;
+
+import java.util.List;
+
+import edu.kit.kastel.mcse.ardoco.core.api.models.architecture.ArchitectureItem;
+import edu.kit.kastel.mcse.ardoco.core.architecture.NoHashCodeEquals;
+
+/**
+ * Represents an architecture model.
+ */
+@NoHashCodeEquals
+public abstract sealed class ArchitectureModel extends Model permits ArchitectureComponentModel, ArchitectureModelWithComponentsAndInterfaces {
+
+ /**
+ * Returns the content of the architecture model.
+ *
+ * @return list of architecture items
+ */
+ @Override
+ public abstract List extends ArchitectureItem> getContent();
+
+ /**
+ * Returns the endpoints of this model.
+ *
+ * @return list of architecture items
+ */
+ @Override
+ public abstract List extends ArchitectureItem> getEndpoints();
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureModelType.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureModelType.java
deleted file mode 100644
index 89e1040ee..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureModelType.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Licensed under MIT 2022-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models;
-
-/**
- * Enum for the different types of supported architecture (meta-) models
- */
-public enum ArchitectureModelType implements ModelType {
- /**
- * Palladio Component Model
- */
- PCM,
- /**
- * Unified Modeling Language (UML)
- */
- UML,
- /**
- * RAW Model. E.g., text-based models.
- */
- RAW;
-
- @Override
- public String getModelId() {
- return this.name();
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureModelWithComponentsAndInterfaces.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureModelWithComponentsAndInterfaces.java
new file mode 100644
index 000000000..2791b412b
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ArchitectureModelWithComponentsAndInterfaces.java
@@ -0,0 +1,111 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models;
+
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import edu.kit.kastel.mcse.ardoco.core.api.models.architecture.ArchitectureComponent;
+import edu.kit.kastel.mcse.ardoco.core.api.models.architecture.ArchitectureInterface;
+import edu.kit.kastel.mcse.ardoco.core.api.models.architecture.ArchitectureItem;
+
+/**
+ * Represents an architecture model. This model contains architecture items, including components and interfaces.
+ */
+public final class ArchitectureModelWithComponentsAndInterfaces extends ArchitectureModel {
+
+ private final List content;
+
+ /**
+ * Creates a new architecture model.
+ *
+ * @param content the content of the architecture model
+ */
+ public ArchitectureModelWithComponentsAndInterfaces(List content) {
+ for (ArchitectureItem item : content) {
+ if (!(item instanceof ArchitectureComponent || item instanceof ArchitectureInterface)) {
+ throw new IllegalArgumentException("Architecture items must be of type ArchitectureComponent, ArchitectureInterface");
+ }
+ }
+ this.content = content;
+ }
+
+ /**
+ * Returns the content of the architecture model.
+ *
+ * @return list of architecture items
+ */
+ @Override
+ public List getContent() {
+ return this.content;
+ }
+
+ /**
+ * Returns the endpoints of this model. This method returns the architecture items as endpoints, which include components and interfaces.
+ *
+ * @return list of architecture items
+ */
+ @Override
+ public List getEndpoints() {
+ return this.getContent();
+ }
+
+ /**
+ * Returns the metamodel of this architecture model.
+ *
+ * @return the metamodel
+ */
+ @Override
+ public Metamodel getMetamodel() {
+ return Metamodel.ARCHITECTURE_WITH_COMPONENTS_AND_INTERFACES;
+ }
+
+ /**
+ * Returns the type identifiers of the architecture items in this model.
+ *
+ * @return sorted set of type identifiers
+ */
+ @Override
+ public SortedSet getTypeIdentifiers() {
+
+ SortedSet identifiers = new TreeSet<>();
+
+ for (var item : getContent()) {
+ if (item.getType().isPresent()) {
+ identifiers.add(item.getType().orElseThrow());
+ identifiers.addAll(item.getTypeParts().toList());
+ }
+ }
+ return identifiers;
+
+ }
+
+ /**
+ * Checks equality with another object.
+ *
+ * @param o the object to compare
+ * @return true if equal, false otherwise
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof ArchitectureModelWithComponentsAndInterfaces that)) {
+ return false;
+ }
+ return this.content.equals(that.content);
+ }
+
+ /**
+ * Returns the hash code for this architecture model.
+ *
+ * @return hash code
+ */
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ return 31 * result + this.content.hashCode();
+ }
+
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModel.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModel.java
new file mode 100644
index 000000000..5d4a102d2
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModel.java
@@ -0,0 +1,124 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.SortedSet;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import edu.kit.kastel.mcse.ardoco.core.api.entity.Entity;
+import edu.kit.kastel.mcse.ardoco.core.api.models.code.CodeItem;
+import edu.kit.kastel.mcse.ardoco.core.api.models.code.CodeItemRepository;
+import edu.kit.kastel.mcse.ardoco.core.api.models.code.CodePackage;
+import edu.kit.kastel.mcse.ardoco.core.architecture.NoHashCodeEquals;
+
+/**
+ * Represents a code model. This includes compilation units and packages.
+ */
+@NoHashCodeEquals
+public abstract sealed class CodeModel extends Model permits CodeModelWithCompilationUnitsAndPackages, CodeModelWithCompilationUnits {
+
+ protected CodeItemRepository codeItemRepository;
+
+ protected List content;
+
+ private boolean initialized;
+
+ /**
+ * Creates a new code model with the specified code item repository and content IDs.
+ *
+ * @param codeItemRepository the code item repository
+ * @param content list of code item IDs
+ */
+ protected CodeModel(CodeItemRepository codeItemRepository, List content) {
+ this.initialized = true;
+ this.codeItemRepository = codeItemRepository;
+ this.content = new ArrayList<>(content);
+ }
+
+ /**
+ * Creates a new code model with the specified code item repository and content.
+ *
+ * @param codeItemRepository the code item repository
+ * @param content set of code items
+ */
+ protected CodeModel(CodeItemRepository codeItemRepository, SortedSet extends CodeItem> content) {
+ this.initialized = true;
+ this.codeItemRepository = codeItemRepository;
+ this.content = new ArrayList<>();
+ for (var codeItem : content) {
+ this.content.add(codeItem.getId());
+ }
+ }
+
+ /**
+ * Creates a DTO for this code model.
+ *
+ * @return code model DTO
+ */
+ public CodeModelDto createCodeModelDto() {
+ return new CodeModelDto(codeItemRepository, getContentIds());
+ }
+
+ private List getContentIds() {
+ this.initialize();
+ return this.content;
+ }
+
+ @Override
+ public abstract List extends CodeItem> getContent();
+
+ @Override
+ public abstract List extends CodeItem> getEndpoints();
+
+ /**
+ * Returns all code packages directly or indirectly owned by this code model.
+ *
+ * @return list of all code packages
+ */
+ public List getAllPackages() {
+ List codePackages = new ArrayList<>();
+ for (var codeItem : this.getContent()) {
+ var allPackages = codeItem.getAllPackages();
+ for (CodePackage codePackage : allPackages) {
+ if (!codePackages.contains(codePackage)) {
+ codePackages.add(codePackage);
+ }
+ }
+ }
+ codePackages.sort(Comparator.comparing(Entity::getName));
+ return codePackages;
+ }
+
+ /**
+ * Initializes the code model if not already initialized.
+ */
+ protected synchronized void initialize() {
+ if (this.initialized) {
+ return;
+ }
+ this.codeItemRepository.init();
+ this.initialized = true;
+ }
+
+ /**
+ * Data transfer object for the code model. Contains a {@link CodeItemRepository} and a list of content identifiers.
+ *
+ * @param codeItemRepository the repository of code items
+ * @param content the list of content identifiers
+ */
+ public record CodeModelDto(@JsonProperty CodeItemRepository codeItemRepository, @JsonProperty List content) {
+ /**
+ * Returns the code item repository, initializing it if necessary.
+ *
+ * @return the code item repository
+ */
+ @Override
+ public CodeItemRepository codeItemRepository() {
+ codeItemRepository.init();
+ return codeItemRepository;
+ }
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModelType.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModelType.java
deleted file mode 100644
index 2a4eee106..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModelType.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models;
-
-public enum CodeModelType implements ModelType {
- CODE_MODEL;
-
- @Override
- public String getModelId() {
- return "CodeModel";
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModelWithCompilationUnits.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModelWithCompilationUnits.java
new file mode 100644
index 000000000..6b5c97c5b
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModelWithCompilationUnits.java
@@ -0,0 +1,89 @@
+/* Licensed under MIT 2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import edu.kit.kastel.mcse.ardoco.core.api.models.code.CodeCompilationUnit;
+import edu.kit.kastel.mcse.ardoco.core.api.models.code.CodeItem;
+import edu.kit.kastel.mcse.ardoco.core.api.models.code.CodeItemRepository;
+import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
+
+/**
+ * Code model containing only compilation units. Provides endpoints and type identifiers for compilation units.
+ */
+@Deterministic
+public final class CodeModelWithCompilationUnits extends CodeModel {
+
+ /**
+ * Creates a new code model from a Dto.
+ *
+ * @param codeModelDto the code model Dto
+ */
+ public CodeModelWithCompilationUnits(CodeModelDto codeModelDto) {
+ super(codeModelDto.codeItemRepository(), codeModelDto.content());
+ }
+
+ /**
+ * Creates a new code model from a repository and content.
+ *
+ * @param codeItemRepository the code item repository
+ * @param content the code items
+ */
+ public CodeModelWithCompilationUnits(CodeItemRepository codeItemRepository, SortedSet extends CodeItem> content) {
+ super(codeItemRepository, content);
+ }
+
+ /**
+ * Returns the endpoints of this code model.
+ *
+ * @return list of compilation units
+ */
+ @Override
+ public List getEndpoints() {
+ List entities = new ArrayList<>();
+ for (CodeItem codeItem : this.getContent()) {
+ entities.addAll(codeItem.getAllCompilationUnits());
+ }
+ return entities;
+ }
+
+ /**
+ * Returns the content of this code model.
+ *
+ * @return list of code items
+ */
+ @Override
+ public List extends CodeItem> getContent() {
+ this.initialize();
+ return this.codeItemRepository.getCodeItemsByIds(this.content);
+ }
+
+ /**
+ * Returns the metamodel of this code model.
+ *
+ * @return the metamodel
+ */
+ @Override
+ public Metamodel getMetamodel() {
+ return Metamodel.CODE_WITH_COMPILATION_UNITS;
+ }
+
+ /**
+ * Returns the type identifiers of the code items in this model.
+ *
+ * @return sorted set of type identifiers
+ */
+ @Override
+ public SortedSet getTypeIdentifiers() {
+ SortedSet identifiers = new TreeSet<>();
+ for (var codeItem : this.getContent()) {
+ var type = codeItem.getType();
+ type.ifPresent(identifiers::add);
+ }
+ return identifiers;
+ }
+
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModelWithCompilationUnitsAndPackages.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModelWithCompilationUnitsAndPackages.java
new file mode 100644
index 000000000..aef5cd5d1
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/CodeModelWithCompilationUnitsAndPackages.java
@@ -0,0 +1,90 @@
+/* Licensed under MIT 2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import edu.kit.kastel.mcse.ardoco.core.api.models.code.CodeItem;
+import edu.kit.kastel.mcse.ardoco.core.api.models.code.CodeItemRepository;
+import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
+
+/**
+ * Code model with compilation units and packages. Provides endpoints and type identifiers for code items.
+ */
+@Deterministic
+public final class CodeModelWithCompilationUnitsAndPackages extends CodeModel {
+ private final CodeModelWithCompilationUnits codeModel;
+
+ /**
+ * Creates a new code model from a Dto.
+ *
+ * @param codeModelDto the code model Dto
+ */
+ public CodeModelWithCompilationUnitsAndPackages(CodeModelDto codeModelDto) {
+ super(codeModelDto.codeItemRepository(), codeModelDto.content());
+ this.codeModel = new CodeModelWithCompilationUnits(codeModelDto);
+ }
+
+ /**
+ * Creates a new code model from a repository and content.
+ *
+ * @param codeItemRepository the code item repository
+ * @param content the code items
+ */
+ public CodeModelWithCompilationUnitsAndPackages(CodeItemRepository codeItemRepository, SortedSet extends CodeItem> content) {
+ super(codeItemRepository, content);
+ this.codeModel = new CodeModelWithCompilationUnits(codeItemRepository, content);
+ }
+
+ /**
+ * Returns the content of this code model.
+ *
+ * @return list of compilation units and packages
+ */
+ @Override
+ public List extends CodeItem> getContent() {
+ return this.getEndpoints();
+ }
+
+ /**
+ * Returns the endpoints of this code model.
+ *
+ * @return list of code items that are either compilation units or packages
+ */
+ @Override
+ public List getEndpoints() {
+ // The order is more than important here! Otherwise, ArDoCo Heuristics might not work properly.
+ List entities = new ArrayList<>(codeModel.getAllPackages());
+ for (CodeItem codeItem : codeModel.getContent()) {
+ entities.addAll(codeItem.getAllCompilationUnits());
+ }
+ return entities;
+ }
+
+ /**
+ * Returns the metamodel of this code model.
+ *
+ * @return the metamodel
+ */
+ @Override
+ public Metamodel getMetamodel() {
+ return Metamodel.CODE_WITH_COMPILATION_UNITS_AND_PACKAGES;
+ }
+
+ /**
+ * Returns the type identifiers of the code items in this model.
+ *
+ * @return sorted set of type identifiers
+ */
+ @Override
+ public SortedSet getTypeIdentifiers() {
+ SortedSet identifiers = new TreeSet<>();
+ for (var codeItem : this.getContent()) {
+ var type = codeItem.getType();
+ type.ifPresent(identifiers::add);
+ }
+ return identifiers;
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/Entity.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/Entity.java
deleted file mode 100644
index 03ef49beb..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/Entity.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * An entity with a name. Is a model element.
- */
-public abstract class Entity extends ModelElement {
-
- @JsonProperty
- private String name;
-
- protected Entity() {
- // Jackson
- }
-
- /**
- * Creates a new entity with the specified name.
- *
- * @param name the name of the entity to be created
- */
- protected Entity(String name) {
- this.name = name;
- }
-
- protected Entity(String name, String id) {
- super(id);
- this.name = name;
- }
-
- /**
- * Returns the entity's name.
- *
- * @return the entity's name
- */
- public String getName() {
- return name;
- }
-
- @Override
- public String toString() {
- return name;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (!(o instanceof Entity entity))
- return false;
- if (!super.equals(o))
- return false;
- return name.equals(entity.name) && getId().equals(entity.getId());
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + name.hashCode();
- return 31 * result + getId().hashCode();
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/LegacyModelExtractionState.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/LegacyModelExtractionState.java
deleted file mode 100644
index eae127f2b..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/LegacyModelExtractionState.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Licensed under MIT 2021-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models;
-
-import java.io.Serializable;
-
-import org.eclipse.collections.api.list.ImmutableList;
-import org.eclipse.collections.api.set.sorted.ImmutableSortedSet;
-
-import edu.kit.kastel.mcse.ardoco.core.configuration.IConfigurable;
-
-/**
- * The Interface IModelState defines the information directly extracted from the models.
- *
- * @deprecated use {@link ModelStates#getModel(String)}
- */
-@Deprecated(since = "0.32.0")
-public interface LegacyModelExtractionState extends IConfigurable, Serializable {
- /**
- * Returns the unique id of the model
- *
- * @return modelId
- */
- String getModelId();
-
- /**
- * Returns the metalevel or type of the current model
- *
- * @return type of model
- */
- Metamodel getMetamodel();
-
- /**
- * Returns the instances of a specific type.
- *
- * @param type the type to search for
- * @return all instances that are from that type
- */
- ImmutableList getInstancesOfType(String type);
-
- /**
- * Returns all types that are contained by instances of this state.
- *
- * @return all instance types of this state
- */
- ImmutableSortedSet getInstanceTypes();
-
- /**
- * Returns all names that are contained by this state.
- *
- * @return all names of this state
- */
- ImmutableSortedSet getNames();
-
- /**
- * Returns all instances that are contained by this state.
- *
- * @return all instances of this state
- */
- ImmutableList getInstances();
-
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/LegacyModelExtractionStateByArCoTL.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/LegacyModelExtractionStateByArCoTL.java
deleted file mode 100644
index 702bc1860..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/LegacyModelExtractionStateByArCoTL.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.eclipse.collections.api.factory.Lists;
-import org.eclipse.collections.api.factory.SortedSets;
-import org.eclipse.collections.api.list.ImmutableList;
-import org.eclipse.collections.api.list.MutableList;
-import org.eclipse.collections.api.set.sorted.ImmutableSortedSet;
-import org.eclipse.collections.api.set.sorted.MutableSortedSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.ArchitectureModel;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.CodeModel;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureComponent;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureInterface;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureMethod;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.*;
-
-public class LegacyModelExtractionStateByArCoTL implements LegacyModelExtractionState {
- private static final Logger logger = LoggerFactory.getLogger(LegacyModelExtractionStateByArCoTL.class);
-
- private final String modelId;
- private final Metamodel metamodel;
-
- private final ImmutableList instances;
-
- private final MutableSortedSet instanceTypes;
- private final MutableSortedSet names;
- private SortedMap lastConfig;
-
- public LegacyModelExtractionStateByArCoTL(ArchitectureModel architectureModel) {
- this.modelId = architectureModel.getId();
- this.instances = initArchitectureInstances(architectureModel);
- this.metamodel = Metamodel.ARCHITECTURE;
- instanceTypes = SortedSets.mutable.empty();
- names = SortedSets.mutable.empty();
- collectTypesAndNames();
- }
-
- public LegacyModelExtractionStateByArCoTL(CodeModel codeModel) {
- this.modelId = codeModel.getId();
- this.instances = initCodeInstances(codeModel);
- this.metamodel = Metamodel.CODE;
-
- instanceTypes = SortedSets.mutable.empty();
- names = SortedSets.mutable.empty();
- collectTypesAndNames();
- }
-
- private static ImmutableList initArchitectureInstances(ArchitectureModel architectureModel) {
- MutableList instances = Lists.mutable.empty();
- for (ArchitectureItem architectureItem : architectureModel.getEndpoints()) {
- switch (architectureItem) {
- case ArchitectureComponent component -> instances.add(new ModelInstanceImpl(component.getName(), component.getType(), component.getId()));
- case ArchitectureInterface ignored -> logger.debug("Skipping .. ArchitectureInterface not supported yet");
- case ArchitectureMethod ignored -> logger.debug("Skipping .. ArchitectureMethod not supported yet");
- }
- }
- return instances.toImmutable();
- }
-
- private static ImmutableList initCodeInstances(CodeModel codeModel) {
- List instances = new ArrayList<>();
- fillPackages(codeModel.getAllPackages(), instances);
- fillCompilationUnits(codeModel.getEndpoints(), instances);
- return Lists.immutable.withAll(instances);
- }
-
- private static void fillPackages(Collection extends CodePackage> packages, List instances) {
- for (var modelElement : packages) {
- String path = modelElement.getName();
- CodeModule parent = modelElement.getParent();
- while (parent != null) {
- path = parent.getName() + "/" + path;
- parent = parent.getParent();
- }
- // Ensure that package is handled as directory
- path += "/";
- instances.add(new ModelInstanceImpl(modelElement.getName(), "Package", path));
- }
- }
-
- private static void fillCompilationUnits(Collection extends CodeCompilationUnit> units, List instances) {
- for (var unit : units) {
- String type = findType(unit);
- instances.add(new ModelInstanceImpl(unit.getName(), type, unit.getPath()));
- }
-
- }
-
- private static String findType(CodeCompilationUnit unit) {
- // Assumption mostly one class per unit
- var content = unit.getContent().stream().filter(it -> unit.getName().contains(it.getName())).findFirst().orElse(null);
- if (content instanceof ClassUnit) {
- return "Class";
- }
- if (content instanceof InterfaceUnit) {
- return "Interface";
- }
- if (unit.getPath().endsWith("package-info.java")) {
- return "PackageInfo";
- }
- if (unit.getPath().endsWith(".java")) {
- // Default to Class
- return "Class";
- }
- if (unit.getLanguage() == ProgrammingLanguage.SHELL) {
- return "ShellScript";
- }
- throw new IllegalStateException("Unknown type of CodeCompilationUnit");
- }
-
- private void collectTypesAndNames() {
- for (ModelInstance i : instances) {
- instanceTypes.addAll(i.getTypeParts().castToCollection());
- names.addAll(i.getNameParts().castToCollection());
- }
- }
-
- @Override
- public String getModelId() {
- return this.modelId;
- }
-
- @Override
- public Metamodel getMetamodel() {
- return this.metamodel;
- }
-
- @Override
- public ImmutableList getInstancesOfType(String type) {
- return instances.select(i -> i.getTypeParts().contains(type));
- }
-
- @Override
- public ImmutableSortedSet getInstanceTypes() {
- return instanceTypes.toImmutable();
- }
-
- @Override
- public ImmutableSortedSet getNames() {
- return names.toImmutable();
- }
-
- @Override
- public ImmutableList getInstances() {
- return instances;
- }
-
- @Override
- public String toString() {
- var output = new StringBuilder("Instances:\n");
- for (ModelInstance i : instances) {
- output.append(i.toString()).append("\n");
- }
- return output.toString();
- }
-
- @Override
- public void applyConfiguration(SortedMap additionalConfiguration) {
- this.lastConfig = new TreeMap<>(additionalConfiguration);
- }
-
- @Override
- public SortedMap getLastAppliedConfiguration() {
- return lastConfig;
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/Metamodel.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/Metamodel.java
index faf7215ce..c9b960b75 100644
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/Metamodel.java
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/Metamodel.java
@@ -1,6 +1,16 @@
-/* Licensed under MIT 2022-2023. */
+/* Licensed under MIT 2022-2025. */
package edu.kit.kastel.mcse.ardoco.core.api.models;
+/**
+ * Enum representing the supported metamodel types.
+ */
public enum Metamodel {
- CODE, ARCHITECTURE
+ /** Code model with only compilation units. */
+ CODE_WITH_COMPILATION_UNITS,
+ /** Architecture model with components and interfaces. */
+ ARCHITECTURE_WITH_COMPONENTS_AND_INTERFACES,
+ /** Code model with compilation units and packages. */
+ CODE_WITH_COMPILATION_UNITS_AND_PACKAGES,
+ /** Architecture model with only components. */
+ ARCHITECTURE_WITH_COMPONENTS;
}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/Model.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/Model.java
new file mode 100644
index 000000000..57f703cea
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/Model.java
@@ -0,0 +1,49 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models;
+
+import java.util.List;
+import java.util.SortedSet;
+
+import edu.kit.kastel.mcse.ardoco.core.api.entity.ModelEntity;
+import edu.kit.kastel.mcse.ardoco.core.common.IdentifierProvider;
+
+/**
+ * Abstract base class for all models. Provides unique ID and access to content, endpoints, metamodel, and type identifiers.
+ */
+public abstract sealed class Model permits ArchitectureModel, CodeModel {
+
+ private final String id = IdentifierProvider.createId();
+
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * Returns the content of this model. Contains all elements of the model.
+ *
+ * @return the content of this model
+ */
+ public abstract List extends ModelEntity> getContent();
+
+ /**
+ * Returns the endpoints of this model. Contains all targetable elements for trace links.
+ *
+ * @return the endpoints of this model
+ */
+ public abstract List extends ModelEntity> getEndpoints();
+
+ /**
+ * Returns the metamodel type of this model.
+ *
+ * @return the metamodel type
+ */
+ public abstract Metamodel getMetamodel();
+
+ /**
+ * Returns a set of identifiers for the types in the model.
+ *
+ * @return set of identifiers for existing types
+ */
+ public abstract SortedSet getTypeIdentifiers();
+
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelElement.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelElement.java
deleted file mode 100644
index dc1306499..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelElement.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-import edu.kit.kastel.mcse.ardoco.core.common.IdentifierProvider;
-
-/**
- * A model element. Has an identifier. Two model elements are equal if and only if they have the same identifier.
- */
-public abstract class ModelElement implements Comparable, Serializable {
-
- private final String id;
-
- protected ModelElement() {
- this.id = IdentifierProvider.createId();
- }
-
- protected ModelElement(String id) {
- this.id = id;
- }
-
- public String getId() {
- return id;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof ModelElement other)) {
- return false;
- }
- return Objects.equals(id, other.id);
- }
-
- @Override
- public int compareTo(ModelElement o) {
- if (this.equals(o))
- return 0;
- return this.id.compareTo(o.id);
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelFormat.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelFormat.java
new file mode 100644
index 000000000..3733ac0d2
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelFormat.java
@@ -0,0 +1,16 @@
+/* Licensed under MIT 2022-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models;
+
+/**
+ * Enum for the different types of supported architecture (meta-) models.
+ */
+public enum ModelFormat {
+ /** Palladio Component Model. */
+ PCM,
+ /** Unified Modeling Language (UML). */
+ UML,
+ /** Component Listing Model, Simply a list of component names. */
+ COMPONENT_LISTING,
+ /** Code Model for the ArCoTL framework. */
+ ACM
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelInstance.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelInstance.java
deleted file mode 100644
index 821351ea6..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelInstance.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Licensed under MIT 2021-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models;
-
-import org.eclipse.collections.api.list.ImmutableList;
-
-/**
- * The Interface IModelInstance defines instances from models.
- */
-public abstract sealed class ModelInstance extends Entity permits ModelInstanceImpl {
-
- protected ModelInstance(String name, String id) {
- super(name, id);
- }
-
- /**
- * Returns the full name of the instance.
- *
- * @return the original name of the instance
- */
- public abstract String getFullName();
-
- /**
- * Returns the full type of the instance.
- *
- * @return the original type of the instance
- */
- public abstract String getFullType();
-
- /**
- * Returns all name parts of the instance.
- *
- * @return all name parts of the instance as list
- */
- public abstract ImmutableList getNameParts();
-
- /**
- * Returns all type parts of the instance.
- *
- * @return all type parts of the instance as list
- */
- public abstract ImmutableList getTypeParts();
-
- /**
- * Returns the unique identifier of the instance.
- *
- * @return the unique identifier of the instance
- */
- public abstract String getUid();
-
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelInstanceImpl.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelInstanceImpl.java
deleted file mode 100644
index f9cc2b16f..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelInstanceImpl.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Licensed under MIT 2021-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models;
-
-import java.util.Objects;
-
-import org.eclipse.collections.api.factory.Lists;
-import org.eclipse.collections.api.list.ImmutableList;
-import org.eclipse.collections.api.list.MutableList;
-
-import edu.kit.kastel.mcse.ardoco.core.common.util.CommonUtilities;
-
-/**
- * This class represents an instance extracted from a model. The name of an instance (as well as the type) are splitted at spaces and can be seen as multiple
- * names. Therefore, the longestName (and type) is the original name (type) of the instance.
- */
-public final class ModelInstanceImpl extends ModelInstance {
-
- private final String fullName;
- private final String fullType;
- private final MutableList names;
- private final MutableList types;
- private final String uid;
-
- /**
- * Creates a new instance.
- *
- * @param name name of the instance.
- * @param type type of the instance.
- * @param uid unique identifier of the instance needed for trace linking.
- */
- public ModelInstanceImpl(String name, String type, String uid) {
- super(name, uid);
-
- String splitName = CommonUtilities.splitCases(name);
- names = Lists.mutable.with(splitName.split(" "));
- if (names.size() > 1) {
- names.add(name);
- }
-
- String splitType = CommonUtilities.splitCases(type);
- types = Lists.mutable.with(splitType.split(" "));
- if (types.size() > 1) {
- types.add(type);
- }
- this.uid = uid;
- fullName = name;
- fullType = type;
- }
-
- /**
- * Returns the longest name of the instance.
- *
- * @return the original name of the instance
- */
- @Override
- public String getFullName() {
- return fullName;
- }
-
- /**
- * Returns the longest type of the instance.
- *
- * @return the original type of the instance
- */
- @Override
- public String getFullType() {
- return fullType;
- }
-
- /**
- * Returns all name parts of the instance.
- *
- * @return all name parts of the instance as list
- */
- @Override
- public ImmutableList getNameParts() {
- return names.toImmutable();
- }
-
- /**
- * Returns all type parts of the instance.
- *
- * @return all type parts of the instance as list
- */
- @Override
- public ImmutableList getTypeParts() {
- return types.toImmutable();
- }
-
- /**
- * Returns the unique identifier of the instance.
- *
- * @return the unique identifier of the instance
- */
- @Override
- public String getUid() {
- return uid;
- }
-
- @Override
- public String toString() {
- return "Instance [names=" + String.join(", ", names) + ", type=" + String.join(", ", types) + "]";
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(fullName, fullType, uid);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof ModelInstanceImpl other)) {
- return false;
- }
- return Objects.equals(fullName, other.fullName) && Objects.equals(fullType, other.fullType) && Objects.equals(uid, other.uid);
- }
-
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelStates.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelStates.java
index e888e9b24..1affb006c 100644
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelStates.java
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelStates.java
@@ -1,81 +1,54 @@
-/* Licensed under MIT 2022-2024. */
+/* Licensed under MIT 2022-2025. */
package edu.kit.kastel.mcse.ardoco.core.api.models;
+import java.io.Serial;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.ArchitectureModel;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.CodeModel;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.Model;
import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
-public class ModelStates implements PipelineStepData {
- public static final String ID = "ModelStatesData";
-
- private SortedMap models = new TreeMap<>();
- private SortedMap legacyModels = new TreeMap<>();
-
+/**
+ * Holds all models for a pipeline step.
+ */
+public final class ModelStates implements PipelineStepData {
/**
- * Constructor to create a {@link ModelStates} object that holds all {@link LegacyModelExtractionState}s
+ * The ID for this data object.
*/
- public ModelStates() {
- super();
- }
-
- /**
- * Returns the {@link LegacyModelExtractionState} with the given id
- *
- * @param id the id
- * @return the corresponding {@link LegacyModelExtractionState}
- * @deprecated use {@link #getModel(String)} instead
- */
- @Deprecated
- public LegacyModelExtractionState getModelExtractionState(String id) {
- if (legacyModels.containsKey(id))
- return legacyModels.get(id);
-
- var model = models.get(id);
- if (model == null)
- return null;
-
- var legacyModel = switch (model) {
- case ArchitectureModel am -> new LegacyModelExtractionStateByArCoTL(am);
- case CodeModel cm -> new LegacyModelExtractionStateByArCoTL(cm);
- };
+ public static final String ID = "ModelStatesData";
- legacyModels.put(id, legacyModel);
- return legacyModel;
- }
+ @Serial
+ private static final long serialVersionUID = -603436842247064371L;
+ private final SortedMap models = new TreeMap<>();
/**
* Return the set of IDs of all {@link Model Models} that are contained within this object.
*
* @return the IDs of all contained {@link Model Models}
*/
- public SortedSet modelIds() {
- return new TreeSet<>(models.keySet());
+ public SortedSet getMetamodels() {
+ return new TreeSet<>(this.models.keySet());
}
/**
- * Adds a {@link Model} with the given id to the set of {@link Model Models}
+ * Adds a {@link Model} with the given id to the set of {@link Model Models}.
*
* @param id the id
* @param model the {@link Model}
*/
- public void addModel(String id, Model model) {
- models.put(id, model);
+ public void addModel(Metamodel id, Model model) {
+ this.models.put(id, model);
}
/**
- * Returns the {@link Model} with the given id
+ * Returns the {@link Model} with the given id.
*
* @param id the id
* @return the corresponding {@link Model}
*/
- public Model getModel(String id) {
- return models.get(id);
+ public Model getModel(Metamodel id) {
+ return this.models.get(id);
}
}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelType.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelType.java
deleted file mode 100644
index 22e715a57..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/ModelType.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models;
-
-public interface ModelType {
- String getModelId();
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureComponent.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureComponent.java
similarity index 50%
rename from framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureComponent.java
rename to framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureComponent.java
index 3f3be5e4e..9fd287c2c 100644
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureComponent.java
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureComponent.java
@@ -1,23 +1,31 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture;
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.architecture;
+import java.io.Serial;
+import java.util.Optional;
import java.util.SortedSet;
+import org.eclipse.collections.api.list.ImmutableList;
+import org.eclipse.collections.api.list.MutableList;
+
/**
- * A representation of the model object Component from AMTL. Components
- * are building blocks of a software architecture. A component can contain
- * subcomponents but doesn't have to. A component can provide and require
- * interfaces. Provided interfaces are implemented by the component. Required
- * interfaces specify some functionality that is needed by the component.
+ * A representation of the model object Component. Components are building blocks of a software architecture. A component can contain subcomponents but
+ * doesn't have to. A component can provide and require interfaces. Provided interfaces are implemented by the component. Required interfaces specify some
+ * functionality that is needed by the component.
*/
public final class ArchitectureComponent extends ArchitectureItem {
+ @Serial
+ private static final long serialVersionUID = -7349058662425121364L;
+
private final SortedSet subcomponents;
private final SortedSet providedInterfaces;
private final SortedSet requiredInterfaces;
private final String type;
+ private final MutableList typeParts;
+
public ArchitectureComponent(String name, String id, SortedSet subcomponents, SortedSet providedInterfaces,
SortedSet requiredInterfaces, String type) {
super(name, id);
@@ -25,6 +33,7 @@ public ArchitectureComponent(String name, String id, SortedSet getSubcomponents() {
- return subcomponents;
+ return this.subcomponents;
}
/**
- * Returns the provided interfaces of this component. Provided interfaces are
- * implemented by this component.
+ * Returns the provided interfaces of this component. Provided interfaces are implemented by this component.
*
* @return the provided interfaces of this component
*/
public SortedSet getProvidedInterfaces() {
- return providedInterfaces;
+ return this.providedInterfaces;
}
/**
- * Returns the required interfaces of this component. Required interfaces
- * specify some functionality that is needed by this component.
+ * Returns the required interfaces of this component. Required interfaces specify some functionality that is needed by this component.
*
* @return the required interfaces of this component
*/
public SortedSet getRequiredInterfaces() {
- return requiredInterfaces;
+ return this.requiredInterfaces;
}
/**
- * Returns the type of this component as specified in the meta model.
+ * Returns the type of this component as specified in the metamodel.
*
* @return the type of this component
*/
- public String getType() {
- return type;
+ public Optional getType() {
+ return Optional.of(this.type);
+ }
+
+ @Override
+ public ImmutableList getTypeParts() {
+ return this.typeParts.toImmutable();
}
@Override
public String toString() {
- return "Component: " + getName();
+ return "Component: " + this.getName();
}
@Override
public boolean equals(Object o) {
- if (this == o)
+ if (this == o) {
return true;
- if (!(o instanceof ArchitectureComponent that))
- return false;
- if (!super.equals(o))
- return false;
-
- if (!subcomponents.equals(that.subcomponents))
- return false;
- if (!providedInterfaces.equals(that.providedInterfaces))
+ }
+ if (!(o instanceof ArchitectureComponent that) || !super.equals(o) || !this.subcomponents.equals(that.subcomponents) || !this.providedInterfaces.equals(
+ that.providedInterfaces)) {
return false;
- return requiredInterfaces.equals(that.requiredInterfaces);
+ }
+ return this.requiredInterfaces.equals(that.requiredInterfaces);
}
@Override
public int hashCode() {
int result = super.hashCode();
- result = 31 * result + subcomponents.hashCode();
- result = 31 * result + providedInterfaces.hashCode();
- result = 31 * result + requiredInterfaces.hashCode();
- return result;
+ result = 31 * result + this.subcomponents.hashCode();
+ result = 31 * result + this.providedInterfaces.hashCode();
+ return 31 * result + this.requiredInterfaces.hashCode();
}
}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureInterface.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureInterface.java
new file mode 100644
index 000000000..11167ea79
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureInterface.java
@@ -0,0 +1,88 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.architecture;
+
+import java.io.Serial;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.eclipse.collections.api.factory.Lists;
+import org.eclipse.collections.api.list.ImmutableList;
+
+/**
+ * Represents an interface in the architecture model. Contains method signatures and models interfaces in the software architecture.
+ */
+public final class ArchitectureInterface extends ArchitectureItem {
+
+ @Serial
+ private static final long serialVersionUID = 2232013345166120690L;
+
+ private final SortedSet methodSignatures;
+
+ /**
+ * Creates a new ArchitectureInterface.
+ *
+ * @param name the name of the interface
+ * @param id the unique identifier
+ * @param methodSignatures the method signatures of this interface
+ */
+ public ArchitectureInterface(String name, String id, SortedSet methodSignatures) {
+ super(name, id);
+ this.methodSignatures = methodSignatures;
+
+ }
+
+ /**
+ * Returns the method signatures of this interface.
+ *
+ * @return method signatures
+ */
+ public SortedSet getMethodSignatures() {
+ return new TreeSet<>(this.methodSignatures);
+ }
+
+ /**
+ * Returns the type of this method (currently not specified).
+ *
+ * @return empty optional
+ */
+ @Override
+ public Optional getType() {
+ // Not implemented yet. Interfaces currently have no specified type.
+ return Optional.empty();
+ }
+
+ /**
+ * Returns the type parts of this method (currently not specified).
+ *
+ * @return an empty list
+ */
+ @Override
+ public ImmutableList getTypeParts() {
+ // Not implemented yet. Interfaces currently have no specified type.
+ return Lists.immutable.empty();
+ }
+
+ @Override
+ public String toString() {
+ return "Interface: " + this.getName();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof ArchitectureInterface that) || !super.equals(o)) {
+ return false;
+ }
+ return Objects.equals(this.methodSignatures, that.methodSignatures);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), this.methodSignatures);
+ }
+
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureItem.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureItem.java
new file mode 100644
index 000000000..9fe37e1be
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureItem.java
@@ -0,0 +1,43 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.architecture;
+
+import java.io.Serial;
+import java.util.Optional;
+
+import edu.kit.kastel.mcse.ardoco.core.api.entity.ArchitectureEntity;
+
+/**
+ * Represents an item in the architecture model.
+ * Serves as a base class for architecture model elements.
+ */
+public abstract sealed class ArchitectureItem extends ArchitectureEntity permits ArchitectureComponent, ArchitectureInterface, ArchitectureMethod {
+
+ @Serial
+ private static final long serialVersionUID = -216185356134452192L;
+
+ /**
+ * Creates a new architecture item with the specified name.
+ *
+ * @param name the name of the architecture item
+ */
+ protected ArchitectureItem(String name) {
+ super(name);
+ }
+
+ /**
+ * Creates a new architecture item with the specified name and identifier.
+ *
+ * @param name the name of the architecture item
+ * @param id the identifier of the architecture item
+ */
+ protected ArchitectureItem(String name, String id) {
+ super(name, id);
+ }
+
+ /**
+ * Returns the type of the architecture item as a string.
+ *
+ * @return the type of the architecture item
+ */
+ public abstract Optional getType();
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureMethod.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureMethod.java
new file mode 100644
index 000000000..d2fcd066f
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/architecture/ArchitectureMethod.java
@@ -0,0 +1,49 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.architecture;
+
+import java.io.Serial;
+import java.util.Optional;
+
+import org.eclipse.collections.api.factory.Lists;
+import org.eclipse.collections.api.list.ImmutableList;
+
+/**
+ * Represents a method in the architecture model.
+ */
+public final class ArchitectureMethod extends ArchitectureItem {
+
+ @Serial
+ private static final long serialVersionUID = 6560555992331464264L;
+
+ /**
+ * Creates a new ArchitectureMethod.
+ *
+ * @param name the name of the method
+ */
+ public ArchitectureMethod(String name) {
+ super(name);
+ }
+
+ /**
+ * Returns the type of this method (currently not specified).
+ *
+ * @return empty optional
+ */
+ @Override
+ public Optional getType() {
+ // Not implemented yet. Methods currently have no specified type.
+ return Optional.empty();
+ }
+
+ /**
+ * Returns the type parts of this method (currently not specified).
+ *
+ * @return empty List
+ */
+ @Override
+ public ImmutableList getTypeParts() {
+ // Not implemented yet. Methods currently have no specified type.
+ return Lists.immutable.empty();
+ }
+
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/ArchitectureModel.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/ArchitectureModel.java
deleted file mode 100644
index b79f8b594..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/ArchitectureModel.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl;
-
-import java.util.List;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem;
-
-/**
- * An architecture model that is an AMTL instance.
- */
-public final class ArchitectureModel extends Model {
-
- private final List content;
-
- /**
- * Creates a new architecture model that is an AMTL instance. The model has the
- * specified architecture items as content.
- *
- * @param content the content of the architecture model
- */
- public ArchitectureModel(List content) {
- this.content = content;
- }
-
- @Override
- public List getContent() {
- return content;
- }
-
- @Override
- public List getEndpoints() {
- return getContent();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (!(o instanceof ArchitectureModel that))
- return false;
- if (!super.equals(o))
- return false;
- return content.equals(that.content);
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + content.hashCode();
- return result;
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/CodeModel.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/CodeModel.java
deleted file mode 100644
index 068d6e8b0..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/CodeModel.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Objects;
-import java.util.SortedSet;
-
-import com.fasterxml.jackson.annotation.JsonGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.Entity;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeItem;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeItemRepository;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodePackage;
-
-/**
- * A code model that is a CMTL instance.
- */
-public final class CodeModel extends Model {
-
- @JsonProperty
- private CodeItemRepository codeItemRepository;
-
- @JsonProperty
- private List content;
-
- @JsonIgnore
- private boolean initialized;
-
- @SuppressWarnings("unused")
- private CodeModel() {
- // Jackson
- this.initialized = false;
- }
-
- /**
- * Creates a new code model that is a CMTL instance. The model has the specified code items as content.
- *
- * @param content the content of the code model
- */
- public CodeModel(CodeItemRepository codeItemRepository, SortedSet extends CodeItem> content) {
- this.initialized = true;
- this.codeItemRepository = codeItemRepository;
- this.content = new ArrayList<>();
- for (var codeItem : content) {
- this.content.add(codeItem.getId());
- }
- }
-
- @JsonGetter("content")
- protected List getContentIds() {
- initialize();
- return content;
- }
-
- @Override
- public List extends CodeItem> getContent() {
- initialize();
- return codeItemRepository.getCodeItemsFromIds(content);
- }
-
- @Override
- public List extends CodeCompilationUnit> getEndpoints() {
- List compilationUnits = new ArrayList<>();
- getContent().forEach(c -> compilationUnits.addAll(c.getAllCompilationUnits()));
- return compilationUnits;
- }
-
- /**
- * Returns all code packages directly or indirectly owned by this code model.
- *
- * @return all code packages of this code model
- */
- public List extends CodePackage> getAllPackages() {
- List codePackages = new ArrayList<>();
- var lContent = getContent();
- for (CodeItem c : lContent) {
- var allPackages = c.getAllPackages();
- for (CodePackage cp : allPackages) {
- if (!codePackages.contains(cp)) {
- codePackages.add(cp);
- }
- }
- }
- codePackages.sort(Comparator.comparing(Entity::getName));
- return codePackages;
- }
-
- private synchronized void initialize() {
- if (initialized)
- return;
- this.codeItemRepository.init();
- initialized = true;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (!(o instanceof CodeModel codeModel))
- return false;
- if (!super.equals(o))
- return false;
-
- if (!Objects.equals(codeItemRepository, codeModel.codeItemRepository))
- return false;
- return Objects.equals(content, codeModel.content);
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (codeItemRepository != null ? codeItemRepository.hashCode() : 0);
- result = 31 * result + (content != null ? content.hashCode() : 0);
- return result;
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/Model.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/Model.java
deleted file mode 100644
index 5959c4e8a..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/Model.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl;
-
-import java.util.List;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.Entity;
-import edu.kit.kastel.mcse.ardoco.core.api.models.ModelElement;
-
-public abstract sealed class Model extends ModelElement permits ArchitectureModel, CodeModel {
-
- /**
- * Returns the content of this model.
- *
- * @return the content of this model
- */
- public abstract List extends Entity> getContent();
-
- /**
- * Returns the endpoints of this model.
- *
- * @return the endpoints of this model
- */
- public abstract List extends Entity> getEndpoints();
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureInterface.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureInterface.java
deleted file mode 100644
index be17504d4..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureInterface.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture;
-
-import java.util.Objects;
-import java.util.SortedSet;
-
-public final class ArchitectureInterface extends ArchitectureItem {
-
- private final SortedSet signatures;
-
- public ArchitectureInterface(String name, String id, SortedSet signatures) {
- super(name, id);
- this.signatures = signatures;
- }
-
- public SortedSet getSignatures() {
- return signatures;
- }
-
- @Override
- public String toString() {
- return "Interface: " + getName();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (!(o instanceof ArchitectureInterface that))
- return false;
- if (!super.equals(o))
- return false;
- return Objects.equals(signatures, that.signatures);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), signatures);
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureItem.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureItem.java
deleted file mode 100644
index 6ff5ebc8d..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureItem.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.Entity;
-
-/**
- * An architecture item of an architecture model. A possible candidate for the
- * architecture endpoint of a trace link that connects corresponding elements of
- * an architecture model and a code model.
- */
-public abstract sealed class ArchitectureItem extends Entity permits ArchitectureComponent, ArchitectureInterface, ArchitectureMethod {
-
- /**
- * Creates a new architecture item with the specified name.
- *
- * @param name the name of the architecture item to be created
- */
- protected ArchitectureItem(String name) {
- super(name);
- }
-
- /**
- * Creates a new architecture item with the specified name and identifier.
- *
- * @param name the name of the architecture item to be created
- * @param id the identifier of the architecture item to be created
- */
- protected ArchitectureItem(String name, String id) {
- super(name, id);
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureMethod.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureMethod.java
deleted file mode 100644
index 52ef3ae23..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureMethod.java
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture;
-
-public final class ArchitectureMethod extends ArchitectureItem {
-
- public ArchitectureMethod(String name) {
- super(name);
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ClassUnit.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ClassUnit.java
deleted file mode 100644
index 1091ae6ba..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ClassUnit.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedSet;
-
-import com.fasterxml.jackson.annotation.JsonGetter;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-@JsonTypeName("ClassUnit")
-public final class ClassUnit extends Datatype {
-
- @JsonProperty
- private final List content;
-
- @SuppressWarnings("unused")
- private ClassUnit() {
- // Jackson
- content = new ArrayList<>();
- }
-
- public ClassUnit(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content) {
- super(codeItemRepository, name);
- this.content = new ArrayList<>();
- for (var codeItem : content) {
- this.content.add(codeItem.getId());
- }
- }
-
- @JsonGetter("content")
- protected List getContentIds() {
- return content;
- }
-
- @Override
- public List getContent() {
- return codeItemRepository.getCodeItemsFromIds(content);
- }
-
- @Override
- public List getAllDataTypes() {
- List result = new ArrayList<>();
- result.add(this);
- getContent().forEach(c -> result.addAll(c.getAllDataTypes()));
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (!(o instanceof ClassUnit classUnit))
- return false;
- if (!super.equals(o))
- return false;
- return content.equals(classUnit.content);
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + content.hashCode();
- return result;
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeAssembly.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeAssembly.java
deleted file mode 100644
index 82fe3bb6b..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeAssembly.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
-
-import java.util.SortedSet;
-
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-@JsonTypeName("CodeAssembly")
-public final class CodeAssembly extends CodeModule {
-
- @SuppressWarnings("unused")
- private CodeAssembly() {
- // Jackson
- }
-
- public CodeAssembly(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content) {
- super(codeItemRepository, name, content);
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeCompilationUnit.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeCompilationUnit.java
deleted file mode 100644
index 2b0da3d08..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeCompilationUnit.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-/**
- * A compilation unit of a code model. A possible candidate for the code endpoint of a trace link that connects corresponding elements of an architecture model
- * and a code model.
- */
-@JsonTypeName("CodeCompilationUnit")
-public final class CodeCompilationUnit extends CodeModule {
-
- @JsonProperty
- private List pathElements;
- @JsonProperty
- private String extension;
- @JsonProperty
- private ProgrammingLanguage language;
-
- @SuppressWarnings("unused")
- private CodeCompilationUnit() {
- // Jackson
- }
-
- public CodeCompilationUnit(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content, List pathElements,
- String extension, ProgrammingLanguage language) {
- super(codeItemRepository, name, content);
- this.pathElements = new ArrayList<>(pathElements);
- this.extension = extension;
- this.language = language;
- }
-
- public ProgrammingLanguage getLanguage() {
- return language;
- }
-
- @Override
- public List getAllDataTypes() {
- List result = new ArrayList<>();
- getContent().forEach(c -> result.addAll(c.getAllDataTypes()));
- return result;
- }
-
- @Override
- public SortedSet getAllCompilationUnits() {
- SortedSet result = new TreeSet<>();
- result.add(this);
- return result;
- }
-
- public List getParentPackageNames() {
- List parents = new ArrayList<>();
- CodeModule parent = this;
- while (parent.hasParent()) {
- parent = parent.getParent();
- if (parent instanceof CodePackage) {
- parents.add(0, parent.getName());
- }
- }
- return parents;
- }
-
- public List getPathElements() {
- return new ArrayList<>(pathElements);
- }
-
- public String getPath() {
- StringBuilder pathBuilder = new StringBuilder();
- for (String pathElement : pathElements) {
- pathBuilder.append(pathElement).append("/");
- }
- String ending = "";
- if (!extension.isEmpty()) {
- ending = "." + extension;
- }
- pathBuilder.append(getName()).append(ending);
- return pathBuilder.toString();
- }
-
- @Override
- public String toString() {
- return getPath();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (!(o instanceof CodeCompilationUnit that))
- return false;
- if (!super.equals(o))
- return false;
-
- if (!Objects.equals(pathElements, that.pathElements))
- return false;
- if (!Objects.equals(extension, that.extension))
- return false;
- return language == that.language;
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (pathElements != null ? pathElements.hashCode() : 0);
- result = 31 * result + (extension != null ? extension.hashCode() : 0);
- result = 31 * result + (language != null ? language.hashCode() : 0);
- return result;
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeItemRepository.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeItemRepository.java
deleted file mode 100644
index 05dac9d2f..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeItemRepository.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Objects;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class CodeItemRepository implements Serializable {
-
- @JsonProperty
- private SortedMap repository = new TreeMap<>();
- @JsonIgnore
- private boolean initialized = false;
-
- public SortedMap getRepository() {
- return new TreeMap<>(repository);
- }
-
- void addCodeItem(CodeItem codeItem) {
- repository.put(codeItem.getId(), codeItem);
- }
-
- boolean containsCodeItem(String id) {
- return repository.containsKey(id);
- }
-
- CodeItem getCodeItem(String id) {
- if (id == null)
- return null;
- return repository.get(id);
- }
-
- public List getCodeItemsFromIds(List codeItemIds) {
- return codeItemIds.stream().map(this::getCodeItem).filter(Objects::nonNull).toList();
- }
-
- public synchronized void init() {
- if (initialized)
- return;
- this.repository.values().forEach(it -> it.registerCurrentCodeItemRepository(this));
- initialized = true;
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeModule.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeModule.java
deleted file mode 100644
index a8df6554a..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeModule.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import com.fasterxml.jackson.annotation.JsonGetter;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
-@JsonSubTypes({ //
- @JsonSubTypes.Type(value = CodeAssembly.class, name = "CodeAssembly"),//
- @JsonSubTypes.Type(value = CodeCompilationUnit.class, name = "CodeCompilationUnit"), //
- @JsonSubTypes.Type(value = CodePackage.class, name = "CodePackage"), //
-})
-@JsonTypeName("CodeModule")
-public sealed class CodeModule extends CodeItem permits CodeAssembly, CodeCompilationUnit, CodePackage {
-
- @JsonProperty
- private String parentId;
- @JsonProperty
- private List content;
-
- CodeModule() {
- // Jackson
- }
-
- public CodeModule(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content) {
- super(codeItemRepository, name);
- this.content = new ArrayList<>();
- for (var codeItem : content) {
- this.content.add(codeItem.getId());
- }
- parentId = null;
- }
-
- @JsonGetter("content")
- protected List getContentIds() {
- return content;
- }
-
- @Override
- public List getContent() {
- return codeItemRepository.getCodeItemsFromIds(content);
- }
-
- public void setContent(List extends CodeItem> content) {
- this.content = new ArrayList<>();
- for (var codeItem : content) {
- this.content.add(codeItem.getId());
- }
- }
-
- public void addContent(CodeItem content) {
- this.content.add(content.getId());
- }
-
- public void addContent(List extends CodeItem> content) {
- this.content.addAll(content.stream().map(CodeItem::getId).toList());
- }
-
- public CodeModule getParent() {
- CodeItem codeItem = codeItemRepository.getCodeItem(parentId);
- if (codeItem instanceof CodeModule codeModule) {
- return codeModule;
- }
- return null;
- }
-
- public boolean hasParent() {
- return getParent() != null;
- }
-
- public void setParent(CodeModule parent) {
- this.parentId = parent.getId();
- if (!codeItemRepository.containsCodeItem(parentId)) {
- codeItemRepository.addCodeItem(parent);
- }
- }
-
- @Override
- public SortedSet getAllCompilationUnits() {
- SortedSet result = new TreeSet<>();
- getContent().forEach(c -> result.addAll(c.getAllCompilationUnits()));
- return result;
- }
-
- @Override
- public SortedSet getAllPackages() {
- SortedSet result = new TreeSet<>();
- getContent().forEach(c -> result.addAll(c.getAllPackages()));
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (!(o instanceof CodeModule that))
- return false;
- if (!super.equals(o))
- return false;
-
- if (!Objects.equals(parentId, that.parentId))
- return false;
- return Objects.equals(content, that.content);
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
- result = 31 * result + (content != null ? content.hashCode() : 0);
- return result;
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodePackage.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodePackage.java
deleted file mode 100644
index 5973e4fe2..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodePackage.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
-
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-@JsonTypeName("CodePackage")
-public final class CodePackage extends CodeModule {
-
- @SuppressWarnings("unused")
- private CodePackage() {
- // Jackson
- }
-
- public CodePackage(CodeItemRepository codeItemRepository, String name) {
- super(codeItemRepository, name, new TreeSet<>());
- }
-
- public CodePackage(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content) {
- super(codeItemRepository, name, content);
- }
-
- public SortedSet getSubpackages() {
- SortedSet codePackages = new TreeSet<>();
- for (CodeItem packageElement : getContent()) {
- if (packageElement instanceof CodePackage codePackage) {
- codePackages.add(codePackage);
- }
- }
- return codePackages;
- }
-
- public SortedSet getCompilationUnits() {
- SortedSet compilationUnits = new TreeSet<>();
- for (CodeItem packageElement : getContent()) {
- if (packageElement instanceof CodeCompilationUnit compilationUnit) {
- compilationUnits.add(compilationUnit);
- }
- }
- return compilationUnits;
- }
-
- @Override
- public SortedSet getAllPackages() {
- SortedSet result = new TreeSet<>();
- result.add(this);
- getContent().forEach(c -> result.addAll(c.getAllPackages()));
- return result;
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ControlElement.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ControlElement.java
deleted file mode 100644
index 1d1e3497f..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ControlElement.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
-
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-@JsonTypeName("ControlElement")
-public final class ControlElement extends ComputationalObject {
-
- @SuppressWarnings("unused")
- private ControlElement() {
- // Jackson
- }
-
- public ControlElement(CodeItemRepository codeItemRepository, String name) {
- super(codeItemRepository, name);
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/InterfaceUnit.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/InterfaceUnit.java
deleted file mode 100644
index 00132baf0..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/InterfaceUnit.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.SortedSet;
-
-import com.fasterxml.jackson.annotation.JsonGetter;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-@JsonTypeName("InterfaceUnit")
-public final class InterfaceUnit extends Datatype {
-
- @JsonProperty
- private List content;
-
- @SuppressWarnings("unused")
- private InterfaceUnit() {
- // Jackson
- }
-
- public InterfaceUnit(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content) {
- super(codeItemRepository, name);
- this.content = new ArrayList<>();
- for (var codeItem : content) {
- this.content.add(codeItem.getId());
- }
- }
-
- @JsonGetter("content")
- protected List getContentIds() {
- return content;
- }
-
- @Override
- public List getContent() {
- return codeItemRepository.getCodeItemsFromIds(content);
- }
-
- @Override
- public List getAllDataTypes() {
- List result = new ArrayList<>();
- result.add(this);
- getContent().forEach(c -> result.addAll(c.getAllDataTypes()));
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (!(o instanceof InterfaceUnit that))
- return false;
- if (!super.equals(o))
- return false;
-
- return Objects.equals(content, that.content);
- }
-
- @Override
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (content != null ? content.hashCode() : 0);
- return result;
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ProgrammingLanguage.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ProgrammingLanguage.java
deleted file mode 100644
index 5030f30d6..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ProgrammingLanguage.java
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
-
-/**
- * Supported programming languages.
- */
-public enum ProgrammingLanguage {
- JAVA, SHELL
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ClassUnit.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ClassUnit.java
new file mode 100644
index 000000000..5950e73b1
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ClassUnit.java
@@ -0,0 +1,100 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+
+import java.io.Serial;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedSet;
+
+import com.fasterxml.jackson.annotation.JsonGetter;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+/**
+ * Represents a class unit in the code model. Contains code items representing the contents of a class, such as methods and fields.
+ */
+@JsonTypeName("ClassUnit")
+public final class ClassUnit extends Datatype {
+
+ @Serial
+ private static final long serialVersionUID = 354013115794534271L;
+
+ @JsonProperty
+ private final List content;
+
+ /**
+ * Default constructor for Jackson.
+ */
+ @SuppressWarnings("unused")
+ private ClassUnit() {
+ // Jackson
+ this.content = new ArrayList<>();
+ }
+
+ /**
+ * Creates a new class unit with the specified name and content.
+ *
+ * @param codeItemRepository the code item repository
+ * @param name the name of the class unit
+ * @param content the content of the class unit
+ */
+ public ClassUnit(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content) {
+ super(codeItemRepository, name);
+ this.content = new ArrayList<>();
+ for (var codeItem : content) {
+ this.content.add(codeItem.getId());
+ }
+ }
+
+ /**
+ * Returns the content IDs of this class unit.
+ *
+ * @return list of content IDs
+ */
+ @JsonGetter("content")
+ public List getContentIds() {
+ return new ArrayList<>(this.content);
+ }
+
+ /**
+ * Returns the content of this class unit as a list of code items.
+ *
+ * @return list of code items
+ */
+ @Override
+ public List getContent() {
+ return this.codeItemRepository.getCodeItemsByIds(this.content);
+ }
+
+ /**
+ * Returns all datatypes contained in this class unit, including itself and all nested datatypes.
+ *
+ * @return list of all datatypes
+ */
+ @Override
+ public List getAllDataTypes() {
+ List result = new ArrayList<>();
+ result.add(this);
+ for (CodeItem codeItem : this.getContent()) {
+ result.addAll(codeItem.getAllDataTypes());
+ }
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof ClassUnit classUnit) || !super.equals(o)) {
+ return false;
+ }
+ return this.content.equals(classUnit.content);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ return 31 * result + this.content.hashCode();
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeAssembly.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeAssembly.java
new file mode 100644
index 000000000..176bf4105
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeAssembly.java
@@ -0,0 +1,50 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+
+import java.io.Serial;
+import java.util.SortedSet;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+/**
+ * Represents a code assembly in the code model.
+ * Specialized type of {@link CodeModule}.
+ */
+@JsonTypeName("CodeAssembly")
+public final class CodeAssembly extends CodeModule {
+
+ @Serial
+ private static final long serialVersionUID = 3082912967900986071L;
+
+ @JsonProperty
+ private String language;
+
+ /**
+ * Default constructor for Jackson.
+ */
+ @SuppressWarnings("unused")
+ private CodeAssembly() {
+ // Jackson
+ }
+
+ /**
+ * Constructs a new CodeAssembly with the given repository, name, and content.
+ *
+ * @param codeItemRepository the code item repository
+ * @param name the name of the assembly
+ * @param content the content of the assembly
+ */
+ public CodeAssembly(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content) {
+ super(codeItemRepository, name, content);
+ }
+
+ public CodeAssembly(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content, String language) {
+ super(codeItemRepository, name, content);
+ this.language = language;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeCompilationUnit.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeCompilationUnit.java
new file mode 100644
index 000000000..7c42c8aee
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeCompilationUnit.java
@@ -0,0 +1,188 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+
+import java.io.Serial;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+/**
+ * Represents a compilation unit in the code model.
+ */
+@JsonTypeName("CodeCompilationUnit")
+public final class CodeCompilationUnit extends CodeModule {
+
+ @Serial
+ private static final long serialVersionUID = 6749513760670983294L;
+
+ @JsonProperty
+ private List pathElements;
+ @JsonProperty
+ private String extension;
+ @JsonProperty
+ private ProgrammingLanguage language;
+
+ /**
+ * Default constructor for Jackson.
+ */
+ @SuppressWarnings("unused")
+ private CodeCompilationUnit() {
+ // Jackson
+ }
+
+ /**
+ * Creates a new CodeCompilationUnit.
+ *
+ * @param codeItemRepository the code item repository
+ * @param name the name of the compilation unit
+ * @param content the content of the compilation unit
+ * @param pathElements the path elements
+ * @param extension the file extension
+ * @param language the programming language
+ */
+ public CodeCompilationUnit(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content, List pathElements,
+ String extension, ProgrammingLanguage language) {
+ super(codeItemRepository, name, content);
+ this.pathElements = new ArrayList<>(pathElements);
+ this.extension = extension;
+ this.language = language;
+ }
+
+ /**
+ * Returns the programming language of this compilation unit.
+ *
+ * @return the language
+ */
+ public ProgrammingLanguage getLanguage() {
+ return this.language;
+ }
+
+ /**
+ * Returns all datatypes contained in this compilation unit.
+ *
+ * @return list of all datatypes
+ */
+ @Override
+ public List getAllDataTypes() {
+ List result = new ArrayList<>();
+ for (CodeItem codeItem : this.getContent()) {
+ result.addAll(codeItem.getAllDataTypes());
+ }
+ return result;
+ }
+
+ /**
+ * Returns all compilation units contained in this unit (itself).
+ *
+ * @return set containing this compilation unit
+ */
+ @Override
+ public SortedSet getAllCompilationUnits() {
+ SortedSet result = new TreeSet<>();
+ result.add(this);
+ return result;
+ }
+
+ /**
+ * Returns the names of parent packages.
+ *
+ * @return list of parent package names
+ */
+ public List getParentPackageNames() {
+ List parents = new ArrayList<>();
+ CodeModule parent = this;
+ while (parent.hasParent()) {
+ parent = parent.getParent();
+ if (parent instanceof CodePackage) {
+ parents.addFirst(parent.getName());
+ }
+ }
+ return parents;
+ }
+
+ /**
+ * Returns the path elements of this compilation unit.
+ *
+ * @return list of path elements
+ */
+ public List getPathElements() {
+ return new ArrayList<>(this.pathElements);
+ }
+
+ /**
+ * Returns the full path of this compilation unit.
+ *
+ * @return the path
+ */
+ public String getPath() {
+ StringBuilder pathBuilder = new StringBuilder();
+ for (String pathElement : this.pathElements) {
+ pathBuilder.append(pathElement).append("/");
+ }
+ String ending = "";
+ if (!this.extension.isEmpty()) {
+ ending = "." + this.extension;
+ }
+ pathBuilder.append(this.getName()).append(ending);
+ return pathBuilder.toString();
+ }
+
+ /**
+ * Returns the type of this compilation unit as a string.
+ *
+ * @return the type
+ */
+ @Override
+ public Optional getType() {
+ // Assumption mostly one class per unit
+ var content = this.getContent().stream().filter(it -> this.getName().contains(it.getName())).findFirst().orElse(null);
+ if (content instanceof ClassUnit) {
+ return Optional.of("Class");
+ }
+ if (content instanceof InterfaceUnit) {
+ return Optional.of("Interface");
+ }
+ if (this.getPath().endsWith("package-info.java")) {
+ return Optional.of("PackageInfo");
+ }
+ if (this.getPath().endsWith(".java")) {
+ // Default to Class
+ return Optional.of("Class");
+ }
+ if (ProgrammingLanguage.SHELL == this.getLanguage()) {
+ return Optional.of("ShellScript");
+ }
+ return Optional.empty();
+ }
+
+ @Override
+ public String toString() {
+ return this.getPath();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof CodeCompilationUnit that) || !super.equals(o) || !Objects.equals(this.pathElements, that.pathElements) || !Objects.equals(
+ this.extension, that.extension)) {
+ return false;
+ }
+ return Objects.equals(this.language, that.language);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (this.pathElements != null ? this.pathElements.hashCode() : 0);
+ result = 31 * result + (this.extension != null ? this.extension.hashCode() : 0);
+ return 31 * result + (this.language != null ? this.language.hashCode() : 0);
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeItem.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeItem.java
similarity index 52%
rename from framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeItem.java
rename to framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeItem.java
index baa0f1c50..7b9634d4c 100644
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeItem.java
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeItem.java
@@ -1,6 +1,7 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -11,10 +12,11 @@
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import edu.kit.kastel.mcse.ardoco.core.api.models.Entity;
+import edu.kit.kastel.mcse.ardoco.core.api.entity.CodeEntity;
/**
- * A code item of a code model.
+ * Abstract base class for items in the code model.
+ * Provides methods to access content and relationships between code elements.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes({ //
@@ -22,19 +24,25 @@
@JsonSubTypes.Type(value = ComputationalObject.class, name = "ComputationalObject"), //
@JsonSubTypes.Type(value = Datatype.class, name = "Datatype") //
})
-public abstract sealed class CodeItem extends Entity permits CodeModule, ComputationalObject, Datatype {
+public abstract sealed class CodeItem extends CodeEntity permits CodeModule, ComputationalObject, Datatype {
+
+ @Serial
+ private static final long serialVersionUID = 7089107378955018027L;
@JsonIgnore
protected CodeItemRepository codeItemRepository;
+ protected String comment;
CodeItem() {
// Jackson
+ super(null);
}
/**
* Creates a new code item with the specified name.
*
- * @param name the name of the code item to be created
+ * @param codeItemRepository the code item repository
+ * @param name the name of the code item
*/
protected CodeItem(CodeItemRepository codeItemRepository, String name) {
super(name);
@@ -42,6 +50,11 @@ protected CodeItem(CodeItemRepository codeItemRepository, String name) {
this.codeItemRepository.addCodeItem(this);
}
+ /**
+ * Registers the current code item repository for this code item.
+ *
+ * @param codeItemRepository the code item repository to register
+ */
void registerCurrentCodeItemRepository(CodeItemRepository codeItemRepository) {
this.codeItemRepository = codeItemRepository;
}
@@ -49,25 +62,40 @@ void registerCurrentCodeItemRepository(CodeItemRepository codeItemRepository) {
/**
* Returns the content of this code item.
*
- * @return the content of this code item
+ * @return list of content code items
*/
public List getContent() {
return new ArrayList<>();
}
+ /**
+ * Returns all data types contained in this code item.
+ *
+ * @return list of all data types
+ */
public List getAllDataTypes() {
return new ArrayList<>();
}
+ /**
+ * Returns all data types and this code item itself as a sorted set.
+ *
+ * @return sorted set of all data types and this code item
+ */
public SortedSet getAllDataTypesAndSelf() {
- SortedSet result = new TreeSet<>(getAllDataTypes());
+ SortedSet result = new TreeSet<>(this.getAllDataTypes());
result.add(this);
return result;
}
+ /**
+ * Returns all declared methods in this code item as a sorted set.
+ *
+ * @return sorted set of declared methods
+ */
public SortedSet getDeclaredMethods() {
SortedSet methods = new TreeSet<>();
- for (CodeItem codeItem : getContent()) {
+ for (CodeItem codeItem : this.getContent()) {
if (codeItem instanceof ControlElement codeMethod) {
methods.add(codeMethod);
}
@@ -75,11 +103,29 @@ public SortedSet getDeclaredMethods() {
return methods;
}
+ /**
+ * Returns all compilation units in this code item as a sorted set.
+ *
+ * @return sorted set of compilation units
+ */
public SortedSet getAllCompilationUnits() {
return new TreeSet<>();
}
+ /**
+ * Returns all code packages in this code item as a sorted set.
+ *
+ * @return sorted set of code packages
+ */
public SortedSet getAllPackages() {
return new TreeSet<>();
}
+
+ public String getComment() {
+ return this.comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeItemRepository.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeItemRepository.java
new file mode 100644
index 000000000..478058470
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeItemRepository.java
@@ -0,0 +1,71 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Objects;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Repository for storing and managing {@link CodeItem CodeItems}.
+ */
+public class CodeItemRepository implements Serializable {
+
+ @Serial
+ private static final long serialVersionUID = 7081204548135982601L;
+
+ @JsonProperty
+ private SortedMap repository = new TreeMap<>();
+ @JsonIgnore
+ private boolean initialized = false;
+
+ /**
+ * Returns a copy of the repository map.
+ *
+ * @return map of code item IDs to code items
+ */
+ public SortedMap getRepository() {
+ return new TreeMap<>(this.repository);
+ }
+
+ void addCodeItem(CodeItem codeItem) {
+ this.repository.put(codeItem.getId(), codeItem);
+ }
+
+ boolean containsCodeItem(String id) {
+ return this.repository.containsKey(id);
+ }
+
+ CodeItem getCodeItem(String id) {
+ if (id == null) {
+ return null;
+ }
+ return this.repository.get(id);
+ }
+
+ /**
+ * Returns a list of {@link CodeItem} instances for the given list of IDs.
+ *
+ * @param codeItemIds list of code item IDs
+ * @return list of code items corresponding to the IDs
+ */
+ public List getCodeItemsByIds(List codeItemIds) {
+ return codeItemIds.stream().map(this::getCodeItem).filter(Objects::nonNull).toList();
+ }
+
+ /**
+ * Initializes the repository, registering this repository with all contained code items.
+ */
+ public synchronized void init() {
+ if (this.initialized) {
+ return;
+ }
+ this.repository.values().forEach(it -> it.registerCurrentCodeItemRepository(this));
+ this.initialized = true;
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeModule.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeModule.java
new file mode 100644
index 000000000..919cacbe6
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodeModule.java
@@ -0,0 +1,186 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+
+import java.io.Serial;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import com.fasterxml.jackson.annotation.JsonGetter;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+/**
+ * Represents a module in the code model. Modules contain other code items, such as packages, compilation units, or assemblies.
+ */
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
+@JsonSubTypes({ //
+ @JsonSubTypes.Type(value = CodeAssembly.class, name = "CodeAssembly"),//
+ @JsonSubTypes.Type(value = CodeCompilationUnit.class, name = "CodeCompilationUnit"), //
+ @JsonSubTypes.Type(value = CodePackage.class, name = "CodePackage"), //
+})
+@JsonTypeName("CodeModule")
+public sealed class CodeModule extends CodeItem permits CodeAssembly, CodeCompilationUnit, CodePackage {
+
+ @Serial
+ private static final long serialVersionUID = -7941299662945801101L;
+
+ @JsonProperty
+ private String parentId;
+ @JsonProperty
+ private List content;
+
+ CodeModule() {
+ // Jackson
+ }
+
+ /**
+ * Creates a new code module with the specified name and content.
+ *
+ * @param codeItemRepository the code item repository
+ * @param name the name of the code module
+ * @param content the content of the code module
+ */
+ public CodeModule(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content) {
+ super(codeItemRepository, name);
+ this.content = new ArrayList<>();
+ for (var codeItem : content) {
+ this.content.add(codeItem.getId());
+ }
+ this.parentId = null;
+ }
+
+ /**
+ * Returns the content IDs of this code module.
+ *
+ * @return list of content IDs
+ */
+ @JsonGetter("content")
+ protected List getContentIds() {
+ return this.content;
+ }
+
+ /**
+ * Returns the content of this code module as a list of code items.
+ *
+ * @return list of code items
+ */
+ @Override
+ public List getContent() {
+ return this.codeItemRepository.getCodeItemsByIds(this.content);
+ }
+
+ /**
+ * Sets the content of this code module.
+ *
+ * @param content list of code items to set as content
+ */
+ public void setContent(List extends CodeItem> content) {
+ this.content = new ArrayList<>();
+ for (var codeItem : content) {
+ this.content.add(codeItem.getId());
+ }
+ }
+
+ /**
+ * Adds a code item to the content of this code module.
+ *
+ * @param content the code item to add
+ */
+ public void addContent(CodeItem content) {
+ this.content.add(content.getId());
+ }
+
+ /**
+ * Adds a list of code items to the content of this code module.
+ *
+ * @param content list of code items to add
+ */
+ public void addContent(List extends CodeItem> content) {
+ this.content.addAll(content.stream().map(CodeItem::getId).toList());
+ }
+
+ /**
+ * Returns the parent code module of this code module, if any.
+ *
+ * @return parent code module, or null if none
+ */
+ public CodeModule getParent() {
+ CodeItem codeItem = this.codeItemRepository.getCodeItem(this.parentId);
+ if (codeItem instanceof CodeModule codeModule) {
+ return codeModule;
+ }
+ return null;
+ }
+
+ /**
+ * Checks if this code module has a parent.
+ *
+ * @return true if this code module has a parent, false otherwise
+ */
+ public boolean hasParent() {
+ return this.getParent() != null;
+ }
+
+ /**
+ * Sets the parent code module for this code module.
+ *
+ * @param parent the parent code module to set
+ */
+ public void setParent(CodeModule parent) {
+ this.parentId = parent.getId();
+ if (!this.codeItemRepository.containsCodeItem(this.parentId)) {
+ this.codeItemRepository.addCodeItem(parent);
+ }
+ }
+
+ /**
+ * Returns all compilation units in this code module as a sorted set.
+ *
+ * @return sorted set of compilation units
+ */
+ @Override
+ public SortedSet getAllCompilationUnits() {
+ SortedSet result = new TreeSet<>();
+ for (CodeItem codeItem : this.getContent()) {
+ result.addAll(codeItem.getAllCompilationUnits());
+ }
+ return result;
+ }
+
+ /**
+ * Returns all code packages in this code module as a sorted set.
+ *
+ * @return sorted set of code packages
+ */
+ @Override
+ public SortedSet getAllPackages() {
+ SortedSet result = new TreeSet<>();
+ for (CodeItem codeItem : this.getContent()) {
+ result.addAll(codeItem.getAllPackages());
+ }
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof CodeModule that) || !super.equals(o) || !Objects.equals(this.parentId, that.parentId)) {
+ return false;
+ }
+ return Objects.equals(this.content, that.content);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (this.parentId != null ? this.parentId.hashCode() : 0);
+ return 31 * result + (this.content != null ? this.content.hashCode() : 0);
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodePackage.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodePackage.java
new file mode 100644
index 000000000..977eeeaee
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/CodePackage.java
@@ -0,0 +1,99 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+
+import java.io.Serial;
+import java.util.Optional;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+/**
+ * Represents a package in the code model. Packages group related code items and can contain subpackages and compilation units.
+ */
+@JsonTypeName("CodePackage")
+public final class CodePackage extends CodeModule {
+
+ @Serial
+ private static final long serialVersionUID = -5224168387357601602L;
+
+ private CodePackage() {
+ // Jackson
+ }
+
+ /**
+ * Creates a new code package with the specified name.
+ *
+ * @param codeItemRepository the code item repository
+ * @param name the name of the code package
+ */
+ public CodePackage(CodeItemRepository codeItemRepository, String name) {
+ super(codeItemRepository, name, new TreeSet<>());
+ }
+
+ /**
+ * Creates a new code package with the specified name and content.
+ *
+ * @param codeItemRepository the code item repository
+ * @param name the name of the code package
+ * @param content the content of the code package
+ */
+ public CodePackage(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content) {
+ super(codeItemRepository, name, content);
+ }
+
+ /**
+ * Returns the subpackages contained in this code package.
+ *
+ * @return sorted set of subpackages
+ */
+ public SortedSet getSubpackages() {
+ SortedSet codePackages = new TreeSet<>();
+ for (CodeItem packageElement : this.getContent()) {
+ if (packageElement instanceof CodePackage codePackage) {
+ codePackages.add(codePackage);
+ }
+ }
+ return codePackages;
+ }
+
+ /**
+ * Returns the compilation units contained in this code package.
+ *
+ * @return sorted set of compilation units
+ */
+ public SortedSet getCompilationUnits() {
+ SortedSet compilationUnits = new TreeSet<>();
+ for (CodeItem packageElement : this.getContent()) {
+ if (packageElement instanceof CodeCompilationUnit compilationUnit) {
+ compilationUnits.add(compilationUnit);
+ }
+ }
+ return compilationUnits;
+ }
+
+ /**
+ * Returns the type of this code item as an optional string.
+ *
+ * @return type of this code item
+ */
+ @Override
+ public Optional getType() {
+ return Optional.of("Package");
+ }
+
+ /**
+ * Returns all code packages in this code package as a sorted set, including itself and all nested packages.
+ *
+ * @return sorted set of all code packages
+ */
+ @Override
+ public SortedSet getAllPackages() {
+ SortedSet result = new TreeSet<>();
+ result.add(this);
+ for (CodeItem codeItem : this.getContent()) {
+ result.addAll(codeItem.getAllPackages());
+ }
+ return result;
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ComputationalObject.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ComputationalObject.java
similarity index 51%
rename from framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ComputationalObject.java
rename to framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ComputationalObject.java
index b4836f975..edb09229e 100644
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/ComputationalObject.java
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ComputationalObject.java
@@ -1,19 +1,37 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+
+import java.io.Serial;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
+/**
+ * Represents a computational object in the code model.
+ * Serves as a base for control elements.
+ */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes({ @JsonSubTypes.Type(value = ControlElement.class, name = "ControlElement") })
@JsonTypeName("ComputationalObject")
public sealed class ComputationalObject extends CodeItem permits ControlElement {
+ @Serial
+ private static final long serialVersionUID = -6879811567216500291L;
+
+ /**
+ * Default constructor for Jackson.
+ */
ComputationalObject() {
// Jackson
}
+ /**
+ * Creates a new computational object with the specified name.
+ *
+ * @param codeItemRepository the code item repository
+ * @param name the name of the computational object
+ */
public ComputationalObject(CodeItemRepository codeItemRepository, String name) {
super(codeItemRepository, name);
}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ControlElement.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ControlElement.java
new file mode 100644
index 000000000..1e93f7f52
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ControlElement.java
@@ -0,0 +1,35 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+
+import java.io.Serial;
+
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+/**
+ * Represents a control element in the code model.
+ * Extends {@link ComputationalObject}.
+ */
+@JsonTypeName("ControlElement")
+public final class ControlElement extends ComputationalObject {
+
+ @Serial
+ private static final long serialVersionUID = -2733651783905632198L;
+
+ /**
+ * Default constructor for Jackson.
+ */
+ @SuppressWarnings("unused")
+ private ControlElement() {
+ // Jackson
+ }
+
+ /**
+ * Creates a new control element with the specified name.
+ *
+ * @param codeItemRepository the code item repository
+ * @param name the name of the control element
+ */
+ public ControlElement(CodeItemRepository codeItemRepository, String name) {
+ super(codeItemRepository, name);
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/Datatype.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/Datatype.java
similarity index 51%
rename from framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/Datatype.java
rename to framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/Datatype.java
index 476b12a4f..450393572 100644
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/Datatype.java
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/Datatype.java
@@ -1,6 +1,7 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code;
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -13,6 +14,9 @@
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
+/**
+ * Represents a datatype in the code model. Can be a class or interface and serves as a base for {@link ClassUnit} and {@link InterfaceUnit}.
+ */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes({ //
@JsonSubTypes.Type(value = ClassUnit.class, name = "ClassUnit"),//
@@ -21,6 +25,9 @@
@JsonTypeName("Datatype")
public sealed class Datatype extends CodeItem permits ClassUnit, InterfaceUnit {
+ @Serial
+ private static final long serialVersionUID = -1925023806648753973L;
+
@JsonProperty
private String compilationUnitId;
@JsonProperty
@@ -36,6 +43,12 @@ public sealed class Datatype extends CodeItem permits ClassUnit, InterfaceUnit {
// Jackson
}
+ /**
+ * Creates a new datatype with the specified name.
+ *
+ * @param codeItemRepository the code item repository
+ * @param name the name of the datatype
+ */
public Datatype(CodeItemRepository codeItemRepository, String name) {
super(codeItemRepository, name);
this.extendedDataTypesIds = new ArrayList<>();
@@ -43,25 +56,40 @@ public Datatype(CodeItemRepository codeItemRepository, String name) {
this.datatypeReferencesIds = new ArrayList<>();
}
+ /**
+ * Returns the compilation unit associated with this datatype.
+ *
+ * @return the compilation unit, or null if not set
+ */
public CodeCompilationUnit getCompilationUnit() {
- CodeItem codeItem = codeItemRepository.getCodeItem(compilationUnitId);
+ CodeItem codeItem = this.codeItemRepository.getCodeItem(this.compilationUnitId);
if (codeItem instanceof CodeCompilationUnit codeCompilationUnit) {
return codeCompilationUnit;
}
return null;
}
+ /**
+ * Returns the parent datatype of this datatype.
+ *
+ * @return the parent datatype, or null if not set
+ */
public Datatype getParentDatatype() {
- CodeItem codeItem = codeItemRepository.getCodeItem(parentDatatypeId);
+ CodeItem codeItem = this.codeItemRepository.getCodeItem(this.parentDatatypeId);
if (codeItem instanceof Datatype datatype) {
return datatype;
}
return null;
}
+ /**
+ * Returns the extended types of this datatype.
+ *
+ * @return sorted set of extended types
+ */
public SortedSet getExtendedTypes() {
- return extendedDataTypesIds.stream().map(id -> {
- CodeItem codeItem = codeItemRepository.getCodeItem(id);
+ return this.extendedDataTypesIds.stream().map(id -> {
+ CodeItem codeItem = this.codeItemRepository.getCodeItem(id);
if (codeItem instanceof Datatype datatype) {
return datatype;
} else {
@@ -70,9 +98,14 @@ public SortedSet getExtendedTypes() {
}).filter(Objects::nonNull).collect(Collectors.toCollection(TreeSet::new));
}
+ /**
+ * Returns the implemented types of this datatype.
+ *
+ * @return sorted set of implemented types
+ */
public SortedSet getImplementedTypes() {
- return implementedDataTypesIds.stream().map(id -> {
- CodeItem codeItem = codeItemRepository.getCodeItem(id);
+ return this.implementedDataTypesIds.stream().map(id -> {
+ CodeItem codeItem = this.codeItemRepository.getCodeItem(id);
if (codeItem instanceof Datatype datatype) {
return datatype;
} else {
@@ -81,9 +114,14 @@ public SortedSet getImplementedTypes() {
}).filter(Objects::nonNull).collect(Collectors.toCollection(TreeSet::new));
}
+ /**
+ * Returns the datatype references of this datatype.
+ *
+ * @return sorted set of datatype references
+ */
public SortedSet getDatatypeReferences() {
- return datatypeReferencesIds.stream().map(id -> {
- CodeItem codeItem = codeItemRepository.getCodeItem(id);
+ return this.datatypeReferencesIds.stream().map(id -> {
+ CodeItem codeItem = this.codeItemRepository.getCodeItem(id);
if (codeItem instanceof Datatype datatype) {
return datatype;
} else {
@@ -92,26 +130,51 @@ public SortedSet getDatatypeReferences() {
}).filter(Objects::nonNull).collect(Collectors.toCollection(TreeSet::new));
}
+ /**
+ * Sets the compilation unit for this datatype.
+ *
+ * @param compilationUnit the compilation unit to set
+ */
public void setCompilationUnit(CodeCompilationUnit compilationUnit) {
this.compilationUnitId = compilationUnit.getId();
}
+ /**
+ * Sets the parent datatype for this datatype.
+ *
+ * @param parentDatatype the parent datatype to set
+ */
public void setParentDatatype(Datatype parentDatatype) {
this.parentDatatypeId = parentDatatype.getId();
}
+ /**
+ * Sets the extended types for this datatype.
+ *
+ * @param extendedDatatypes sorted set of extended datatypes
+ */
public void setExtendedTypes(SortedSet extendedDatatypes) {
for (Datatype datatype : extendedDatatypes) {
this.extendedDataTypesIds.add(datatype.getId());
}
}
+ /**
+ * Sets the implemented types for this datatype.
+ *
+ * @param implementedDatatypes sorted set of implemented datatypes
+ */
public void setImplementedTypes(SortedSet implementedDatatypes) {
for (Datatype datatype : implementedDatatypes) {
this.implementedDataTypesIds.add(datatype.getId());
}
}
+ /**
+ * Sets the datatype references for this datatype.
+ *
+ * @param datatypeDependencies sorted set of datatype dependencies
+ */
public void setDatatypeReference(SortedSet datatypeDependencies) {
for (Datatype datatype : datatypeDependencies) {
this.datatypeReferencesIds.add(datatype.getId());
@@ -120,32 +183,29 @@ public void setDatatypeReference(SortedSet datatypeDependencies) {
@Override
public boolean equals(Object o) {
- if (this == o)
+ if (this == o) {
return true;
- if (!(o instanceof Datatype datatype))
- return false;
- if (!super.equals(o))
- return false;
-
- if (!Objects.equals(compilationUnitId, datatype.compilationUnitId))
- return false;
- if (!Objects.equals(parentDatatypeId, datatype.parentDatatypeId))
+ }
+ if (!(o instanceof Datatype datatype) || !super.equals(o) || !Objects.equals(this.compilationUnitId, datatype.compilationUnitId) || !Objects.equals(
+ this.parentDatatypeId, datatype.parentDatatypeId)) {
return false;
- if (!Objects.equals(extendedDataTypesIds, datatype.extendedDataTypesIds))
+ }
+ if (!Objects.equals(this.extendedDataTypesIds, datatype.extendedDataTypesIds)) {
return false;
- if (!Objects.equals(implementedDataTypesIds, datatype.implementedDataTypesIds))
+ }
+ if (!Objects.equals(this.implementedDataTypesIds, datatype.implementedDataTypesIds)) {
return false;
- return Objects.equals(datatypeReferencesIds, datatype.datatypeReferencesIds);
+ }
+ return Objects.equals(this.datatypeReferencesIds, datatype.datatypeReferencesIds);
}
@Override
public int hashCode() {
int result = super.hashCode();
- result = 31 * result + (compilationUnitId != null ? compilationUnitId.hashCode() : 0);
- result = 31 * result + (parentDatatypeId != null ? parentDatatypeId.hashCode() : 0);
- result = 31 * result + (extendedDataTypesIds != null ? extendedDataTypesIds.hashCode() : 0);
- result = 31 * result + (implementedDataTypesIds != null ? implementedDataTypesIds.hashCode() : 0);
- result = 31 * result + (datatypeReferencesIds != null ? datatypeReferencesIds.hashCode() : 0);
- return result;
+ result = 31 * result + (this.compilationUnitId != null ? this.compilationUnitId.hashCode() : 0);
+ result = 31 * result + (this.parentDatatypeId != null ? this.parentDatatypeId.hashCode() : 0);
+ result = 31 * result + (this.extendedDataTypesIds != null ? this.extendedDataTypesIds.hashCode() : 0);
+ result = 31 * result + (this.implementedDataTypesIds != null ? this.implementedDataTypesIds.hashCode() : 0);
+ return 31 * result + (this.datatypeReferencesIds != null ? this.datatypeReferencesIds.hashCode() : 0);
}
}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/InterfaceUnit.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/InterfaceUnit.java
new file mode 100644
index 000000000..0bac1cdef
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/InterfaceUnit.java
@@ -0,0 +1,98 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+
+import java.io.Serial;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.SortedSet;
+
+import com.fasterxml.jackson.annotation.JsonGetter;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+/**
+ * Represents an interface unit in the code model. Contains code items representing the contents of an interface, such as method signatures.
+ */
+@JsonTypeName("InterfaceUnit")
+public final class InterfaceUnit extends Datatype {
+
+ @Serial
+ private static final long serialVersionUID = 7746781256077022392L;
+
+ @JsonProperty
+ private List content;
+
+ @SuppressWarnings("unused")
+ private InterfaceUnit() {
+ // Jackson
+ }
+
+ /**
+ * Creates a new interface unit with the specified name and content.
+ *
+ * @param codeItemRepository the code item repository
+ * @param name the name of the interface unit
+ * @param content the content of the interface unit
+ */
+ public InterfaceUnit(CodeItemRepository codeItemRepository, String name, SortedSet extends CodeItem> content) {
+ super(codeItemRepository, name);
+ this.content = new ArrayList<>();
+ for (var codeItem : content) {
+ this.content.add(codeItem.getId());
+ }
+ }
+
+ /**
+ * Returns the content IDs of this interface unit.
+ *
+ * @return list of content IDs
+ */
+ @JsonGetter("content")
+ public List getContentIds() {
+ return new ArrayList<>(this.content);
+ }
+
+ /**
+ * Returns the content of this interface unit as a list of code items.
+ *
+ * @return list of code items
+ */
+ @Override
+ public List getContent() {
+ return this.codeItemRepository.getCodeItemsByIds(this.content);
+ }
+
+ /**
+ * Returns all data types contained in this interface unit.
+ *
+ * @return list of all data types
+ */
+ @Override
+ public List getAllDataTypes() {
+ List result = new ArrayList<>();
+ result.add(this);
+ for (CodeItem codeItem : this.getContent()) {
+ result.addAll(codeItem.getAllDataTypes());
+ }
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof InterfaceUnit that) || !super.equals(o)) {
+ return false;
+ }
+
+ return Objects.equals(this.content, that.content);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ return 31 * result + (this.content != null ? this.content.hashCode() : 0);
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ProgrammingLanguage.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ProgrammingLanguage.java
new file mode 100644
index 000000000..805bc8dbf
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/code/ProgrammingLanguage.java
@@ -0,0 +1,9 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.models.code;
+
+/**
+ * Supported programming languages.
+ */
+public enum ProgrammingLanguage {
+ JAVA, SHELL, PYTHON3, CPP
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/EndpointTuple.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/EndpointTuple.java
deleted file mode 100644
index 8543917ed..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/EndpointTuple.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.Entity;
-
-/**
- * A tuple of one architecture endpoint and one code endpoint. Every endpoint tuple is a possible candidate for the endpoints of a trace link that connects
- * corresponding elements of an architecture model and a code model. An endpoint tuple cannot consist of two architecture endpoints or of two code endpoints.
- */
-public class EndpointTuple implements Serializable {
- private final Entity firstEndpoint;
- private final Entity secondEndpoint;
-
- /**
- * @param firstEndpoint the architecture endpoint of the endpoint tuple to be created
- * @param secondEndpoint the code endpoint of the endpoint tuple to be created
- */
- public EndpointTuple(Entity firstEndpoint, Entity secondEndpoint) {
- this.firstEndpoint = firstEndpoint;
- this.secondEndpoint = secondEndpoint;
- }
-
- public Entity getOtherEndpoint(Entity endpoint) {
- if (firstEndpoint.equals(endpoint)) {
- return secondEndpoint;
- }
- if (secondEndpoint.equals(endpoint)) {
- return firstEndpoint;
- }
- throw new IllegalArgumentException("Endpoint tuple must contain given endpoint");
- }
-
- public boolean hasEndpoint(Entity endpoint) {
- return firstEndpoint.equals(endpoint) || secondEndpoint.equals(endpoint);
- }
-
- public boolean hasEndpoint(EndpointTuple endpointTuple) {
- return firstEndpoint.equals(endpointTuple.firstEndpoint) || secondEndpoint.equals(endpointTuple.secondEndpoint);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof EndpointTuple other)) {
- return false;
- }
- return Objects.equals(firstEndpoint, other.firstEndpoint) && Objects.equals(secondEndpoint, other.secondEndpoint);
- }
-
- @Override
- public String toString() {
- return "Architecture Endpoint: " + firstEndpoint + ", Code Endpoint: " + secondEndpoint;
- }
-
- public Entity firstEndpoint() {
- return firstEndpoint;
- }
-
- public Entity secondEndpoint() {
- return secondEndpoint;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(firstEndpoint, secondEndpoint);
- }
-
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/InstanceLink.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/InstanceLink.java
deleted file mode 100644
index 3d2e081ce..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/InstanceLink.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Licensed under MIT 2021-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks;
-
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.Objects;
-import java.util.Set;
-
-import org.eclipse.collections.api.factory.Lists;
-import org.eclipse.collections.api.list.MutableList;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.ModelInstance;
-import edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator.RecommendedInstance;
-import edu.kit.kastel.mcse.ardoco.core.api.textextraction.NounMapping;
-import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
-import edu.kit.kastel.mcse.ardoco.core.common.AggregationFunctions;
-import edu.kit.kastel.mcse.ardoco.core.data.Confidence;
-import edu.kit.kastel.mcse.ardoco.core.pipeline.agent.Claimant;
-
-/**
- * An InstanceLink defines a link between an {@link RecommendedInstance} and an {@link ModelInstance}.
- */
-@Deterministic
-public class InstanceLink extends EndpointTuple {
-
- private final RecommendedInstance textualInstance;
- private final ModelInstance modelInstance;
- private Confidence confidence;
-
- /**
- * Create a new instance link
- *
- * @param textualInstance the recommended instance
- * @param modelInstance the model instance
- */
- public InstanceLink(RecommendedInstance textualInstance, ModelInstance modelInstance) {
- super(textualInstance, modelInstance);
- this.textualInstance = textualInstance;
- this.modelInstance = modelInstance;
- this.confidence = new Confidence(AggregationFunctions.AVERAGE);
- }
-
- /**
- * Creates a new instance link.
- *
- * @param textualInstance the recommended instance
- * @param modelInstance the model instance
- * @param claimant the claimant
- * @param probability the probability of this link
- */
- public InstanceLink(RecommendedInstance textualInstance, ModelInstance modelInstance, Claimant claimant, double probability) {
- this(textualInstance, modelInstance);
- this.confidence.addAgentConfidence(claimant, probability);
- }
-
- /**
- * Add confidence to this link.
- *
- * @param claimant the claimant that wants to change the confidence
- * @param confidence the confidence value to add
- */
- public final void addConfidence(Claimant claimant, double confidence) {
- this.confidence.addAgentConfidence(claimant, confidence);
- }
-
- /**
- * Returns the probability of the correctness of this link.
- *
- * @return the probability of this link
- */
- public final double getConfidence() {
- return confidence.getConfidence();
- }
-
- /**
- * Returns the recommended instance.
- *
- * @return the textual instance
- */
- public final RecommendedInstance getTextualInstance() {
- return textualInstance;
- }
-
- /**
- * Returns the model instance.
- *
- * @return the extracted instance
- */
- public final ModelInstance getModelInstance() {
- return modelInstance;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(modelInstance, textualInstance);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof InstanceLink other)) {
- return false;
- }
- return Objects.equals(getModelInstance(), other.getModelInstance()) && Objects.equals(getTextualInstance(), other.getTextualInstance());
- }
-
- @Override
- public String toString() {
- Set names = new LinkedHashSet<>();
- MutableList namePositions = Lists.mutable.empty();
- Set types = new LinkedHashSet<>();
- MutableList typePositions = Lists.mutable.empty();
-
- for (NounMapping nameMapping : textualInstance.getNameMappings()) {
- names.addAll(nameMapping.getSurfaceForms().castToCollection());
- namePositions.addAll(nameMapping.getMappingSentenceNo().castToCollection());
- }
- for (NounMapping typeMapping : textualInstance.getTypeMappings()) {
- types.addAll(typeMapping.getSurfaceForms().castToCollection());
- typePositions.addAll(typeMapping.getMappingSentenceNo().castToCollection());
- }
- return "InstanceMapping [ uid=" + modelInstance.getUid() + ", name=" + modelInstance.getFullName() + //
- ", as=" + String.join(", ", modelInstance.getFullType()) + ", probability=" + getConfidence() + ", FOUND: " + //
- textualInstance.getName() + " : " + textualInstance.getType() + ", occurrences= " + //
- "NameVariants: " + names.size() + ": " + names + " sentences{" + Arrays.toString(namePositions.toArray()) + "}" + //
- ", TypeVariants: " + types.size() + ": " + types + "sentences{" + Arrays.toString(typePositions.toArray()) + "}" + "]";
- }
-
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/SadCodeTraceLink.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/SadCodeTraceLink.java
deleted file mode 100644
index f087d2f38..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/SadCodeTraceLink.java
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks;
-
-public class SadCodeTraceLink extends TraceLink {
-
- public SadCodeTraceLink(EndpointTuple endpointTuple) {
- super(endpointTuple);
- }
-
- @Override
- public String toString() {
- return getEndpointTuple().toString();
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/SadSamTraceLink.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/SadSamTraceLink.java
deleted file mode 100644
index e0857dd5e..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/SadSamTraceLink.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Licensed under MIT 2021-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks;
-
-import java.util.Objects;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.ModelInstance;
-import edu.kit.kastel.mcse.ardoco.core.api.text.Sentence;
-import edu.kit.kastel.mcse.ardoco.core.api.text.Word;
-
-/**
- * Represents a trace link. This is a convenience data class that takes the necessary info from {@link InstanceLink} and
- * the specific {@link ModelInstance} and {@link Word} that are used in this trace link.
- */
-public class SadSamTraceLink extends TraceLink {
- private final InstanceLink instanceLink;
- private final Word word;
-
- /**
- * Create a trace link based on a {@link InstanceLink} and a concrete {@link ModelInstance} along with a concrete
- * {@link Word}.
- *
- * @param instanceLink InstanceLink of this trace link
- * @param word word that the trace link points to
- */
- public SadSamTraceLink(InstanceLink instanceLink, Word word) {
- super(new EndpointTuple(instanceLink.getTextualInstance(), instanceLink.getModelInstance()));
- this.instanceLink = instanceLink;
- this.word = word;
- }
-
- /**
- * Get the sentence number of the word that the trace link is based on.
- *
- * @return sentence number of the word that the trace link is based on.
- */
- public int getSentenceNumber() {
- return word.getSentenceNo();
- }
-
- /**
- * Returns the sentence of the word that the trace link is based on.
- *
- * @return the sentence of the word that the trace link is based on.
- */
- public Sentence getSentence() {
- return word.getSentence();
- }
-
- /**
- * Get the UID of the model element that the trace link is based on.
- *
- * @return Uid of the model element that the trace link is based on.
- */
- public String getModelElementUid() {
- return instanceLink.getModelInstance().getUid();
- }
-
- /**
- * Get the {@link InstanceLink} that the trace link is based on.
- *
- * @return {@link InstanceLink} that the trace link is based on.
- */
- public InstanceLink getInstanceLink() {
- return instanceLink;
- }
-
- /**
- * Get the probability/confidence of this trace link
- *
- * @return probability/confidence of this trace link
- */
- public double getConfidence() {
- return instanceLink.getConfidence();
- }
-
- /**
- * See {@link Object#equals(Object)}. Uses the Uid of the model element and the sentence number of the word
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof SadSamTraceLink other) {
- var otherId = other.getModelElementUid();
- var otherSentenceNo = other.getSentenceNumber();
- return getModelElementUid().equals(otherId) && getSentenceNumber() == otherSentenceNo;
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getModelElementUid(), getSentenceNumber());
- }
-
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/SamCodeTraceLink.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/SamCodeTraceLink.java
deleted file mode 100644
index 0f22f97bd..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/SamCodeTraceLink.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks;
-
-import java.util.Objects;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.ArchitectureItem;
-import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit;
-
-/**
- * A trace link between exactly one architecture endpoint and exactly one code
- * endpoint. Trace links are created to connect corresponding elements of an
- * architecture and a code model.
- */
-public class SamCodeTraceLink extends TraceLink {
-
- /**
- * Creates a new trace link between an architecture endpoint and a code endpoint
- * as given in the specified endpoint tuple.
- *
- * @param architectureEndpoint the architecture endpoint
- * @param codeEndpoint the code endpoint
- */
- public SamCodeTraceLink(ArchitectureItem architectureEndpoint, CodeCompilationUnit codeEndpoint) {
- super(new EndpointTuple(architectureEndpoint, codeEndpoint));
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getEndpointTuple());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof SamCodeTraceLink other)) {
- return false;
- }
- return Objects.equals(getEndpointTuple(), other.getEndpointTuple());
- }
-
- @Override
- public String toString() {
- return getEndpointTuple().toString();
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/TraceLink.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/TraceLink.java
deleted file mode 100644
index 9259c2d58..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/TraceLink.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Licensed under MIT 2023-2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-public class TraceLink implements Serializable {
- private final EndpointTuple endpointTuple;
-
- public TraceLink(EndpointTuple endpointTuple) {
- this.endpointTuple = endpointTuple;
- }
-
- /**
- * Returns the endpoint tuple of this trace link.
- *
- * @return the endpoint tuple of this trace link
- */
- public EndpointTuple getEndpointTuple() {
- return endpointTuple;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(endpointTuple);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof TraceLink other)) {
- return false;
- }
- return Objects.equals(endpointTuple, other.endpointTuple);
- }
-
- @Override
- public String toString() {
- return endpointTuple.toString();
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/TransitiveTraceLink.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/TransitiveTraceLink.java
deleted file mode 100644
index 4000f3c46..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/tracelinks/TransitiveTraceLink.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Licensed under MIT 2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.models.tracelinks;
-
-import java.util.Objects;
-import java.util.Optional;
-
-public class TransitiveTraceLink extends SadCodeTraceLink {
-
- private final TraceLink firstTraceLink;
- private final TraceLink secondTraceLink;
-
- private TransitiveTraceLink(TraceLink firstTraceLink, TraceLink secondTraceLink) {
- super(new EndpointTuple(firstTraceLink.getEndpointTuple().firstEndpoint(), secondTraceLink.getEndpointTuple().secondEndpoint()));
- this.firstTraceLink = firstTraceLink;
- this.secondTraceLink = secondTraceLink;
- }
-
- public static Optional createTransitiveTraceLink(TraceLink firstTraceLink, TraceLink secondTraceLink) {
- if (isValidTransitiveTraceLink(firstTraceLink, secondTraceLink)) {
- return Optional.of(new TransitiveTraceLink(firstTraceLink, secondTraceLink));
- }
- return Optional.empty();
- }
-
- public static boolean isValidTransitiveTraceLink(TraceLink firstTraceLink, TraceLink secondTraceLink) {
- var secondEndpointOfFirstTl = firstTraceLink.getEndpointTuple().secondEndpoint().getId();
- var firstEndpointOfSecondTl = secondTraceLink.getEndpointTuple().firstEndpoint().getId();
-
- return secondEndpointOfFirstTl.equals(firstEndpointOfSecondTl);
- }
-
- public TraceLink getFirstTraceLink() {
- return firstTraceLink;
- }
-
- public TraceLink getSecondTraceLink() {
- return secondTraceLink;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getEndpointTuple());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof TransitiveTraceLink other)) {
- return false;
- }
- return Objects.equals(getFirstTraceLink(), other.getFirstTraceLink()) && //
- Objects.equals(getSecondTraceLink(), other.getSecondTraceLink()) && //
- Objects.equals(getEndpointTuple(), other.getEndpointTuple());
- }
-
- @Override
- public String toString() {
- return getEndpointTuple().toString();
- }
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendationState.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendationState.java
deleted file mode 100644
index 55f27209a..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendationState.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Licensed under MIT 2021-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator;
-
-import org.eclipse.collections.api.list.ImmutableList;
-
-import edu.kit.kastel.mcse.ardoco.core.api.textextraction.NounMapping;
-import edu.kit.kastel.mcse.ardoco.core.configuration.IConfigurable;
-import edu.kit.kastel.mcse.ardoco.core.pipeline.agent.Claimant;
-
-/**
- * The Interface IRecommendationState defines the state for recommendations.
- */
-public interface RecommendationState extends IConfigurable {
-
- /**
- * Returns all recommended instances.
- *
- * @return all recommended instances as list
- */
- ImmutableList getRecommendedInstances();
-
- /**
- * Adds a recommended instance without a type.
- *
- * @param name name of that recommended instance
- * @param probability probability of being in the model
- * @param nameMappings name mappings representing that recommended instance
- */
- void addRecommendedInstance(String name, Claimant claimant, double probability, ImmutableList nameMappings);
-
- /**
- * Adds a recommended instance.
- *
- * @param name name of that recommended instance
- * @param type type of that recommended instance
- * @param probability probability of being in the model
- * @param nameMappings name mappings representing the name of the recommended instance
- * @param typeMappings type mappings representing the type of the recommended instance
- * @return the added recommended instance
- */
- RecommendedInstance addRecommendedInstance(String name, String type, Claimant claimant, double probability, ImmutableList nameMappings,
- ImmutableList typeMappings);
-
- /**
- * Returns all recommended instances that contain a given mapping as type.
- *
- * @param mapping given mapping to search for in types
- * @return the list of recommended instances with the mapping as type.
- */
- ImmutableList getRecommendedInstancesByTypeMapping(NounMapping mapping);
-
- /**
- * Returns all recommended instances that contain a given mapping.
- *
- * @param mapping given mapping to search for
- * @return the list of recommended instances with the mapping.
- */
- ImmutableList getAnyRecommendedInstancesByMapping(NounMapping mapping);
-
- /**
- * Returns all recommended instances that contain a given name.
- *
- * @param name given name to search for in names
- * @return the list of recommended instances with that name.
- */
- ImmutableList getRecommendedInstancesByName(String name);
-
- /**
- * Returns all recommended instances that contain a similar name.
- *
- * @param name given name to search for in names
- * @return the list of recommended instances with a similar name.
- */
- ImmutableList getRecommendedInstancesBySimilarName(String name);
-
- /**
- * Returns all recommended instances that contain a given name and type.
- *
- * @param type given type to search for in types
- * @return the list of recommended instances with that name and type
- */
- ImmutableList getRecommendedInstancesByType(String type);
-
- /**
- * Returns all recommended instances that contain a similar type.
- *
- * @param type given type to search for in types
- * @return the list of recommended instances with a similar type.
- */
- ImmutableList getRecommendedInstancesBySimilarType(String type);
-
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendationStateStrategy.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendationStateStrategy.java
deleted file mode 100644
index e2a606683..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendationStateStrategy.java
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Licensed under MIT 2024. */
-package edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator;
-
-import java.io.Serializable;
-
-public interface RecommendationStateStrategy extends Serializable {
- boolean areRITypesSimilar(String typeA, String typeB);
-
- boolean areRINamesSimilar(String nameA, String nameB);
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendationStates.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendationStates.java
deleted file mode 100644
index fa872b746..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendationStates.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Licensed under MIT 2022-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel;
-import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
-
-public interface RecommendationStates extends PipelineStepData {
- String ID = "RecommendationStates";
-
- RecommendationState getRecommendationState(Metamodel mm);
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendedInstance.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendedInstance.java
deleted file mode 100644
index 519974dd1..000000000
--- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/recommendationgenerator/RecommendedInstance.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Licensed under MIT 2021-2023. */
-package edu.kit.kastel.mcse.ardoco.core.api.recommendationgenerator;
-
-import org.eclipse.collections.api.list.ImmutableList;
-import org.eclipse.collections.api.set.sorted.ImmutableSortedSet;
-
-import edu.kit.kastel.mcse.ardoco.core.api.models.Entity;
-import edu.kit.kastel.mcse.ardoco.core.api.textextraction.NounMapping;
-import edu.kit.kastel.mcse.ardoco.core.pipeline.agent.Claimant;
-
-/**
- * The Interface IRecommendedInstance defines the aggregation of noun mappings to one recommendation.
- */
-public abstract class RecommendedInstance extends Entity {
-
- protected RecommendedInstance(String name, String id) {
- super(name, id);
- }
-
- /**
- * Returns the involved name mappings.
- *
- * @return the name mappings of this recommended instance
- */
- public abstract ImmutableList getNameMappings();
-
- /**
- * Returns the involved type mappings.
- *
- * @return the type mappings of this recommended instance
- */
- public abstract ImmutableList getTypeMappings();
-
- /**
- * Returns the probability being an instance of the model.
- *
- * @return the probability to be found in the model
- */
- public abstract double getProbability();
-
- /**
- * Adds a probability to the recommended instance
- *
- * @param claimant the claimant of the confidence
- * @param probability the confidence
- */
- public abstract void addProbability(Claimant claimant, double probability);
-
- /**
- * Adds a name and type mapping to this recommended instance.
- *
- * @param nameMapping the name mapping to add
- * @param typeMapping the type mapping to add
- */
- public abstract void addMappings(NounMapping nameMapping, NounMapping typeMapping);
-
- /**
- * Adds name and type mappings to this recommended instance.
- *
- * @param nameMapping the name mappings to add
- * @param typeMapping the type mappings to add
- */
- public abstract void addMappings(ImmutableList nameMapping, ImmutableList typeMapping);
-
- /**
- * Adds a name mapping to this recommended instance.
- *
- * @param nameMapping the name mapping to add
- */
- public abstract void addName(NounMapping nameMapping);
-
- /**
- * Adds a type mapping to this recommended instance.
- *
- * @param typeMapping the type mapping to add
- */
- public abstract void addType(NounMapping typeMapping);
-
- /**
- * Returns the type as string from this recommended instance.
- *
- * @return the type as string
- */
- public abstract String getType();
-
- /**
- * Returns the name as string from this recommended instance.
- *
- * @return the name as string
- */
- @Override
- public abstract String getName();
-
- /**
- * Sets the type of this recommended instance to the given type.
- *
- * @param type the new type
- */
- public abstract void setType(String type);
-
- /**
- * Sets the name of this recommended instance to the given name.
- *
- * @param name the new name
- */
- public abstract void setName(String name);
-
- public abstract ImmutableSortedSet getSentenceNumbers();
-
- public abstract ImmutableList getClaimants();
-}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/codetraceability/ArchitectureCodeTraceLink.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/codetraceability/ArchitectureCodeTraceLink.java
new file mode 100644
index 000000000..e97a54049
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/codetraceability/ArchitectureCodeTraceLink.java
@@ -0,0 +1,26 @@
+/* Licensed under MIT 2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.stage.codetraceability;
+
+import java.io.Serial;
+
+import edu.kit.kastel.mcse.ardoco.core.api.models.architecture.ArchitectureItem;
+import edu.kit.kastel.mcse.ardoco.core.api.models.code.CodeItem;
+import edu.kit.kastel.mcse.ardoco.core.api.tracelink.TraceLink;
+
+/**
+ * Trace link between an architecture item and a code item.
+ */
+public final class ArchitectureCodeTraceLink extends TraceLink {
+ @Serial
+ private static final long serialVersionUID = 7583961097321596737L;
+
+ /**
+ * Creates a new model-code trace link.
+ *
+ * @param firstEndpoint the architecture item
+ * @param secondEndpoint the code item
+ */
+ public ArchitectureCodeTraceLink(ArchitectureItem firstEndpoint, CodeItem secondEndpoint) {
+ super(firstEndpoint, secondEndpoint);
+ }
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/codetraceability/CodeTraceabilityState.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/codetraceability/CodeTraceabilityState.java
new file mode 100644
index 000000000..db6aaf03a
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/codetraceability/CodeTraceabilityState.java
@@ -0,0 +1,55 @@
+/* Licensed under MIT 2023-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.stage.codetraceability;
+
+import java.util.Collection;
+
+import org.eclipse.collections.api.set.ImmutableSet;
+
+import edu.kit.kastel.mcse.ardoco.core.api.entity.ArchitectureEntity;
+import edu.kit.kastel.mcse.ardoco.core.api.entity.ModelEntity;
+import edu.kit.kastel.mcse.ardoco.core.api.text.SentenceEntity;
+import edu.kit.kastel.mcse.ardoco.core.api.tracelink.TraceLink;
+import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
+import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
+
+/**
+ * State interface for code traceability.
+ * Stores trace links between sentences, architecture, and code entities.
+ */
+@Deterministic
+public interface CodeTraceabilityState extends PipelineStepData {
+ /**
+ * The ID for this state.
+ */
+ String ID = "CodeTraceabilityState";
+
+ /**
+ * Add a collection of trace links between sentences and code entities to this state.
+ *
+ * @param traceLinks the trace links to add
+ * @return whether the operation was successful
+ */
+ boolean addSadCodeTraceLinks(Collection extends TraceLink> traceLinks);
+
+ /**
+ * Return a set of stored trace links between sentences and code entities.
+ *
+ * @return set of stored trace links
+ */
+ ImmutableSet> getSadCodeTraceLinks();
+
+ /**
+ * Add a collection of trace links between architecture and code entities to this state.
+ *
+ * @param traceLinks the trace links to add
+ * @return whether the operation was successful
+ */
+ boolean addSamCodeTraceLinks(Collection extends TraceLink extends ArchitectureEntity, ? extends ModelEntity>> traceLinks);
+
+ /**
+ * Return a set of stored trace links between architecture and code entities.
+ *
+ * @return set of stored trace links
+ */
+ ImmutableSet> getSamCodeTraceLinks();
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/connectiongenerator/ConnectionState.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/connectiongenerator/ConnectionState.java
new file mode 100644
index 000000000..346f72d72
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/connectiongenerator/ConnectionState.java
@@ -0,0 +1,68 @@
+/* Licensed under MIT 2021-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.stage.connectiongenerator;
+
+import org.eclipse.collections.api.factory.Sets;
+import org.eclipse.collections.api.list.ImmutableList;
+import org.eclipse.collections.api.set.ImmutableSet;
+import org.eclipse.collections.api.set.MutableSet;
+
+import edu.kit.kastel.mcse.ardoco.core.api.entity.ModelEntity;
+import edu.kit.kastel.mcse.ardoco.core.api.stage.recommendationgenerator.RecommendedInstance;
+import edu.kit.kastel.mcse.ardoco.core.api.text.SentenceEntity;
+import edu.kit.kastel.mcse.ardoco.core.api.tracelink.TraceLink;
+import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
+import edu.kit.kastel.mcse.ardoco.core.configuration.IConfigurable;
+import edu.kit.kastel.mcse.ardoco.core.pipeline.agent.Claimant;
+
+/**
+ * State interface for connection generation.
+ * Provides access to instance links and trace links.
+ */
+@Deterministic
+public interface ConnectionState extends IConfigurable {
+
+ /**
+ * Returns all instance links.
+ *
+ * @return all instance links
+ */
+ ImmutableList> getInstanceLinks();
+
+ /**
+ * Returns a list of trace links that are contained within this connection state.
+ *
+ * @return list of trace links within this connection state
+ */
+ default ImmutableSet> getTraceLinks() {
+ MutableSet> traceLinks = Sets.mutable.empty();
+ for (var instanceLink : this.getInstanceLinks()) {
+ var textualInstance = instanceLink.getFirstEndpoint();
+ for (var nm : textualInstance.getNameMappings()) {
+ for (var word : nm.getWords()) {
+ var traceLink = new SentenceModelTraceLink(word.getSentence(), instanceLink.getSecondEndpoint());
+ traceLinks.add(traceLink);
+ }
+ }
+ }
+ return traceLinks.toImmutable();
+ }
+
+ /**
+ * Adds the connection of a recommended instance and a model instance to the state.
+ * If the model instance is already contained by the state it is extended, otherwise a new instance link is created.
+ *
+ * @param recommendedModelInstance the recommended instance
+ * @param modelEntity the model instance
+ * @param claimant the claimant
+ * @param probability the probability of the link
+ */
+ void addToLinks(RecommendedInstance recommendedModelInstance, ModelEntity modelEntity, Claimant claimant, double probability);
+
+ /**
+ * Checks if an instance link is already contained by the state.
+ *
+ * @param instanceLink the given instance link
+ * @return true if it is already contained
+ */
+ boolean isContainedByInstanceLinks(TraceLink instanceLink);
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/connectiongenerator/ConnectionStates.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/connectiongenerator/ConnectionStates.java
new file mode 100644
index 000000000..34a55e169
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/connectiongenerator/ConnectionStates.java
@@ -0,0 +1,23 @@
+/* Licensed under MIT 2022-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.stage.connectiongenerator;
+
+import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel;
+import edu.kit.kastel.mcse.ardoco.core.data.PipelineStepData;
+
+/**
+ * State interface for managing multiple connection states by metamodel.
+ */
+public interface ConnectionStates extends PipelineStepData {
+ /**
+ * The ID for this state.
+ */
+ String ID = "ConnectionStates";
+
+ /**
+ * Returns the connection state for the given metamodel.
+ *
+ * @param metamodel the metamodel
+ * @return the connection state
+ */
+ ConnectionState getConnectionState(Metamodel metamodel);
+}
diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/connectiongenerator/RecommendationModelTraceLink.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/connectiongenerator/RecommendationModelTraceLink.java
new file mode 100644
index 000000000..130cc5e53
--- /dev/null
+++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/connectiongenerator/RecommendationModelTraceLink.java
@@ -0,0 +1,106 @@
+/* Licensed under MIT 2021-2025. */
+package edu.kit.kastel.mcse.ardoco.core.api.stage.connectiongenerator;
+
+import java.io.Serial;
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.eclipse.collections.api.factory.Lists;
+import org.eclipse.collections.api.list.MutableList;
+
+import edu.kit.kastel.mcse.ardoco.core.api.entity.ArchitectureEntity;
+import edu.kit.kastel.mcse.ardoco.core.api.entity.CodeEntity;
+import edu.kit.kastel.mcse.ardoco.core.api.entity.ModelEntity;
+import edu.kit.kastel.mcse.ardoco.core.api.stage.recommendationgenerator.RecommendedInstance;
+import edu.kit.kastel.mcse.ardoco.core.api.stage.textextraction.NounMapping;
+import edu.kit.kastel.mcse.ardoco.core.api.tracelink.TraceLink;
+import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic;
+import edu.kit.kastel.mcse.ardoco.core.common.AggregationFunctions;
+import edu.kit.kastel.mcse.ardoco.core.data.Confidence;
+import edu.kit.kastel.mcse.ardoco.core.pipeline.agent.Claimant;
+
+/**
+ * Defines a link between a {@link RecommendedInstance} and a {@link ModelEntity}.
+ */
+@Deterministic
+public final class RecommendationModelTraceLink extends TraceLink {
+
+ @Serial
+ private static final long serialVersionUID = -8630933950725516269L;
+ private final Confidence confidence;
+
+ /**
+ * Create a new instance link.
+ *
+ * @param recommendedInstance the recommended instance
+ * @param entity the model instance
+ */
+ public RecommendationModelTraceLink(RecommendedInstance recommendedInstance, ModelEntity entity) {
+ super(recommendedInstance, entity);
+ this.confidence = new Confidence(AggregationFunctions.AVERAGE);
+ }
+
+ /**
+ * Creates a new instance link with a claimant and probability.
+ *
+ * @param recommendedInstance the recommended instance
+ * @param entity the model instance
+ * @param claimant the claimant
+ * @param probability the probability of this link
+ */
+ public RecommendationModelTraceLink(RecommendedInstance recommendedInstance, ModelEntity entity, Claimant claimant, double probability) {
+ this(recommendedInstance, entity);
+ this.confidence.addAgentConfidence(claimant, probability);
+ }
+
+ /**
+ * Returns the probability of the correctness of this link.
+ *
+ * @return the probability of this link
+ */
+ public double getConfidence() {
+ return this.confidence.getConfidence();
+ }
+
+ @Override
+ public String toString() {
+ Set names = new LinkedHashSet<>();
+ MutableList namePositions = Lists.mutable.empty();
+ Set types = new LinkedHashSet<>();
+ MutableList