Spaces:
Running
Running
Visualisation fix - Query is displayed again
Browse files- index.html +188 -143
index.html
CHANGED
|
@@ -2,70 +2,22 @@
|
|
| 2 |
<html lang="sv">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<title>
|
|
|
|
| 6 |
<script src="https://cdn.jsdelivr.net/npm/mermaid@10.9.8/dist/mermaid.min.js"></script>
|
| 7 |
<script src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
|
| 8 |
<style>
|
| 9 |
* { box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
|
| 10 |
-
body { margin: 0; padding: 12px; background: #f8fafc; color: #0f172a; display: flex; flex-direction: column; height: 100vh; }
|
| 11 |
|
| 12 |
-
|
|
|
|
| 13 |
.deck-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 14px; }
|
| 14 |
.deck-row-top { background: #f1f5f9; border-bottom: 1px solid #e2e8f0; border-top-left-radius: 7px; border-top-right-radius: 7px; }
|
| 15 |
|
| 16 |
.badge { background: #0284c7; color: #ffffff; font-weight: bold; padding: 4px 10px; border-radius: 6px; font-size: 13px; }
|
| 17 |
.section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #475569; display: flex; align-items: center; gap: 4px; }
|
| 18 |
|
| 19 |
-
/* Интерактивные бейджи стандарта IEC 63339 с подсказками */
|
| 20 |
-
.iec-badge {
|
| 21 |
-
display: inline-flex;
|
| 22 |
-
align-items: center;
|
| 23 |
-
gap: 3px;
|
| 24 |
-
background: #e0f2fe;
|
| 25 |
-
color: #0369a1;
|
| 26 |
-
border: 1px solid #7dd3fc;
|
| 27 |
-
padding: 2px 7px;
|
| 28 |
-
border-radius: 4px;
|
| 29 |
-
font-size: 10px;
|
| 30 |
-
font-weight: 700;
|
| 31 |
-
letter-spacing: 0.04em;
|
| 32 |
-
cursor: help;
|
| 33 |
-
position: relative;
|
| 34 |
-
}
|
| 35 |
-
.iec-badge:hover .iec-tooltip {
|
| 36 |
-
visibility: visible;
|
| 37 |
-
opacity: 1;
|
| 38 |
-
}
|
| 39 |
-
.iec-tooltip {
|
| 40 |
-
visibility: hidden;
|
| 41 |
-
opacity: 0;
|
| 42 |
-
position: absolute;
|
| 43 |
-
top: 130%;
|
| 44 |
-
left: 0;
|
| 45 |
-
z-index: 100;
|
| 46 |
-
background: #0f172a;
|
| 47 |
-
color: #f8fafc;
|
| 48 |
-
padding: 8px 12px;
|
| 49 |
-
border-radius: 6px;
|
| 50 |
-
font-size: 11px;
|
| 51 |
-
font-weight: 400;
|
| 52 |
-
line-height: 1.35;
|
| 53 |
-
min-width: 250px;
|
| 54 |
-
max-width: 320px;
|
| 55 |
-
box-shadow: 0 4px 14px rgba(0,0,0,0.2);
|
| 56 |
-
transition: opacity 0.15s ease-in-out;
|
| 57 |
-
pointer-events: none;
|
| 58 |
-
}
|
| 59 |
-
.iec-tooltip::after {
|
| 60 |
-
content: "";
|
| 61 |
-
position: absolute;
|
| 62 |
-
bottom: 100%;
|
| 63 |
-
left: 14px;
|
| 64 |
-
border-width: 5px;
|
| 65 |
-
border-style: solid;
|
| 66 |
-
border-color: transparent transparent #0f172a transparent;
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
button { background: #0f172a; color: #ffffff; border: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 500; }
|
| 70 |
button:hover { background: #334155; }
|
| 71 |
button.secondary { background: #e2e8f0; color: #0f172a; }
|
|
@@ -88,6 +40,7 @@
|
|
| 88 |
#mermaid-container { width: 100%; height: 100%; position: absolute; top: 0; left: 0; overflow: auto; padding: 24px 24px 140px 24px; display: flex; justify-content: center; align-items: flex-start; background: #ffffff; }
|
| 89 |
#mermaid-container svg { width: auto; height: auto; max-width: none; }
|
| 90 |
|
|
|
|
| 91 |
.graph-legend {
|
| 92 |
position: absolute;
|
| 93 |
bottom: 12px;
|
|
@@ -108,6 +61,7 @@
|
|
| 108 |
.legend-section-title { font-weight: 600; color: #64748b; font-size: 10px; margin-bottom: 3px; text-transform: uppercase; }
|
| 109 |
.legend-item { display: flex; align-items: center; margin-bottom: 3px; line-height: 1.25; }
|
| 110 |
|
|
|
|
| 111 |
.swatch-box-sys { width: 13px; height: 11px; background: #0284c7; border: 1px solid #0369a1; border-radius: 2px; margin-right: 8px; flex-shrink: 0; }
|
| 112 |
.swatch-box-elem { width: 13px; height: 11px; background: #64748b; border: 1px solid #475569; border-radius: 2px; margin-right: 8px; flex-shrink: 0; }
|
| 113 |
.swatch-box-4d { width: 13px; height: 11px; background: #4f46e5; border: 1px solid #3730a3; border-radius: 2px; margin-right: 8px; flex-shrink: 0; }
|
|
@@ -118,34 +72,33 @@
|
|
| 118 |
.swatch-line-past { width: 16px; height: 0; border-top: 2px dashed #94a3b8; margin-right: 8px; flex-shrink: 0; }
|
| 119 |
.swatch-line-transition { width: 16px; height: 2px; background: #f59e0b; margin-right: 8px; flex-shrink: 0; }
|
| 120 |
|
| 121 |
-
|
| 122 |
-
.
|
| 123 |
-
.card
|
| 124 |
-
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
| 126 |
ul.tree li::before { content: "├─ "; color: #94a3b8; }
|
| 127 |
ul.tree li:last-child::before { content: "└─ "; color: #94a3b8; }
|
|
|
|
| 128 |
table { width: 100%; border-collapse: collapse; font-size: 11px; }
|
| 129 |
-
th, td { text-align: left; padding:
|
| 130 |
th { color: #64748b; font-weight: 600; }
|
| 131 |
.active-row { background: #f0fdf4; }
|
| 132 |
.closed-row { color: #94a3b8; text-decoration: line-through; }
|
| 133 |
-
|
|
|
|
| 134 |
</style>
|
| 135 |
</head>
|
| 136 |
<body>
|
| 137 |
|
|
|
|
| 138 |
<div class="control-deck">
|
| 139 |
-
<!--
|
| 140 |
<div class="deck-row deck-row-top">
|
| 141 |
-
|
| 142 |
-
<!-- SMIM: Top-Level Ontology -->
|
| 143 |
-
<div class="section-label">
|
| 144 |
-
<span class="iec-badge">IEC 63339 / SMIM
|
| 145 |
-
<span class="iec-tooltip" id="tt-smim"></span>
|
| 146 |
-
</span>
|
| 147 |
-
<span id="lbl-onto-title">Ontologi:</span>
|
| 148 |
-
</div>
|
| 149 |
<div class="btn-group">
|
| 150 |
<button id="onto-bfo" class="active" onclick="setOntology('BFO')">BFO (3D Continuant)</button>
|
| 151 |
<button id="onto-iso" onclick="setOntology('ISO15926')">ISO 15926 (4D Perdurant)</button>
|
|
@@ -153,13 +106,7 @@
|
|
| 153 |
|
| 154 |
<div class="divider"></div>
|
| 155 |
|
| 156 |
-
<
|
| 157 |
-
<div class="section-label">
|
| 158 |
-
<span class="iec-badge">IEC 63339 / SMS
|
| 159 |
-
<span class="iec-tooltip" id="tt-sms"></span>
|
| 160 |
-
</span>
|
| 161 |
-
<span id="lbl-graph-title">Datamodell:</span>
|
| 162 |
-
</div>
|
| 163 |
<div class="btn-group">
|
| 164 |
<button id="mode-lpg" class="active" onclick="setGraphMode('LPG')">LPG</button>
|
| 165 |
<button id="mode-rdf" onclick="setGraphMode('RDF')">RDF (W3C)</button>
|
|
@@ -167,7 +114,6 @@
|
|
| 167 |
|
| 168 |
<div class="divider"></div>
|
| 169 |
|
| 170 |
-
<!-- Визуализатор -->
|
| 171 |
<div class="section-label">🎨 <span id="lbl-engine-title">Motor:</span></div>
|
| 172 |
<div class="btn-group">
|
| 173 |
<button id="eng-vis" class="active" onclick="setEngine('vis')">🌐 Vis.js</button>
|
|
@@ -181,21 +127,13 @@
|
|
| 181 |
</div>
|
| 182 |
</div>
|
| 183 |
|
| 184 |
-
<!--
|
| 185 |
<div class="deck-row">
|
| 186 |
<span class="badge" id="time-display">T = 0</span>
|
| 187 |
<button id="step-btn" onclick="advanceTime()"></button>
|
| 188 |
|
| 189 |
<div class="divider"></div>
|
| 190 |
|
| 191 |
-
<!-- Зафиксированная Domain Ontology (SMRM) -->
|
| 192 |
-
<span class="iec-badge" style="background: #f1f5f9; color: #475569; border-color: #cbd5e1;">
|
| 193 |
-
IEC 63339 / SMRM: <span id="lbl-smrm-status" style="font-weight: normal; margin-left: 3px;">Domain Ontology (Fixed: System/IDO)</span>
|
| 194 |
-
<span class="iec-tooltip" id="tt-smrm"></span>
|
| 195 |
-
</span>
|
| 196 |
-
|
| 197 |
-
<div class="divider"></div>
|
| 198 |
-
|
| 199 |
<label id="lbl-parent" style="font-size: 11px; color: #64748b; font-weight: 600;"></label>
|
| 200 |
<select id="parent-select"></select>
|
| 201 |
|
|
@@ -211,35 +149,42 @@
|
|
| 211 |
<label style="font-size: 11px; color: #475569; display: flex; align-items: center; gap: 4px;">
|
| 212 |
<input type="checkbox" id="history-toggle" checked onchange="render()"> <span id="lbl-history"></span>
|
| 213 |
</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
</div>
|
| 215 |
</div>
|
| 216 |
|
| 217 |
<div class="main-container">
|
|
|
|
| 218 |
<div id="canvas-container">
|
| 219 |
<div id="vis-container"></div>
|
| 220 |
<div id="mermaid-container" style="display: none;"></div>
|
| 221 |
<div id="graph-legend" class="graph-legend"></div>
|
| 222 |
</div>
|
| 223 |
|
|
|
|
| 224 |
<div class="sidebar">
|
| 225 |
-
<!--
|
| 226 |
-
<div class="card" style="flex: 0 0
|
| 227 |
-
<h4>
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
<
|
|
|
|
| 234 |
</div>
|
| 235 |
|
| 236 |
-
<!--
|
| 237 |
-
<div class="card" style="flex:
|
| 238 |
-
<h4>
|
| 239 |
-
|
| 240 |
-
<span id="storage-paradigm-tag" style="color:#0284c7; font-weight: 600;"></span>
|
| 241 |
-
</h4>
|
| 242 |
-
<div id="storage-content"></div>
|
| 243 |
</div>
|
| 244 |
</div>
|
| 245 |
</div>
|
|
@@ -263,20 +208,16 @@
|
|
| 263 |
addBtn: "+ Lägg till",
|
| 264 |
removeBtn: "Uteslut relation",
|
| 265 |
history: "Historik",
|
|
|
|
|
|
|
| 266 |
titleBom: "Struktur (BOM-träd)",
|
|
|
|
| 267 |
titleStorage: "Under huven",
|
| 268 |
activeStatus: "Aktiv",
|
| 269 |
closedStatus: "Avslutad",
|
| 270 |
sourceCol: "Källa",
|
| 271 |
targetCol: "Mål",
|
| 272 |
statusCol: "Status",
|
| 273 |
-
smrmStatus: "Domänontologi (Låst: System/IDO)",
|
| 274 |
-
tooltips: {
|
| 275 |
-
urmsm: "<b>URMSM (Dimension & Aspect)</b><br/>Definierar intressentens perspektiv (ISO 42010 Viewpoint). Användaren ser bara BOM-strukturen vid tidpunkten T, oavsett underliggande IT-lager.",
|
| 276 |
-
smrm: "<b>SMRM (Concept Repository)</b><br/>Domänontologi och gemensam begreppsbank (System, Component, Physical/Functional Object). Här låst till standardiserad produktnedbrytning.",
|
| 277 |
-
smim: "<b>SMIM (Information Elements & Rules)</b><br/>Top-Level Ontology (TLO). Formella regler för hur begreppen existerar i tiden: 3D-objekt med tidsintervall (BFO) eller 4D-rumtidsindivider (ISO 15926).",
|
| 278 |
-
sms: "<b>SMS (Data in Tool)</b><br/>Den faktiska IT-implementationen och datalagringen (Property Graph / Neo4j kontra W3C RDF Triples)."
|
| 279 |
-
},
|
| 280 |
legend: {
|
| 281 |
title: "Teckenförklaring",
|
| 282 |
nodes: "Noder",
|
|
@@ -305,20 +246,16 @@
|
|
| 305 |
addBtn: "+ Add",
|
| 306 |
removeBtn: "Sever relation",
|
| 307 |
history: "History",
|
|
|
|
|
|
|
| 308 |
titleBom: "BOM Tree Structure",
|
|
|
|
| 309 |
titleStorage: "Under the Bonnet",
|
| 310 |
activeStatus: "Active",
|
| 311 |
closedStatus: "Closed",
|
| 312 |
sourceCol: "Source",
|
| 313 |
targetCol: "Target",
|
| 314 |
statusCol: "Status",
|
| 315 |
-
smrmStatus: "Domain Ontology (Fixed: System/IDO)",
|
| 316 |
-
tooltips: {
|
| 317 |
-
urmsm: "<b>URMSM (Dimension & Aspect)</b><br/>Captures the stakeholder concern and viewpoint (ISO 42010). The engineer always sees a unified BOM snapshot at time T, decoupled from graph mechanics.",
|
| 318 |
-
smrm: "<b>SMRM (Concept Repository)</b><br/>Domain Ontology: the shared engineering lexicon (System, System Element, Physical/Functional Object). Fixed here to physical decomposition.",
|
| 319 |
-
smim: "<b>SMIM (Information Elements & Rules)</b><br/>Top-Level Ontology (TLO). Axiomatic rules governing time and identity: 3D Continuants (BFO) vs 4D Spatio-Temporal Extents (ISO 15926).",
|
| 320 |
-
sms: "<b>SMS (Data in Tool)</b><br/>Low-level physical IT implementation: Labeled Property Graphs (Neo4j style) vs W3C RDF Triples and serialized statements."
|
| 321 |
-
},
|
| 322 |
legend: {
|
| 323 |
title: "Graph Legend",
|
| 324 |
nodes: "Node Types",
|
|
@@ -347,20 +284,16 @@
|
|
| 347 |
addBtn: "+ Добавить",
|
| 348 |
removeBtn: "Исключить связь",
|
| 349 |
history: "История",
|
|
|
|
|
|
|
| 350 |
titleBom: "Состав изделия (BOM)",
|
|
|
|
| 351 |
titleStorage: "Под капотом",
|
| 352 |
activeStatus: "Активна",
|
| 353 |
closedStatus: "Закрыта",
|
| 354 |
sourceCol: "Источник",
|
| 355 |
targetCol: "Цель",
|
| 356 |
statusCol: "Статус",
|
| 357 |
-
smrmStatus: "Domain Ontology (Зафиксирована: System/IDO)",
|
| 358 |
-
tooltips: {
|
| 359 |
-
urmsm: "<b>URMSM (Dimension & Aspect)</b><br/>Уровень точки зрения пользователя (ISO 42010). Инженер всегда видит чистый срез BOM на момент времени T, абстрагированный от структуры базы данных.",
|
| 360 |
-
smrm: "<b>SMRM (Concept Repository)</b><br/>Онтология предметной области (Domain Ontology). Общий словарь понятий проекта (System, Component, Physical Object). Зафиксирована на базовой декомпозиции.",
|
| 361 |
-
smim: "<b>SMIM (Information Elements & Rules)</b><br/>Верхнеуровневая онтология (TLO). Математические аксиомы бытия и времени: 3D-тела с интервалами связей (BFO) или 4D-объемы пространства-времени (ISO 15926).",
|
| 362 |
-
sms: "<b>SMS (Data in Tool)</b><br/>Физическое IT-хранилище в конкретной СУБД: узлы и свойства на ребрах (LPG) против атомарных триплетов URI (W3C RDF)."
|
| 363 |
-
},
|
| 364 |
legend: {
|
| 365 |
title: "Легенда графа",
|
| 366 |
nodes: "Типы узлов",
|
|
@@ -382,9 +315,9 @@
|
|
| 382 |
};
|
| 383 |
|
| 384 |
let currentLang = 'sv';
|
| 385 |
-
let currentOntology = 'BFO';
|
| 386 |
-
let currentMode = 'LPG';
|
| 387 |
-
let currentEngine = 'vis';
|
| 388 |
let currentTime = 0;
|
| 389 |
const ROOT_ID = 'System_A';
|
| 390 |
|
|
@@ -458,15 +391,11 @@
|
|
| 458 |
document.getElementById('add-btn').innerText = t.addBtn;
|
| 459 |
document.getElementById('remove-btn').innerText = t.removeBtn;
|
| 460 |
document.getElementById('lbl-history').innerText = t.history;
|
|
|
|
|
|
|
| 461 |
document.getElementById('title-bom').innerText = t.titleBom;
|
|
|
|
| 462 |
document.getElementById('title-storage').innerText = t.titleStorage;
|
| 463 |
-
document.getElementById('lbl-smrm-status').innerText = t.smrmStatus;
|
| 464 |
-
|
| 465 |
-
// Локализация тултипов IEC 63339
|
| 466 |
-
document.getElementById('tt-urmsm').innerHTML = t.tooltips.urmsm;
|
| 467 |
-
document.getElementById('tt-smrm').innerHTML = t.tooltips.smrm;
|
| 468 |
-
document.getElementById('tt-smim').innerHTML = t.tooltips.smim;
|
| 469 |
-
document.getElementById('tt-sms').innerHTML = t.tooltips.sms;
|
| 470 |
|
| 471 |
render();
|
| 472 |
}
|
|
@@ -549,6 +478,63 @@
|
|
| 549 |
render();
|
| 550 |
}
|
| 551 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 552 |
function buildTreeHTML(nodeId, activeEdges) {
|
| 553 |
const children = activeEdges.filter(e => e.from === nodeId).map(e => e.to);
|
| 554 |
if (children.length === 0) return '';
|
|
@@ -620,7 +606,6 @@
|
|
| 620 |
});
|
| 621 |
}
|
| 622 |
} else {
|
| 623 |
-
// ISO 15926
|
| 624 |
baseNodes.forEach(n => {
|
| 625 |
visNodes.add({
|
| 626 |
id: `4d_${n.id}`,
|
|
@@ -661,6 +646,7 @@
|
|
| 661 |
color: e.isActive ? { color: '#10b981' } : { color: '#cbd5e1' },
|
| 662 |
width: e.isActive ? 2 : 1
|
| 663 |
});
|
|
|
|
| 664 |
if (!parentStates[e.from]) parentStates[e.from] = [];
|
| 665 |
parentStates[e.from].push({ id: parentStateId, edge: e });
|
| 666 |
} else {
|
|
@@ -740,7 +726,6 @@
|
|
| 740 |
});
|
| 741 |
}
|
| 742 |
} else {
|
| 743 |
-
// ISO 15926
|
| 744 |
baseNodes.forEach(n => {
|
| 745 |
const wId = `whole_${safeId(n.id)}`;
|
| 746 |
def += ` ${wId}["<b>${n.label}_4D</b><br/>iso:ActualIndividual"]:::iso4d\n`;
|
|
@@ -843,7 +828,6 @@
|
|
| 843 |
`;
|
| 844 |
}
|
| 845 |
} else {
|
| 846 |
-
// ISO 15926
|
| 847 |
const extraLpgEdge = (currentMode === 'LPG')
|
| 848 |
? `<div class="legend-item"><span class="swatch-line-transition"></span>${leg.isoTransitionRel}</div>`
|
| 849 |
: '';
|
|
@@ -865,6 +849,68 @@
|
|
| 865 |
}
|
| 866 |
}
|
| 867 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 868 |
function render() {
|
| 869 |
const t = i18n[currentLang];
|
| 870 |
const showHistory = document.getElementById('history-toggle').checked;
|
|
@@ -886,11 +932,9 @@
|
|
| 886 |
|
| 887 |
updateLegend();
|
| 888 |
|
| 889 |
-
// URMSM BOM View
|
| 890 |
const treeContainer = document.getElementById('tree-container');
|
| 891 |
treeContainer.innerHTML = `<strong>${ROOT_ID}</strong>` + buildTreeHTML(ROOT_ID, activeEdges);
|
| 892 |
|
| 893 |
-
// Контролы
|
| 894 |
const parentSelect = document.getElementById('parent-select');
|
| 895 |
const removeSelect = document.getElementById('remove-select');
|
| 896 |
parentSelect.innerHTML = '';
|
|
@@ -911,10 +955,12 @@
|
|
| 911 |
removeSelect.appendChild(opt);
|
| 912 |
});
|
| 913 |
|
| 914 |
-
//
|
|
|
|
|
|
|
| 915 |
const storageTag = document.getElementById('storage-paradigm-tag');
|
| 916 |
const storageContent = document.getElementById('storage-content');
|
| 917 |
-
storageTag.innerText = `
|
| 918 |
|
| 919 |
if (currentOntology === 'BFO') {
|
| 920 |
if (currentMode === 'LPG') {
|
|
@@ -930,7 +976,7 @@
|
|
| 930 |
html += '</tbody></table>';
|
| 931 |
storageContent.innerHTML = html;
|
| 932 |
} else {
|
| 933 |
-
let ttl = `# BFO 3D
|
| 934 |
edgesStore.forEach(e => {
|
| 935 |
const isActive = (e.valid_to === null || edge.valid_to > currentTime) && edge.valid_from <= currentTime;
|
| 936 |
if (!isActive && !showHistory) return;
|
|
@@ -942,7 +988,6 @@
|
|
| 942 |
storageContent.innerHTML = `<pre class="code-block">${ttl}</pre>`;
|
| 943 |
}
|
| 944 |
} else {
|
| 945 |
-
// ISO 15926
|
| 946 |
if (currentMode === 'LPG') {
|
| 947 |
let html = `<table><thead><tr><th>Parent Slice</th><th>Child Slice</th><th>LPG Rel Properties</th><th>4D Extent</th></tr></thead><tbody>`;
|
| 948 |
visibleEdges.forEach(e => {
|
|
@@ -956,7 +1001,7 @@
|
|
| 956 |
html += '</tbody></table>';
|
| 957 |
storageContent.innerHTML = html;
|
| 958 |
} else {
|
| 959 |
-
let ttl = `# ISO 15926-2
|
| 960 |
visibleEdges.forEach(e => {
|
| 961 |
const pState = `:${e.from}_state_${e.id}`;
|
| 962 |
const cState = `:${e.to}_state_${e.id}`;
|
|
|
|
| 2 |
<html lang="sv">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<title>Knowledge Architecture Workbench (BFO vs ISO 15926 | LPG vs RDF)</title>
|
| 6 |
+
<!-- Third-party CDN libraries: Mermaid.js & Vis.js -->
|
| 7 |
<script src="https://cdn.jsdelivr.net/npm/mermaid@10.9.8/dist/mermaid.min.js"></script>
|
| 8 |
<script src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
|
| 9 |
<style>
|
| 10 |
* { box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
|
| 11 |
+
body { margin: 0; padding: 12px; background: #f8fafc; color: #0f172a; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
|
| 12 |
|
| 13 |
+
/* Dual-tier control console */
|
| 14 |
+
.control-deck { background: #ffffff; border: 1px solid #cbd5e1; border-radius: 8px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); flex-shrink: 0; }
|
| 15 |
.deck-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 14px; }
|
| 16 |
.deck-row-top { background: #f1f5f9; border-bottom: 1px solid #e2e8f0; border-top-left-radius: 7px; border-top-right-radius: 7px; }
|
| 17 |
|
| 18 |
.badge { background: #0284c7; color: #ffffff; font-weight: bold; padding: 4px 10px; border-radius: 6px; font-size: 13px; }
|
| 19 |
.section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #475569; display: flex; align-items: center; gap: 4px; }
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
button { background: #0f172a; color: #ffffff; border: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 500; }
|
| 22 |
button:hover { background: #334155; }
|
| 23 |
button.secondary { background: #e2e8f0; color: #0f172a; }
|
|
|
|
| 40 |
#mermaid-container { width: 100%; height: 100%; position: absolute; top: 0; left: 0; overflow: auto; padding: 24px 24px 140px 24px; display: flex; justify-content: center; align-items: flex-start; background: #ffffff; }
|
| 41 |
#mermaid-container svg { width: auto; height: auto; max-width: none; }
|
| 42 |
|
| 43 |
+
/* Dynamic graph legend badge */
|
| 44 |
.graph-legend {
|
| 45 |
position: absolute;
|
| 46 |
bottom: 12px;
|
|
|
|
| 61 |
.legend-section-title { font-weight: 600; color: #64748b; font-size: 10px; margin-bottom: 3px; text-transform: uppercase; }
|
| 62 |
.legend-item { display: flex; align-items: center; margin-bottom: 3px; line-height: 1.25; }
|
| 63 |
|
| 64 |
+
/* Legend glyph swatches */
|
| 65 |
.swatch-box-sys { width: 13px; height: 11px; background: #0284c7; border: 1px solid #0369a1; border-radius: 2px; margin-right: 8px; flex-shrink: 0; }
|
| 66 |
.swatch-box-elem { width: 13px; height: 11px; background: #64748b; border: 1px solid #475569; border-radius: 2px; margin-right: 8px; flex-shrink: 0; }
|
| 67 |
.swatch-box-4d { width: 13px; height: 11px; background: #4f46e5; border: 1px solid #3730a3; border-radius: 2px; margin-right: 8px; flex-shrink: 0; }
|
|
|
|
| 72 |
.swatch-line-past { width: 16px; height: 0; border-top: 2px dashed #94a3b8; margin-right: 8px; flex-shrink: 0; }
|
| 73 |
.swatch-line-transition { width: 16px; height: 2px; background: #f59e0b; margin-right: 8px; flex-shrink: 0; }
|
| 74 |
|
| 75 |
+
/* Right sidebar container with fixed flex ratios */
|
| 76 |
+
.sidebar { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 360px; max-width: 440px; height: 100%; min-height: 0; }
|
| 77 |
+
.card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; min-height: 0; }
|
| 78 |
+
.card h4 { margin: 0 0 6px 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
|
| 79 |
+
.card-body { overflow-y: auto; flex: 1; min-height: 0; }
|
| 80 |
+
|
| 81 |
+
ul.tree, ul.tree ul { list-style-type: none; padding-left: 14px; margin: 2px 0; }
|
| 82 |
+
ul.tree li { position: relative; padding: 2px 0; font-size: 12px; }
|
| 83 |
ul.tree li::before { content: "├─ "; color: #94a3b8; }
|
| 84 |
ul.tree li:last-child::before { content: "└─ "; color: #94a3b8; }
|
| 85 |
+
|
| 86 |
table { width: 100%; border-collapse: collapse; font-size: 11px; }
|
| 87 |
+
th, td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #f1f5f9; }
|
| 88 |
th { color: #64748b; font-weight: 600; }
|
| 89 |
.active-row { background: #f0fdf4; }
|
| 90 |
.closed-row { color: #94a3b8; text-decoration: line-through; }
|
| 91 |
+
|
| 92 |
+
pre.code-block { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; color: #1e293b; line-height: 1.4; background: #f8fafc; padding: 8px 10px; border-radius: 4px; border: 1px solid #e2e8f0; overflow-y: auto; white-space: pre-wrap; word-break: break-all; height: 100%; box-sizing: border-box; }
|
| 93 |
</style>
|
| 94 |
</head>
|
| 95 |
<body>
|
| 96 |
|
| 97 |
+
<!-- Dual-tier control console -->
|
| 98 |
<div class="control-deck">
|
| 99 |
+
<!-- Tier 1: Architectural paradigms -->
|
| 100 |
<div class="deck-row deck-row-top">
|
| 101 |
+
<div class="section-label">🏛️ <span id="lbl-onto-title">Ontologi:</span></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
<div class="btn-group">
|
| 103 |
<button id="onto-bfo" class="active" onclick="setOntology('BFO')">BFO (3D Continuant)</button>
|
| 104 |
<button id="onto-iso" onclick="setOntology('ISO15926')">ISO 15926 (4D Perdurant)</button>
|
|
|
|
| 106 |
|
| 107 |
<div class="divider"></div>
|
| 108 |
|
| 109 |
+
<div class="section-label">💾 <span id="lbl-graph-title">Datamodell:</span></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
<div class="btn-group">
|
| 111 |
<button id="mode-lpg" class="active" onclick="setGraphMode('LPG')">LPG</button>
|
| 112 |
<button id="mode-rdf" onclick="setGraphMode('RDF')">RDF (W3C)</button>
|
|
|
|
| 114 |
|
| 115 |
<div class="divider"></div>
|
| 116 |
|
|
|
|
| 117 |
<div class="section-label">🎨 <span id="lbl-engine-title">Motor:</span></div>
|
| 118 |
<div class="btn-group">
|
| 119 |
<button id="eng-vis" class="active" onclick="setEngine('vis')">🌐 Vis.js</button>
|
|
|
|
| 127 |
</div>
|
| 128 |
</div>
|
| 129 |
|
| 130 |
+
<!-- Tier 2: Operational engineering actions & file persistence -->
|
| 131 |
<div class="deck-row">
|
| 132 |
<span class="badge" id="time-display">T = 0</span>
|
| 133 |
<button id="step-btn" onclick="advanceTime()"></button>
|
| 134 |
|
| 135 |
<div class="divider"></div>
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
<label id="lbl-parent" style="font-size: 11px; color: #64748b; font-weight: 600;"></label>
|
| 138 |
<select id="parent-select"></select>
|
| 139 |
|
|
|
|
| 149 |
<label style="font-size: 11px; color: #475569; display: flex; align-items: center; gap: 4px;">
|
| 150 |
<input type="checkbox" id="history-toggle" checked onchange="render()"> <span id="lbl-history"></span>
|
| 151 |
</label>
|
| 152 |
+
|
| 153 |
+
<!-- Client-side export and import controls -->
|
| 154 |
+
<div style="margin-left: auto; display: flex; gap: 6px;">
|
| 155 |
+
<button id="btn-export" class="secondary" onclick="exportStateToFile()">💾 <span id="lbl-export">Exportera</span></button>
|
| 156 |
+
<button id="btn-import" class="secondary" onclick="document.getElementById('file-importer').click()">📂 <span id="lbl-import">Importera</span></button>
|
| 157 |
+
<input type="file" id="file-importer" accept=".json" style="display: none;" onchange="importStateFromFile(event)">
|
| 158 |
+
</div>
|
| 159 |
</div>
|
| 160 |
</div>
|
| 161 |
|
| 162 |
<div class="main-container">
|
| 163 |
+
<!-- Visualisation canvas -->
|
| 164 |
<div id="canvas-container">
|
| 165 |
<div id="vis-container"></div>
|
| 166 |
<div id="mermaid-container" style="display: none;"></div>
|
| 167 |
<div id="graph-legend" class="graph-legend"></div>
|
| 168 |
</div>
|
| 169 |
|
| 170 |
+
<!-- Sidebar: 3 inspection cards -->
|
| 171 |
<div class="sidebar">
|
| 172 |
+
<!-- 1. End-user viewpoint (IEC 63339 URMSM BOM View) -->
|
| 173 |
+
<div class="card" style="flex: 0 0 22%;">
|
| 174 |
+
<h4><span id="title-bom"></span> <span style="color:#0284c7; font-weight: normal;">URMSM / Viewpoint</span></h4>
|
| 175 |
+
<div class="card-body" id="tree-container"></div>
|
| 176 |
+
</div>
|
| 177 |
+
|
| 178 |
+
<!-- 2. Query complexity inspector (Cypher / SPARQL) -->
|
| 179 |
+
<div class="card" style="flex: 0 0 38%;">
|
| 180 |
+
<h4><span id="title-query"></span> <span id="query-lang-tag" style="color:#0284c7; font-weight: 600;"></span></h4>
|
| 181 |
+
<div class="card-body" id="query-content"></div>
|
| 182 |
</div>
|
| 183 |
|
| 184 |
+
<!-- 3. Physical data model representation -->
|
| 185 |
+
<div class="card" style="flex: 0 0 40%;">
|
| 186 |
+
<h4><span id="title-storage"></span> <span id="storage-paradigm-tag" style="color:#0284c7; font-weight: normal;"></span></h4>
|
| 187 |
+
<div class="card-body" id="storage-content"></div>
|
|
|
|
|
|
|
|
|
|
| 188 |
</div>
|
| 189 |
</div>
|
| 190 |
</div>
|
|
|
|
| 208 |
addBtn: "+ Lägg till",
|
| 209 |
removeBtn: "Uteslut relation",
|
| 210 |
history: "Historik",
|
| 211 |
+
exportBtn: "Exportera JSON",
|
| 212 |
+
importBtn: "Importera JSON",
|
| 213 |
titleBom: "Struktur (BOM-träd)",
|
| 214 |
+
titleQuery: "Genererad databasfråga",
|
| 215 |
titleStorage: "Under huven",
|
| 216 |
activeStatus: "Aktiv",
|
| 217 |
closedStatus: "Avslutad",
|
| 218 |
sourceCol: "Källa",
|
| 219 |
targetCol: "Mål",
|
| 220 |
statusCol: "Status",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
legend: {
|
| 222 |
title: "Teckenförklaring",
|
| 223 |
nodes: "Noder",
|
|
|
|
| 246 |
addBtn: "+ Add",
|
| 247 |
removeBtn: "Sever relation",
|
| 248 |
history: "History",
|
| 249 |
+
exportBtn: "Export JSON",
|
| 250 |
+
importBtn: "Import JSON",
|
| 251 |
titleBom: "BOM Tree Structure",
|
| 252 |
+
titleQuery: "Generated Database Query",
|
| 253 |
titleStorage: "Under the Bonnet",
|
| 254 |
activeStatus: "Active",
|
| 255 |
closedStatus: "Closed",
|
| 256 |
sourceCol: "Source",
|
| 257 |
targetCol: "Target",
|
| 258 |
statusCol: "Status",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
legend: {
|
| 260 |
title: "Graph Legend",
|
| 261 |
nodes: "Node Types",
|
|
|
|
| 284 |
addBtn: "+ Добавить",
|
| 285 |
removeBtn: "Исключить связь",
|
| 286 |
history: "История",
|
| 287 |
+
exportBtn: "Экспорт JSON",
|
| 288 |
+
importBtn: "Импорт JSON",
|
| 289 |
titleBom: "Состав изделия (BOM)",
|
| 290 |
+
titleQuery: "Генерируемый запрос к БД",
|
| 291 |
titleStorage: "Под капотом",
|
| 292 |
activeStatus: "Активна",
|
| 293 |
closedStatus: "Закрыта",
|
| 294 |
sourceCol: "Источник",
|
| 295 |
targetCol: "Цель",
|
| 296 |
statusCol: "Статус",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
legend: {
|
| 298 |
title: "Легенда графа",
|
| 299 |
nodes: "Типы узлов",
|
|
|
|
| 315 |
};
|
| 316 |
|
| 317 |
let currentLang = 'sv';
|
| 318 |
+
let currentOntology = 'BFO';
|
| 319 |
+
let currentMode = 'LPG';
|
| 320 |
+
let currentEngine = 'vis';
|
| 321 |
let currentTime = 0;
|
| 322 |
const ROOT_ID = 'System_A';
|
| 323 |
|
|
|
|
| 391 |
document.getElementById('add-btn').innerText = t.addBtn;
|
| 392 |
document.getElementById('remove-btn').innerText = t.removeBtn;
|
| 393 |
document.getElementById('lbl-history').innerText = t.history;
|
| 394 |
+
document.getElementById('lbl-export').innerText = t.exportBtn;
|
| 395 |
+
document.getElementById('lbl-import').innerText = t.importBtn;
|
| 396 |
document.getElementById('title-bom').innerText = t.titleBom;
|
| 397 |
+
document.getElementById('title-query').innerText = t.titleQuery;
|
| 398 |
document.getElementById('title-storage').innerText = t.titleStorage;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 399 |
|
| 400 |
render();
|
| 401 |
}
|
|
|
|
| 478 |
render();
|
| 479 |
}
|
| 480 |
|
| 481 |
+
function exportStateToFile() {
|
| 482 |
+
const statePayload = {
|
| 483 |
+
version: "1.0",
|
| 484 |
+
exportedAt: new Date().toISOString(),
|
| 485 |
+
currentTime,
|
| 486 |
+
currentOntology,
|
| 487 |
+
currentMode,
|
| 488 |
+
edgeSeq,
|
| 489 |
+
baseNodes,
|
| 490 |
+
edgesStore
|
| 491 |
+
};
|
| 492 |
+
|
| 493 |
+
const jsonBlob = new Blob([JSON.stringify(statePayload, null, 2)], { type: "application/json" });
|
| 494 |
+
const downloadUrl = URL.createObjectURL(jsonBlob);
|
| 495 |
+
const downloadLink = document.createElement("a");
|
| 496 |
+
downloadLink.href = downloadUrl;
|
| 497 |
+
downloadLink.download = `workbench_state_T${currentTime}_${currentOntology}_${currentMode}.json`;
|
| 498 |
+
downloadLink.click();
|
| 499 |
+
URL.revokeObjectURL(downloadUrl);
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
function importStateFromFile(event) {
|
| 503 |
+
const selectedFile = event.target.files[0];
|
| 504 |
+
if (!selectedFile) return;
|
| 505 |
+
|
| 506 |
+
const fileReader = new FileReader();
|
| 507 |
+
fileReader.onload = function(e) {
|
| 508 |
+
try {
|
| 509 |
+
const parsed = JSON.parse(e.target.result);
|
| 510 |
+
if (!parsed.baseNodes || !parsed.edgesStore) {
|
| 511 |
+
throw new Error("Invalid schema format: missing baseNodes or edgesStore.");
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
currentTime = parsed.currentTime || 0;
|
| 515 |
+
currentOntology = parsed.currentOntology || 'BFO';
|
| 516 |
+
currentMode = parsed.currentMode || 'LPG';
|
| 517 |
+
edgeSeq = parsed.edgeSeq || (parsed.edgesStore.length + 1);
|
| 518 |
+
|
| 519 |
+
baseNodes.length = 0;
|
| 520 |
+
parsed.baseNodes.forEach(node => baseNodes.push(node));
|
| 521 |
+
|
| 522 |
+
edgesStore.length = 0;
|
| 523 |
+
parsed.edgesStore.forEach(edge => edgesStore.push(edge));
|
| 524 |
+
|
| 525 |
+
document.getElementById('time-display').innerText = `T = ${currentTime}`;
|
| 526 |
+
setOntology(currentOntology);
|
| 527 |
+
setGraphMode(currentMode);
|
| 528 |
+
render();
|
| 529 |
+
} catch (err) {
|
| 530 |
+
alert("Error importing workbench configuration: " + err.message);
|
| 531 |
+
}
|
| 532 |
+
};
|
| 533 |
+
|
| 534 |
+
fileReader.readAsText(selectedFile);
|
| 535 |
+
event.target.value = '';
|
| 536 |
+
}
|
| 537 |
+
|
| 538 |
function buildTreeHTML(nodeId, activeEdges) {
|
| 539 |
const children = activeEdges.filter(e => e.from === nodeId).map(e => e.to);
|
| 540 |
if (children.length === 0) return '';
|
|
|
|
| 606 |
});
|
| 607 |
}
|
| 608 |
} else {
|
|
|
|
| 609 |
baseNodes.forEach(n => {
|
| 610 |
visNodes.add({
|
| 611 |
id: `4d_${n.id}`,
|
|
|
|
| 646 |
color: e.isActive ? { color: '#10b981' } : { color: '#cbd5e1' },
|
| 647 |
width: e.isActive ? 2 : 1
|
| 648 |
});
|
| 649 |
+
|
| 650 |
if (!parentStates[e.from]) parentStates[e.from] = [];
|
| 651 |
parentStates[e.from].push({ id: parentStateId, edge: e });
|
| 652 |
} else {
|
|
|
|
| 726 |
});
|
| 727 |
}
|
| 728 |
} else {
|
|
|
|
| 729 |
baseNodes.forEach(n => {
|
| 730 |
const wId = `whole_${safeId(n.id)}`;
|
| 731 |
def += ` ${wId}["<b>${n.label}_4D</b><br/>iso:ActualIndividual"]:::iso4d\n`;
|
|
|
|
| 828 |
`;
|
| 829 |
}
|
| 830 |
} else {
|
|
|
|
| 831 |
const extraLpgEdge = (currentMode === 'LPG')
|
| 832 |
? `<div class="legend-item"><span class="swatch-line-transition"></span>${leg.isoTransitionRel}</div>`
|
| 833 |
: '';
|
|
|
|
| 849 |
}
|
| 850 |
}
|
| 851 |
|
| 852 |
+
function generateDatabaseQuery() {
|
| 853 |
+
const queryTag = document.getElementById('query-lang-tag');
|
| 854 |
+
const queryContainer = document.getElementById('query-content');
|
| 855 |
+
|
| 856 |
+
if (currentOntology === 'BFO') {
|
| 857 |
+
if (currentMode === 'LPG') {
|
| 858 |
+
queryTag.innerText = 'Cypher (Neo4j / LPG)';
|
| 859 |
+
const cypher = `// Retrieve entire active BOM hierarchy of ${ROOT_ID} at T = ${currentTime}\n` +
|
| 860 |
+
`MATCH path = (root:System {id: '${ROOT_ID}'})-[:HAS_PART*]->(leaf:Element)\n` +
|
| 861 |
+
`WHERE ALL(r IN relationships(path)\n` +
|
| 862 |
+
` WHERE r.valid_from <= ${currentTime} AND (r.valid_to > ${currentTime} OR r.valid_to IS NULL))\n` +
|
| 863 |
+
`RETURN [n IN nodes(path) | n.id] AS bom_path,\n` +
|
| 864 |
+
` leaf.id AS component_id;\n` +
|
| 865 |
+
`// Complexity: O(k^d) traversal with in-memory relationship filtering`;
|
| 866 |
+
queryContainer.innerHTML = `<pre class="code-block">${cypher}</pre>`;
|
| 867 |
+
} else {
|
| 868 |
+
queryTag.innerText = 'SPARQL 1.1 (W3C RDF)';
|
| 869 |
+
const sparql = `# Retrieve active BOM for :${ROOT_ID} at T = ${currentTime} via reified statements\n` +
|
| 870 |
+
`PREFIX : <http://example.org/engineering#>\n` +
|
| 871 |
+
`PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n\n` +
|
| 872 |
+
`SELECT ?parent ?child\n` +
|
| 873 |
+
`WHERE {\n` +
|
| 874 |
+
` ?rel a :TemporalPartMembership ;\n` +
|
| 875 |
+
` :hasParent ?parent ;\n` +
|
| 876 |
+
` :hasChild ?child ;\n` +
|
| 877 |
+
` :validFrom ?validFrom .\n` +
|
| 878 |
+
` OPTIONAL { ?rel :validTo ?validTo . }\n` +
|
| 879 |
+
` FILTER (?validFrom <= ${currentTime} && (!BOUND(?validTo) || ?validTo > ${currentTime}))\n` +
|
| 880 |
+
`}\n` +
|
| 881 |
+
`# Complexity: Join-intensive index scan over intermediate statement nodes`;
|
| 882 |
+
queryContainer.innerHTML = `<pre class="code-block">${sparql}</pre>`;
|
| 883 |
+
}
|
| 884 |
+
} else {
|
| 885 |
+
if (currentMode === 'LPG') {
|
| 886 |
+
queryTag.innerText = 'Cypher (ISO 15926 in LPG)';
|
| 887 |
+
const cypher = `// Traverse 4D states intersecting T = ${currentTime}\n` +
|
| 888 |
+
`MATCH (root4D:ActualIndividual {id: '4d_${ROOT_ID}'})<-[:temporalPartOf]-(rootState:State)\n` +
|
| 889 |
+
`WHERE rootState.valid_from <= ${currentTime} AND (rootState.valid_to > ${currentTime} OR rootState.valid_to IS NULL)\n` +
|
| 890 |
+
`MATCH path = (rootState)-[:COMPOSED_OF*]->(leafState:State)-[:temporalPartOf]->(leaf4D:ActualIndividual)\n` +
|
| 891 |
+
`RETURN root4D.id AS root, leaf4D.id AS component, leafState.id AS active_slice;\n` +
|
| 892 |
+
`// Benefit: Native fast traversal over timeless composition links`;
|
| 893 |
+
queryContainer.innerHTML = `<pre class="code-block">${cypher}</pre>`;
|
| 894 |
+
} else {
|
| 895 |
+
queryTag.innerText = 'SPARQL 1.1 (ISO 15926 Pure Binary Triples)';
|
| 896 |
+
const sparql = `# Pure binary 4D navigation for :${ROOT_ID} at T = ${currentTime}\n` +
|
| 897 |
+
`PREFIX iso: <http://standards.iso.org/iso/15926/part2#>\n` +
|
| 898 |
+
`PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n\n` +
|
| 899 |
+
`SELECT ?component4D ?activeStateSlice\n` +
|
| 900 |
+
`WHERE {\n` +
|
| 901 |
+
` :${ROOT_ID}_4D ^iso:temporalPartOf ?rootState .\n` +
|
| 902 |
+
` ?rootState iso:validFrom ?from .\n` +
|
| 903 |
+
` OPTIONAL { ?rootState iso:validTo ?to . }\n` +
|
| 904 |
+
` FILTER (?from <= ${currentTime} && (!BOUND(?to) || ?to > ${currentTime}))\n\n` +
|
| 905 |
+
` ?rootState (iso:hasPart)+ ?activeStateSlice .\n` +
|
| 906 |
+
` ?activeStateSlice iso:temporalPartOf ?component4D .\n` +
|
| 907 |
+
`}\n` +
|
| 908 |
+
`# Benefit: No reification; uses standard property path (iso:hasPart)+`;
|
| 909 |
+
queryContainer.innerHTML = `<pre class="code-block">${sparql}</pre>`;
|
| 910 |
+
}
|
| 911 |
+
}
|
| 912 |
+
}
|
| 913 |
+
|
| 914 |
function render() {
|
| 915 |
const t = i18n[currentLang];
|
| 916 |
const showHistory = document.getElementById('history-toggle').checked;
|
|
|
|
| 932 |
|
| 933 |
updateLegend();
|
| 934 |
|
|
|
|
| 935 |
const treeContainer = document.getElementById('tree-container');
|
| 936 |
treeContainer.innerHTML = `<strong>${ROOT_ID}</strong>` + buildTreeHTML(ROOT_ID, activeEdges);
|
| 937 |
|
|
|
|
| 938 |
const parentSelect = document.getElementById('parent-select');
|
| 939 |
const removeSelect = document.getElementById('remove-select');
|
| 940 |
parentSelect.innerHTML = '';
|
|
|
|
| 955 |
removeSelect.appendChild(opt);
|
| 956 |
});
|
| 957 |
|
| 958 |
+
// Explicitly invoke database query generator on every render cycle
|
| 959 |
+
generateDatabaseQuery();
|
| 960 |
+
|
| 961 |
const storageTag = document.getElementById('storage-paradigm-tag');
|
| 962 |
const storageContent = document.getElementById('storage-content');
|
| 963 |
+
storageTag.innerText = `${currentOntology} / ${currentMode}`;
|
| 964 |
|
| 965 |
if (currentOntology === 'BFO') {
|
| 966 |
if (currentMode === 'LPG') {
|
|
|
|
| 976 |
html += '</tbody></table>';
|
| 977 |
storageContent.innerHTML = html;
|
| 978 |
} else {
|
| 979 |
+
let ttl = `# BFO 3D: RDF Turtle with Reification\n`;
|
| 980 |
edgesStore.forEach(e => {
|
| 981 |
const isActive = (e.valid_to === null || edge.valid_to > currentTime) && edge.valid_from <= currentTime;
|
| 982 |
if (!isActive && !showHistory) return;
|
|
|
|
| 988 |
storageContent.innerHTML = `<pre class="code-block">${ttl}</pre>`;
|
| 989 |
}
|
| 990 |
} else {
|
|
|
|
| 991 |
if (currentMode === 'LPG') {
|
| 992 |
let html = `<table><thead><tr><th>Parent Slice</th><th>Child Slice</th><th>LPG Rel Properties</th><th>4D Extent</th></tr></thead><tbody>`;
|
| 993 |
visibleEdges.forEach(e => {
|
|
|
|
| 1001 |
html += '</tbody></table>';
|
| 1002 |
storageContent.innerHTML = html;
|
| 1003 |
} else {
|
| 1004 |
+
let ttl = `# ISO 15926-2: Pure Binary RDF Triples (Tenseless Composition)\n`;
|
| 1005 |
visibleEdges.forEach(e => {
|
| 1006 |
const pState = `:${e.from}_state_${e.id}`;
|
| 1007 |
const cState = `:${e.to}_state_${e.id}`;
|