Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -19,6 +19,7 @@

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
Expand Down Expand Up @@ -57,10 +58,16 @@ public class OntologyKnownInformationRESTController {
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = OntologyField.class)))
array =
@ArraySchema(
schema =
@Schema(
implementation =
OntologyField
.class))))
})
@GetMapping
public List<OntologyField> getOntology(
public List<OntologyField> getKnownOntologyFields(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(
value = HttpHeaders.ORIGIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class SchemaComparisonFromFilesRESTController {
@Operation(
summary = "compare schemas",
description = "Compare two given graphs",
tags = {"comparison"},
responses = {
@ApiResponse(
responseCode = "200",
Expand All @@ -68,7 +69,7 @@ public class SchemaComparisonFromFilesRESTController {
.class))))
})
@PostMapping
public List<TriplePackageChange> compareSchemas(
public List<TriplePackageChange> compareSchemasFromFiles(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(
value = HttpHeaders.ORIGIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import lombok.RequiredArgsConstructor;

import org.rdfarchitect.api.controller.Response;
import org.rdfarchitect.api.dto.DatasetDTO;
import org.rdfarchitect.services.select.ListDatasetsUseCase;
import org.rdfarchitect.services.update.dataset.DeleteDatasetUseCase;
import org.slf4j.Logger;
Expand All @@ -50,11 +51,12 @@ public class DatasetRESTController {

@Operation(
summary = "List datasets",
description = "Lists all non-snapshots datasets",
description =
"Lists all non-snapshots datasets including their prefixes and read-only status.",
tags = {"dataset"},
responses = {@ApiResponse(responseCode = "200")})
@GetMapping
public List<String> listDatasets(
public List<DatasetDTO> listDatasets(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(
value = HttpHeaders.ORIGIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public class GlobalClassLayoutDataRESTController {
private final UpdateClassPositionsUseCase updateClassPositionsUseCase;

@Operation(
summary = "updates class positions",
summary = "updates class positions on dataset level",
description =
"Updates the positions for all the classes provided in the request body with the provided coordinates.",
tags = {"diagram", "layout", "class"})
@PutMapping
public String updateClassPositions(
public String updateDatasetClassPositions(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(value = "origin", required = false, defaultValue = "unknown")
String originURL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class CustomDatasetDiagramsRESTController {
private final ReplaceCustomDiagramUseCase replaceCustomDiagram;

@GetMapping
public RenderingDataDTO getDiagramRenderingData(
public RenderingDataDTO getCustomDatasetViewRenderingData(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(
value = HttpHeaders.ORIGIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
Expand Down Expand Up @@ -72,13 +71,10 @@ public record ListPackagesResponse(
content =
@Content(
mediaType = "application/json",
array =
@ArraySchema(
schema =
@Schema(
implementation =
ListPackagesResponse
.class))))
schema =
@Schema(
implementation =
ListPackagesResponse.class)))
})
@GetMapping
public ListPackagesResponse listPackages(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class OntologyGenerateEntriesRESTController {
.class))))
})
@GetMapping
public List<OntologyEntry> getOntology(
public List<OntologyEntry> getOntologyEntries(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(
value = HttpHeaders.ORIGIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class SchemaComparisonRESTController {
@Operation(
summary = "compare schemas",
description = "Compare a given graph with the specified graph from the dataset",
tags = {"graph"},
tags = {"comparison"},
responses = {
@ApiResponse(
responseCode = "200",
Expand Down Expand Up @@ -113,7 +113,7 @@ public List<TriplePackageChange> compareSchemas(
@Operation(
summary = "compare schemas",
description = "Compare two graphs stored in the database",
tags = {"graph"},
tags = {"comparison"},
responses = {
@ApiResponse(
responseCode = "200",
Expand All @@ -129,7 +129,7 @@ public List<TriplePackageChange> compareSchemas(
.class))))
})
@GetMapping()
public List<TriplePackageChange> compareDatasetSchemas(
public List<TriplePackageChange> compareStoredSchemas(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(
value = HttpHeaders.ORIGIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class CustomDiagramsRESTController {
private final ExpandURIUseCase expandURIUseCase;

@GetMapping
public RenderingDataDTO getDiagramRenderingData(
public RenderingDataDTO getCustomProfileViewRenderingData(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(
value = HttpHeaders.ORIGIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.rdfarchitect.services.schemamigration.SetMigrationContextUseCase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
Expand Down Expand Up @@ -55,7 +56,7 @@ public class MigrationContextRESTController {
"Computes the diff of two given graphs and stores it in the session for later usage in migration endpoints. "
+ "Accepts the graphs either as file uploads, GraphIdentifiers or a combination of both.",
tags = {"migration"})
@PostMapping
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void computeMigrationContext(
@Parameter(description = "The name/url of the inquirer.")
@RequestHeader(value = "origin", required = false, defaultValue = "unknown")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
*
*/

import { BackendConnection } from "$lib/api/backend.js";
import { PUBLIC_BACKEND_URL } from "$lib/config/runtime";
package org.rdfarchitect.api.dto;

const bec = new BackendConnection(fetch, PUBLIC_BACKEND_URL);
import lombok.AllArgsConstructor;
import lombok.Data;

export async function getXSDPrimitives() {
const res = await bec.getXSDPrimitives();
return await res.json();
}
import org.rdfarchitect.models.cim.data.dto.CIMPrefixPair;

import java.util.List;

export async function getKnownFields() {
const res = await bec.getKnownOntologyFields();
return await res.json();
@Data
@AllArgsConstructor
public class DatasetDTO {
private String name;
private boolean readonly;
private List<CIMPrefixPair> prefixes;
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,8 @@ public void nullEmptyLists() {
if (associationPairs.isEmpty()) {
associationPairs = null;
}
if (enumEntries.isEmpty()) {
enumEntries = null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@

package org.rdfarchitect.services.select;

import org.rdfarchitect.api.dto.DatasetDTO;

import java.util.List;

public interface ListDatasetsUseCase {

List<String> listDatasets();
/**
* List all datasets including their prefixes and read-only status. Snapshots are excluded from
* the list.
*
* @return List of dataset objects
*/
List<DatasetDTO> listDatasets();
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFDataMgr;
import org.apache.jena.riot.RDFFormat;
import org.rdfarchitect.api.dto.DatasetDTO;
import org.rdfarchitect.database.DatabasePort;
import org.rdfarchitect.database.GraphIdentifier;
import org.rdfarchitect.models.cim.data.dto.CIMPrefixPair;
Expand Down Expand Up @@ -127,7 +128,18 @@ public String listFormattedPrefixes(String datasetName, String format) {
}

@Override
public List<String> listDatasets() {
return databasePort.listDatasets();
public List<DatasetDTO> listDatasets() {
var result = new ArrayList<DatasetDTO>();
for (var datasetName : databasePort.listDatasets()) {
var readonly = databasePort.isReadOnly(datasetName);
var prefixMapping = databasePort.getPrefixMapping(datasetName);

var prefixPairs = new ArrayList<CIMPrefixPair>();
for (var prefix : prefixMapping.getNsPrefixMap().entrySet()) {
prefixPairs.add(new CIMPrefixPair(prefix.getKey() + ":", prefix.getValue()));
}
result.add(new DatasetDTO(datasetName, readonly, prefixPairs));
}
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.rdfarchitect.api.controller.Response;
import org.rdfarchitect.api.dto.DatasetDTO;
import org.rdfarchitect.services.select.ListDatasetsUseCase;
import org.rdfarchitect.services.update.dataset.DeleteDatasetUseCase;
import org.springframework.http.HttpHeaders;
Expand All @@ -44,11 +45,13 @@ void setUp() {

@Test
void listDatasets_returnsValueFromUseCase() {
when(listDatasetsUseCase.listDatasets()).thenReturn(List.of("dataset-a", "dataset-b"));
var dataset1 = new DatasetDTO("dataset-a", false, List.of());
var dataset2 = new DatasetDTO("dataset-b", false, List.of());
when(listDatasetsUseCase.listDatasets()).thenReturn(List.of(dataset1, dataset2));

var result = controller.listDatasets(HttpHeaders.ORIGIN);

assertThat(result).containsExactly("dataset-a", "dataset-b");
assertThat(result).containsExactly(dataset1, dataset2);
verify(listDatasetsUseCase).listDatasets();
}

Expand Down
2 changes: 2 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ node_modules
/.svelte-kit
/build

src/lib/api/generated

# OS
.DS_Store
Thumbs.db
Expand Down
6 changes: 6 additions & 0 deletions frontend/LICENSES-THIRD-PARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
- **License:** (CC-BY-4.0 AND MIT)
- **URL:** [https://fontawesome.com](https://fontawesome.com)

### @hey-api/openapi-ts
- **Package:** @hey-api/openapi-ts
- **Version:** 0.97.1
- **License:** MIT
- **URL:** [https://heyapi.dev/](https://heyapi.dev/)

### @sveltejs/adapter-auto
- **Package:** @sveltejs/adapter-auto
- **Version:** 7.0.1
Expand Down
10 changes: 6 additions & 4 deletions frontend/licenses-third-party.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*
*/

import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";

const __filepath = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filepath);
Expand Down Expand Up @@ -65,7 +65,9 @@ function generateLicenseContent() {

let markdown = "# Third-Party Licenses\n\n";

for (const pkg of packages.sort((a, b) => a.name.localeCompare(b.name))) {
for (const pkg of packages.toSorted((a, b) =>
a.name.localeCompare(b.name),
)) {
markdown += `### ${pkg.name}\n`;
markdown += `- **Package:** ${pkg.name}\n`;
markdown += `- **Version:** ${pkg.version}\n`;
Expand Down
28 changes: 28 additions & 0 deletions frontend/openapi-ts.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.
*/

import { defineConfig } from "@hey-api/openapi-ts";

export default defineConfig({
input: "http://localhost:8080/v3/api-docs",
output: "src/lib/api/generated",
plugins: [
{
name: "@hey-api/client-fetch",
runtimeConfigPath: "./src/lib/api/hey-api",
},
],
});
Loading
Loading