Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6dc469a
Created first structure
rema-soptim Apr 1, 2026
2e89607
improved structure for deleteRelations response and started on implem…
rema-soptim Apr 9, 2026
0ddd2a9
added needed context for displaying data correctly
rema-soptim Apr 13, 2026
448e3bf
implemented frontend ui for selecting delete dependencies
rema-soptim Apr 13, 2026
a2ad272
added first impl for actual deletion.
rema-soptim Apr 14, 2026
3ea8e49
started fixing bugs
rema-soptim Apr 15, 2026
07f2170
started fixing bugs
rema-soptim Apr 15, 2026
9606a38
check before rebase
rema-soptim Apr 15, 2026
a8b4604
fixed bug, where associations to external classes caused the classedi…
rema-soptim Apr 15, 2026
261ca62
fixed more bugs, where resources were not deleted properly
rema-soptim Apr 15, 2026
484c234
structures some code
rema-soptim Apr 16, 2026
2f81e90
added tabs component
rema-soptim Apr 16, 2026
bd0b34f
Added:
rema-soptim Apr 20, 2026
e823eb9
Added: deleterequest for ontologies in header menu
rema-soptim Apr 21, 2026
9420b9e
Added another class delete dialog to the new in diagram context menu
rema-soptim Apr 21, 2026
3ad5054
backend lint
rema-soptim Apr 27, 2026
53a5a14
removed comments
rema-soptim Apr 27, 2026
7c01460
renamed variable
rema-soptim Apr 27, 2026
4b66d01
removed repeating checks for resource type
rema-soptim Apr 27, 2026
3f01c90
refactored code into util classes, for future reusability
rema-soptim Apr 27, 2026
c00203b
Potential fix for pull request finding 'Missing Override annotation'
rema-soptim Apr 27, 2026
48c7cbb
Potential fix for pull request finding 'Missing Override annotation'
rema-soptim Apr 27, 2026
02c0eb1
Potential fix for pull request finding 'Exposing internal representat…
rema-soptim Apr 27, 2026
2309805
rebase fixes
rema-soptim Apr 27, 2026
19caee3
rebase fixes
rema-soptim Apr 27, 2026
9ce6572
more rebase fixes
rema-soptim Apr 27, 2026
c62c430
fixed backend lint issues
rema-soptim Apr 27, 2026
ba6806c
fixed backend lint issues
rema-soptim Apr 27, 2026
5c5c4c9
backend lint
rema-soptim Apr 30, 2026
123b148
rebase bugs
rema-soptim Apr 30, 2026
b6c7c04
fixed bugs found in test:
rema-soptim Apr 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/*
* Copyright (c) 2024-2026 SOPTIM AG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.rdfarchitect.api.controller.datasets.graphs;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;

import lombok.RequiredArgsConstructor;

import org.rdfarchitect.api.dto.delete.ResourceDeleteRequest;
import org.rdfarchitect.api.dto.delete.relations.AffectedResource;
import org.rdfarchitect.database.GraphIdentifier;
import org.rdfarchitect.services.ExpandURIUseCase;
import org.rdfarchitect.services.delete.DeleteResourcesUseCase;
import org.rdfarchitect.services.delete.FindDeleteDependenciesUseCase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.UUID;

@RestController
@RequestMapping("api/datasets/{datasetName}/graphs/{graphURI}")
@RequiredArgsConstructor
public class DeleteRESTController {

private static final Logger logger = LoggerFactory.getLogger(DeleteRESTController.class);

private final ExpandURIUseCase expandURIUseCase;
private final FindDeleteDependenciesUseCase findDeleteDependenciesUseCase;
private final DeleteResourcesUseCase deleteResourcesUseCase;

@Operation(
summary = "Get deletion impact",
description =
"Returns a tree of affected resources for deleting the resource with the given UUID.",
tags = {"graph"},
responses = {@ApiResponse(responseCode = "200")})
@GetMapping("/uuid/{uuid}/deletion-impact")
public AffectedResource getDeletionImpact(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(
value = HttpHeaders.ORIGIN,
required = false,
defaultValue = "unknown")
String originURL,
@Parameter(description = "The literal name of the dataset.") @PathVariable
String datasetName,
@Parameter(
description =
"The url encoded uri of the graph, or \"default\" to access the default graph.")
@PathVariable
String graphURI,
@Parameter(description = "The url encoded iri identifier of the cim resource.")
@PathVariable
String uuid) {
logger.info(
"Received GET request: \"/api/datasets/{{}}/graphs/{{}}/uuid/{{}/deletion-impact\" from \"{}\".",
datasetName,
graphURI,
uuid,
originURL);

var extendedGraphURI = expandURIUseCase.expandUri(datasetName, graphURI);

var resultObj =
findDeleteDependenciesUseCase.getDeleteDependencies(
new GraphIdentifier(datasetName, extendedGraphURI), UUID.fromString(uuid));

logger.info(
"Sending response to GET request: \"/api/datasets/{{}}/graphs/{{}}/uuid/{{}/deletion-impact\" from \"{}\".",
datasetName,
graphURI,
uuid,
originURL);
return resultObj;
}

@Operation(
summary = "Delete resources",
description =
"Processes a list of delete requests, each specifying a resource UUID and the desired action.",
tags = {"graph"},
responses = {@ApiResponse(responseCode = "200")})
@PostMapping("/delete-requests")
public String deleteResources(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(
value = HttpHeaders.ORIGIN,
required = false,
defaultValue = "unknown")
String originURL,
@Parameter(description = "The literal name of the dataset.") @PathVariable
String datasetName,
@Parameter(
description =
"The url encoded uri of the graph, or \"default\" to access the default graph.")
@PathVariable
String graphURI,
@Parameter(
description =
"A list of resource delete requests, each containing the uuid of the resource to delete and the type of deletion")
@RequestBody
List<ResourceDeleteRequest> deleteRequests) {
logger.info(
"Received POST request: \"/api/datasets/{{}}/graphs/{{}}/delete\" from \"{}\".",
datasetName,
graphURI,
originURL);

var extendedGraphURI = expandURIUseCase.expandUri(datasetName, graphURI);

deleteResourcesUseCase.executeDeleteRequests(
new GraphIdentifier(datasetName, extendedGraphURI), deleteRequests);

logger.info(
"Sending response to POST request: \"/api/datasets/{{}}/graphs/{{}}/delete\" from \"{}\".",
datasetName,
graphURI,
originURL);
return "success";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
Expand Down Expand Up @@ -155,7 +156,10 @@ public List<ClassUMLAdaptedDTO> getClassList(
description =
"The url encoded uri of the graph, or \"default\" to access the default graph.")
@PathVariable
String graphURI) {
String graphURI,
@Parameter(description = "Whether to include external classes.")
@RequestParam(required = false, defaultValue = "false")
boolean includeExternalClasses) {
logger.info(
"Received GET request: \"/api/datasets/{{}}/graphs/{{}}/classes\" from \"{}\".",
datasetName,
Expand All @@ -166,7 +170,7 @@ public List<ClassUMLAdaptedDTO> getClassList(

var cimClassList =
getClassListUseCase.getClassList(
new GraphIdentifier(datasetName, extendedGraphURI));
new GraphIdentifier(datasetName, extendedGraphURI), includeExternalClasses);

logger.info(
"Sending response to GET request: \"/api/datasets/{{}}/graphs/{{}}/classes\" to \"{}\".",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024-2026 SOPTIM AG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.rdfarchitect.api.dto.delete;

public enum DeleteAction {

/** Delete the affected resource entirely. Applicable to all resource types. */
DELETE,

/**
* Keep the affected resource as-is, even though it references a deleted resource. E.g. a class
* that extends a deleted class — keep the class but accept that the parent reference becomes
* invalid.
*/
KEEP,

/**
* Remove the {@code cims:belongsToCategory} triple from a class whose package is being deleted.
*/
REMOVE_PACKAGE_REFERENCE,

/**
* Remove the {@code rdfs:subClassOf} triple from a class whose parent class is being deleted.
*/
REMOVE_SUBCLASS_REFERENCE;
}
Comment thread
tarn-soptim marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2024-2026 SOPTIM AG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.rdfarchitect.api.dto.delete;

import lombok.Data;

import java.util.UUID;

@Data
public class ResourceDeleteRequest {

private UUID uuid;

private DeleteAction action;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024-2026 SOPTIM AG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.rdfarchitect.api.dto.delete;

import lombok.Data;
import lombok.experimental.Accessors;

import java.util.UUID;

@Data
@Accessors(chain = true)
public class ResourceIdentifier {
private UUID uuid;
private String label;
private String namespace;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2024-2026 SOPTIM AG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.rdfarchitect.api.dto.delete.relations;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import org.rdfarchitect.api.dto.delete.ResourceIdentifier;
import org.rdfarchitect.models.cim.relations.model.CIMResourceTypeIdentifyingUtils;

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
Comment thread
rema-soptim marked this conversation as resolved.
Dismissed
@NoArgsConstructor
public class AffectedAssociation extends AffectedOwnedResource {

private ResourceIdentifier target;

public AffectedAssociation(
ResourceIdentifier resourceIdentifier,
CIMResourceTypeIdentifyingUtils.CimResourceType type,
AffectedResourceReason reason,
ResourceIdentifier domain,
ResourceIdentifier target) {
super(resourceIdentifier, type, reason, domain);
this.target = target;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2024-2026 SOPTIM AG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.rdfarchitect.api.dto.delete.relations;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import org.rdfarchitect.api.dto.delete.ResourceIdentifier;
import org.rdfarchitect.models.cim.relations.model.CIMResourceTypeIdentifyingUtils;

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
Comment thread
rema-soptim marked this conversation as resolved.
Dismissed
@NoArgsConstructor
public class AffectedOwnedResource extends AffectedResource {

private ResourceIdentifier domain;

public AffectedOwnedResource(
ResourceIdentifier resourceIdentifier,
CIMResourceTypeIdentifyingUtils.CimResourceType type,
AffectedResourceReason reason,
ResourceIdentifier domain) {
super(resourceIdentifier, type, reason);
this.domain = domain;
}
}
Loading
Loading