Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

fix(ontology): silent empty state for offline backend + fix SHACL crash

KaifAhmad10efb018df088
diff --git a/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx b/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx
index 862153dc..94f02c13 100644
--- a/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx
+++ b/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx
@@ -63,11 +63,6 @@ export function AlignmentsTab() {
setAlignments(alignmentResult.value);
}
- // If both failed the backend is unreachable — show a soft warning so the
- // user knows data is missing (not just that the registry is empty).
- if (registryResult.status === "rejected" && alignmentResult.status === "rejected") {
- setError("Backend unavailable — connect the server to load ontologies and alignments.");
- }
}, []);
useEffect(() => {
diff --git a/explorer/src/workspaces/OntologyWorkspace/OntologyManager.tsx b/explorer/src/workspaces/OntologyWorkspace/OntologyManager.tsx
index bb831025..979fe4ee 100644
--- a/explorer/src/workspaces/OntologyWorkspace/OntologyManager.tsx
+++ b/explorer/src/workspaces/OntologyWorkspace/OntologyManager.tsx
@@ -259,14 +259,9 @@ export function OntologyManager() {
if (res.ok) {
setEntries(await res.json());
} else {
- // Non-OK response — show empty state with a soft warning (not a blocking error)
setEntries([]);
- if (res.status !== 404) {
- flashMsg("err", `Registry unavailable (HTTP ${res.status}) — connect the backend to load ontologies`);
- }
}
} catch {
- // Network error — backend not running; show empty state silently
setEntries([]);
} finally {
setLoading(false);
diff --git a/explorer/src/workspaces/OntologyWorkspace/ShaclStudio.tsx b/explorer/src/workspaces/OntologyWorkspace/ShaclStudio.tsx
index 91146d6f..288fc231 100644
--- a/explorer/src/workspaces/OntologyWorkspace/ShaclStudio.tsx
+++ b/explorer/src/workspaces/OntologyWorkspace/ShaclStudio.tsx
@@ -130,45 +130,50 @@ export function ShaclStudio({ onJumpToNode }: ShaclStudioProps) {
}, [shapes]);
const beforeMount = useCallback((monaco: Monaco) => {
- if (!monaco.languages.getLanguages().some((language: { id: string }) => language.id === "turtle")) {
- monaco.languages.register({ id: "turtle", extensions: [".ttl"], mimetypes: ["text/turtle"] });
- monaco.languages.setMonarchTokensProvider("turtle", {
- keywords: ["@prefix", "@base", "a"],
- tokenizer: {
- root: [
- [/#[^\n]*/, "comment"],
- [/"(?:[^"\\]|\\.)*"(?:@[a-zA-Z-]+|\\^\\^[^\s,;.]+)?/, "string"],
- [/'(?:[^'\\]|\\.)*'(?:@[a-zA-Z-]+|\\^\\^[^\s,;.]+)?/, "string"],
- [/"""[\s\S]*?"""/, "string"],
- [/<[^>]*>/, "type.identifier"],
- [/\b(?:@prefix|@base|a)\b/, "keyword"],
- [/\b(?:sh|xsd|owl|rdf|rdfs|skos):[\w]+/, "variable"],
- [/[a-zA-Z_][\w-]*:[\w]+/, "namespace"],
- [/[;,.]/, "delimiter"],
- [/\d+(?:\.\d+)?/, "number"],
- ],
+ try {
+ if (!monaco.languages.getLanguages().some((language: { id: string }) => language.id === "turtle")) {
+ monaco.languages.register({ id: "turtle", extensions: [".ttl"], mimetypes: ["text/turtle"] });
+ monaco.languages.setMonarchTokensProvider("turtle", {
+ tokenizer: {
+ root: [
+ [/#[^\n]*/, "comment"],
+ [/"(?:[^"\\]|\\.)*"/, "string"],
+ [/'(?:[^'\\]|\\.)*'/, "string"],
+ [/"""[\s\S]*?"""/, "string"],
+ [/<[^>]*>/, "type.identifier"],
+ // Use [@] to avoid Monarch treating @ as a language-property reference
+ [/[@](?:prefix|base)\b/, "keyword"],
+ [/\ba\b/, "keyword"],
+ [/\b(?:sh|xsd|owl|rdf|rdfs|skos):[\w]+/, "variable"],
+ [/[a-zA-Z_][\w-]*:[\w]+/, "namespace"],
+ [/[;,.]/, "delimiter"],
+ [/\d+(?:\.\d+)?/, "number"],
+ ],
+ },
+ });
+ }
+ monaco.editor.defineTheme("shacl-dark", {
+ base: "vs-dark",
+ inherit: true,
+ rules: [
+ { token: "keyword", foreground: "9ee8d7" },
+ { token: "string", foreground: "f2b66d" },
+ { token: "comment", foreground: "4a6070", fontStyle: "italic" },
+ { token: "type.identifier", foreground: "7ce7d3" },
+ { token: "variable", foreground: "d2a8ff" },
+ { token: "namespace", foreground: "a5d6ff" },
+ { token: "number", foreground: "79c0ff" },
+ { token: "delimiter", foreground: "8fa8c6" },
+ ],
+ colors: {
+ "editor.background": "#050b13",
+ "editor.foreground": "#d7e7f8",
+ "editorLineNumber.foreground": "#41536b",
},
});
+ } catch {
+ // Monaco setup failure should not crash the component
}
- monaco.editor.defineTheme("shacl-dark", {
- base: "vs-dark",
- inherit: true,
- rules: [
- { token: "keyword", foreground: "9ee8d7" },
- { token: "string", foreground: "f2b66d" },
- { token: "comment", foreground: "4a6070", fontStyle: "italic" },
- { token: "type.identifier", foreground: "7ce7d3" },
- { token: "variable", foreground: "d2a8ff" },
- { token: "namespace", foreground: "a5d6ff" },
- { token: "number", foreground: "79c0ff" },
- { token: "delimiter", foreground: "8fa8c6" },
- ],
- colors: {
- "editor.background": "#050b13",
- "editor.foreground": "#d7e7f8",
- "editorLineNumber.foreground": "#41536b",
- },
- });
}, []);
return (