From 2aa909b14ee461e7c834519218d866356978e1ed Mon Sep 17 00:00:00 2001 From: bindeali <56399637+bindeali@users.noreply.github.com> Date: Wed, 18 Sep 2024 12:29:48 +0200 Subject: [PATCH] Diagram layout not always saved #549 --- src/queries/get/InitQueries.ts | 36 +++++++--------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/src/queries/get/InitQueries.ts b/src/queries/get/InitQueries.ts index 2243da19..c6d949a1 100644 --- a/src/queries/get/InitQueries.ts +++ b/src/queries/get/InitQueries.ts @@ -9,16 +9,14 @@ import { import { Cardinality } from "../../datatypes/Cardinality"; import { addDiagram } from "../../function/FunctionCreateVars"; import { - initLanguageObject, - parsePrefix, + initLanguageObject } from "../../function/FunctionEditVars"; import { processQuery } from "../../interface/TransactionInterface"; -import { qb } from "../QueryBuilder"; import { WorkspaceLinks } from "./../../config/Variables"; export async function getElementsConfig( contextEndpoint: string = AppSettings.contextEndpoint, - contexts: string[] = AppSettings.contextIRIs + diagramGraphs: string[] = Object.values(Diagrams).map(d => d.graph) ): Promise { const elements: { [key: string]: Partial<(typeof WorkspaceElements)[0]> } = {}; @@ -37,13 +35,7 @@ export async function getElementsConfig( "optional {?elem og:vocabulary ?vocabulary.}", "?elem og:scheme ?scheme .", "}", - `?contextIRI ${qb.i( - parsePrefix( - "d-sgov-pracovní-prostor-pojem", - `odkazuje-na-přílohový-kontext` - ) - )} ?graph.`, - `values ?contextIRI {<${contexts.join("> <")}>}`, + `values ?graph {<${diagramGraphs.join("> <")}>}`, "}", ].join(` `); @@ -95,13 +87,7 @@ export async function getElementsConfig( // Make sure it is really a diagram we are querying "?diagram og:representation ?representation .", "}", - `?contextIRI ${qb.i( - parsePrefix( - "d-sgov-pracovní-prostor-pojem", - `odkazuje-na-přílohový-kontext` - ) - )} ?graph.`, - `values ?contextIRI {<${contexts.join("> <")}>}`, + `values ?graph {<${diagramGraphs.join("> <")}>}`, "}", ].join(` `); @@ -258,7 +244,7 @@ export async function getSettings(contextEndpoint: string): Promise { export async function getLinksConfig( contextEndpoint: string = AppSettings.contextEndpoint, - contexts: string[] = AppSettings.contextIRIs + diagramGraphs: string[] = Object.values(Diagrams).map(d => d.graph) ): Promise { const links: { [key: string]: Partial<(typeof WorkspaceLinks)[0]> } = {}; const linkVertices: { [key: string]: Partial<(typeof WorkspaceLinks)[0]> } = @@ -279,11 +265,7 @@ export async function getLinksConfig( "?link og:targetCardinality1 ?targetCard1 .", "?link og:targetCardinality2 ?targetCard2 .", "}", - `?contextIRI <${parsePrefix( - "d-sgov-pracovní-prostor-pojem", - "odkazuje-na-přílohový-kontext" - )}> ?graph.`, - `values ?contextIRI {<${contexts.join("> <")}>}`, + `values ?graph {<${diagramGraphs.join("> <")}>}`, "}", ].join(` `); @@ -345,11 +327,7 @@ export async function getLinksConfig( "?diagram og:id ?diagramID.", "?diagram og:representation ?representation.", "}", - `?contextIRI <${parsePrefix( - "d-sgov-pracovní-prostor-pojem", - "odkazuje-na-přílohový-kontext" - )}> ?graph.`, - `values ?contextIRI {<${contexts.join("> <")}>}`, + `values ?graph {<${diagramGraphs.join("> <")}>}`, "}", ].join(` `);