Alef1986 commited on
Commit
baf2760
·
1 Parent(s): da10777

Revert index.html to 3970c80

Browse files
Files changed (1) hide show
  1. index.html +150 -207
index.html CHANGED
@@ -2,20 +2,70 @@
2
  <html lang="sv">
3
  <head>
4
  <meta charset="UTF-8">
5
- <title>Knowledge Architecture Workbench (IEC 63339 | BFO vs ISO 15926)</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; overflow: hidden; }
11
 
12
- .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; }
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
  button { background: #0f172a; color: #ffffff; border: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 500; }
20
  button:hover { background: #334155; }
21
  button.secondary { background: #e2e8f0; color: #0f172a; }
@@ -68,38 +118,34 @@
68
  .swatch-line-past { width: 16px; height: 0; border-top: 2px dashed #94a3b8; margin-right: 8px; flex-shrink: 0; }
69
  .swatch-line-transition { width: 16px; height: 2px; background: #f59e0b; margin-right: 8px; flex-shrink: 0; }
70
 
71
- /* Right sidebar container with safe flex geometry to prevent horizontal scrolling */
72
- .sidebar { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 340px; max-width: 440px; height: 100%; min-height: 0; }
73
- .card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; min-height: 0; }
74
-
75
- /* Safely structured card header to handle long IEC 63339 text labels */
76
- .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: flex-start; flex-shrink: 0; gap: 10px; }
77
- .card h4 .card-title { flex-shrink: 0; }
78
- .card h4 .iec-badge { text-align: right; color: #0284c7; font-weight: 600; font-size: 10px; line-height: 1.2; flex-shrink: 1; min-width: 0; word-wrap: break-word; }
79
- .card h4 .iec-badge .sub-tag { color: #64748b; font-size: 9px; font-weight: 400; display: block; margin-top: 2px; text-transform: none; letter-spacing: normal; }
80
-
81
- .card-body { overflow-y: auto; flex: 1; min-height: 0; }
82
-
83
- ul.tree, ul.tree ul { list-style-type: none; padding-left: 14px; margin: 2px 0; }
84
- ul.tree li { position: relative; padding: 2px 0; font-size: 12px; }
85
  ul.tree li::before { content: "├─ "; color: #94a3b8; }
86
  ul.tree li:last-child::before { content: "└─ "; color: #94a3b8; }
87
-
88
  table { width: 100%; border-collapse: collapse; font-size: 11px; }
89
- th, td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #f1f5f9; }
90
  th { color: #64748b; font-weight: 600; }
91
  .active-row { background: #f0fdf4; }
92
  .closed-row { color: #94a3b8; text-decoration: line-through; }
93
-
94
- 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; }
95
  </style>
96
  </head>
97
  <body>
98
 
99
  <div class="control-deck">
100
- <!-- Tier 1: Architectural paradigms -->
101
  <div class="deck-row deck-row-top">
102
- <div class="section-label">🏛️ <span id="lbl-onto-title">Ontologi:</span></div>
 
 
 
 
 
 
 
103
  <div class="btn-group">
104
  <button id="onto-bfo" class="active" onclick="setOntology('BFO')">BFO (3D Continuant)</button>
105
  <button id="onto-iso" onclick="setOntology('ISO15926')">ISO 15926 (4D Perdurant)</button>
@@ -107,7 +153,13 @@
107
 
108
  <div class="divider"></div>
109
 
110
- <div class="section-label">💾 <span id="lbl-graph-title">Datamodell:</span></div>
 
 
 
 
 
 
111
  <div class="btn-group">
112
  <button id="mode-lpg" class="active" onclick="setGraphMode('LPG')">LPG</button>
113
  <button id="mode-rdf" onclick="setGraphMode('RDF')">RDF (W3C)</button>
@@ -115,6 +167,7 @@
115
 
116
  <div class="divider"></div>
117
 
 
118
  <div class="section-label">🎨 <span id="lbl-engine-title">Motor:</span></div>
119
  <div class="btn-group">
120
  <button id="eng-vis" class="active" onclick="setEngine('vis')">🌐 Vis.js</button>
@@ -128,13 +181,21 @@
128
  </div>
129
  </div>
130
 
131
- <!-- Tier 2: Engineering actions & persistence -->
132
  <div class="deck-row">
133
  <span class="badge" id="time-display">T = 0</span>
134
  <button id="step-btn" onclick="advanceTime()"></button>
135
 
136
  <div class="divider"></div>
137
 
 
 
 
 
 
 
 
 
138
  <label id="lbl-parent" style="font-size: 11px; color: #64748b; font-weight: 600;"></label>
139
  <select id="parent-select"></select>
140
 
@@ -150,51 +211,38 @@
150
  <label style="font-size: 11px; color: #475569; display: flex; align-items: center; gap: 4px;">
151
  <input type="checkbox" id="history-toggle" checked onchange="render()"> <span id="lbl-history"></span>
152
  </label>
153
-
154
- <div style="margin-left: auto; display: flex; gap: 6px;">
155
- <button id="btn-export" class="secondary" onclick="exportStateToFile()">💾 <span id="lbl-export">Export</span></button>
156
- <button id="btn-import" class="secondary" onclick="document.getElementById('file-importer').click()">📂 <span id="lbl-import">Import</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
- <main class="main-container">
163
  <div id="canvas-container">
164
  <div id="vis-container"></div>
165
  <div id="mermaid-container" style="display: none;"></div>
166
  <div id="graph-legend" class="graph-legend"></div>
167
  </div>
168
 
169
- <aside class="sidebar">
170
- <!-- 1. URMSM Viewpoint (End-user layer) -->
171
- <section class="card" style="flex: 0 0 23%;">
172
- <h4>
173
- <span id="title-bom" class="card-title"></span>
174
- <div class="iec-badge">IEC 63339: URMSM<span class="sub-tag">Viewpoint Layer</span></div>
175
- </h4>
176
- <div class="card-body" id="tree-container"></div>
177
- </section>
178
-
179
- <!-- 2. SMIM Implementation Model (Rules & Query Generation) -->
180
- <section class="card" style="flex: 0 0 37%;">
181
  <h4>
182
- <span id="title-query" class="card-title"></span>
183
- <div id="query-lang-tag" class="iec-badge"></div>
 
 
184
  </h4>
185
- <div class="card-body" id="query-content"></div>
186
- </section>
187
 
188
- <!-- 3. SMS Storage Instance (Physical Data Layer) -->
189
- <section class="card" style="flex: 0 0 40%;">
190
  <h4>
191
- <span id="title-storage" class="card-title"></span>
192
- <div id="storage-paradigm-tag" class="iec-badge"></div>
193
  </h4>
194
- <div class="card-body" id="storage-content"></div>
195
- </section>
196
- </aside>
197
- </main>
198
 
199
  <script>
200
  mermaid.initialize({
@@ -215,16 +263,20 @@
215
  addBtn: "+ Lägg till",
216
  removeBtn: "Uteslut relation",
217
  history: "Historik",
218
- exportBtn: "Exportera JSON",
219
- importBtn: "Importera JSON",
220
- titleBom: "Struktur (BOM)",
221
- titleQuery: "Genererad databasfråga",
222
- titleStorage: "Grafdatabas",
223
  activeStatus: "Aktiv",
224
  closedStatus: "Avslutad",
225
  sourceCol: "Källa",
226
  targetCol: "Mål",
227
  statusCol: "Status",
 
 
 
 
 
 
 
228
  legend: {
229
  title: "Teckenförklaring",
230
  nodes: "Noder",
@@ -253,16 +305,20 @@
253
  addBtn: "+ Add",
254
  removeBtn: "Sever relation",
255
  history: "History",
256
- exportBtn: "Export JSON",
257
- importBtn: "Import JSON",
258
- titleBom: "Assembly Structure",
259
- titleQuery: "Database Query Engine",
260
- titleStorage: "Graph Data Store",
261
  activeStatus: "Active",
262
  closedStatus: "Closed",
263
  sourceCol: "Source",
264
  targetCol: "Target",
265
  statusCol: "Status",
 
 
 
 
 
 
 
266
  legend: {
267
  title: "Graph Legend",
268
  nodes: "Node Types",
@@ -291,16 +347,20 @@
291
  addBtn: "+ Добавить",
292
  removeBtn: "Исключить связь",
293
  history: "История",
294
- exportBtn: "Экспорт JSON",
295
- importBtn: "Импорт JSON",
296
  titleBom: "Состав изделия (BOM)",
297
- titleQuery: "Генератор запросов БД",
298
- titleStorage: "Хранилище графа",
299
  activeStatus: "Активна",
300
  closedStatus: "Закрыта",
301
  sourceCol: "Источник",
302
  targetCol: "Цель",
303
  statusCol: "Статус",
 
 
 
 
 
 
 
304
  legend: {
305
  title: "Легенда графа",
306
  nodes: "Типы узлов",
@@ -322,9 +382,9 @@
322
  };
323
 
324
  let currentLang = 'sv';
325
- let currentOntology = 'BFO';
326
- let currentMode = 'LPG';
327
- let currentEngine = 'vis';
328
  let currentTime = 0;
329
  const ROOT_ID = 'System_A';
330
 
@@ -398,11 +458,15 @@
398
  document.getElementById('add-btn').innerText = t.addBtn;
399
  document.getElementById('remove-btn').innerText = t.removeBtn;
400
  document.getElementById('lbl-history').innerText = t.history;
401
- document.getElementById('lbl-export').innerText = t.exportBtn;
402
- document.getElementById('lbl-import').innerText = t.importBtn;
403
  document.getElementById('title-bom').innerText = t.titleBom;
404
- document.getElementById('title-query').innerText = t.titleQuery;
405
  document.getElementById('title-storage').innerText = t.titleStorage;
 
 
 
 
 
 
 
406
 
407
  render();
408
  }
@@ -485,64 +549,6 @@
485
  render();
486
  }
487
 
488
- function exportStateToFile() {
489
- const statePayload = {
490
- version: "1.1",
491
- framework: "IEC 63339 URMSM Sandbox",
492
- exportedAt: new Date().toISOString(),
493
- currentTime,
494
- currentOntology,
495
- currentMode,
496
- edgeSeq,
497
- baseNodes,
498
- edgesStore
499
- };
500
-
501
- const jsonBlob = new Blob([JSON.stringify(statePayload, null, 2)], { type: "application/json" });
502
- const downloadUrl = URL.createObjectURL(jsonBlob);
503
- const downloadLink = document.createElement("a");
504
- downloadLink.href = downloadUrl;
505
- downloadLink.download = `workbench_state_T${currentTime}_${currentOntology}_${currentMode}.json`;
506
- downloadLink.click();
507
- URL.revokeObjectURL(downloadUrl);
508
- }
509
-
510
- function importStateFromFile(event) {
511
- const selectedFile = event.target.files[0];
512
- if (!selectedFile) return;
513
-
514
- const fileReader = new FileReader();
515
- fileReader.onload = function(e) {
516
- try {
517
- const parsed = JSON.parse(e.target.result);
518
- if (!parsed.baseNodes || !parsed.edgesStore) {
519
- throw new Error("Invalid schema format: missing baseNodes or edgesStore.");
520
- }
521
-
522
- currentTime = parsed.currentTime || 0;
523
- currentOntology = parsed.currentOntology || 'BFO';
524
- currentMode = parsed.currentMode || 'LPG';
525
- edgeSeq = parsed.edgeSeq || (parsed.edgesStore.length + 1);
526
-
527
- baseNodes.length = 0;
528
- parsed.baseNodes.forEach(node => baseNodes.push(node));
529
-
530
- edgesStore.length = 0;
531
- parsed.edgesStore.forEach(edge => edgesStore.push(edge));
532
-
533
- document.getElementById('time-display').innerText = `T = ${currentTime}`;
534
- setOntology(currentOntology);
535
- setGraphMode(currentMode);
536
- render();
537
- } catch (err) {
538
- alert("Error importing workbench configuration: " + err.message);
539
- }
540
- };
541
-
542
- fileReader.readAsText(selectedFile);
543
- event.target.value = '';
544
- }
545
-
546
  function buildTreeHTML(nodeId, activeEdges) {
547
  const children = activeEdges.filter(e => e.from === nodeId).map(e => e.to);
548
  if (children.length === 0) return '';
@@ -614,6 +620,7 @@
614
  });
615
  }
616
  } else {
 
617
  baseNodes.forEach(n => {
618
  visNodes.add({
619
  id: `4d_${n.id}`,
@@ -654,7 +661,6 @@
654
  color: e.isActive ? { color: '#10b981' } : { color: '#cbd5e1' },
655
  width: e.isActive ? 2 : 1
656
  });
657
-
658
  if (!parentStates[e.from]) parentStates[e.from] = [];
659
  parentStates[e.from].push({ id: parentStateId, edge: e });
660
  } else {
@@ -734,6 +740,7 @@
734
  });
735
  }
736
  } else {
 
737
  baseNodes.forEach(n => {
738
  const wId = `whole_${safeId(n.id)}`;
739
  def += ` ${wId}["<b>${n.label}_4D</b><br/>iso:ActualIndividual"]:::iso4d\n`;
@@ -836,6 +843,7 @@
836
  `;
837
  }
838
  } else {
 
839
  const extraLpgEdge = (currentMode === 'LPG')
840
  ? `<div class="legend-item"><span class="swatch-line-transition"></span>${leg.isoTransitionRel}</div>`
841
  : '';
@@ -857,73 +865,6 @@
857
  }
858
  }
859
 
860
- // IEC 63339 SMIM implementation query logic mapping
861
- function generateDatabaseQuery() {
862
- const queryTag = document.getElementById('query-lang-tag');
863
- const queryContainer = document.getElementById('query-content');
864
-
865
- let queryLang = '';
866
-
867
- if (currentOntology === 'BFO') {
868
- if (currentMode === 'LPG') {
869
- queryLang = 'Cypher (LPG)';
870
- const cypher = `// Retrieve entire active BOM hierarchy of ${ROOT_ID} at T = ${currentTime}\n` +
871
- `MATCH path = (root:System {id: '${ROOT_ID}'})-[:HAS_PART*]->(leaf:Element)\n` +
872
- `WHERE ALL(r IN relationships(path)\n` +
873
- ` WHERE r.valid_from <= ${currentTime} AND (r.valid_to > ${currentTime} OR r.valid_to IS NULL))\n` +
874
- `RETURN [n IN nodes(path) | n.id] AS bom_path,\n` +
875
- ` leaf.id AS component_id;\n` +
876
- `// IEC 63339 SMIM: Direct path traversal using edge property filters`;
877
- queryContainer.innerHTML = `<pre class="code-block">${cypher}</pre>`;
878
- } else {
879
- queryLang = 'SPARQL 1.1 (RDF)';
880
- const sparql = `# Retrieve active BOM for :${ROOT_ID} at T = ${currentTime} via reified statements\n` +
881
- `PREFIX : <http://example.org/engineering#>\n` +
882
- `PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n\n` +
883
- `SELECT ?parent ?child\n` +
884
- `WHERE {\n` +
885
- ` ?rel a :TemporalPartMembership ;\n` +
886
- ` :hasParent ?parent ;\n` +
887
- ` :hasChild ?child ;\n` +
888
- ` :validFrom ?validFrom .\n` +
889
- ` OPTIONAL { ?rel :validTo ?validTo . }\n` +
890
- ` FILTER (?validFrom <= ${currentTime} && (!BOUND(?validTo) || ?validTo > ${currentTime}))\n` +
891
- `}\n` +
892
- `# IEC 63339 SMIM: Join-intensive pattern matching over reification statements`;
893
- queryContainer.innerHTML = `<pre class="code-block">${sparql}</pre>`;
894
- }
895
- } else {
896
- if (currentMode === 'LPG') {
897
- queryLang = 'Cypher (ISO 15926)';
898
- const cypher = `// Traverse 4D states intersecting T = ${currentTime}\n` +
899
- `MATCH (root4D:ActualIndividual {id: '4d_${ROOT_ID}'})<-[:temporalPartOf]-(rootState:State)\n` +
900
- `WHERE rootState.valid_from <= ${currentTime} AND (rootState.valid_to > ${currentTime} OR rootState.valid_to IS NULL)\n` +
901
- `MATCH path = (rootState)-[:COMPOSED_OF*]->(leafState:State)-[:temporalPartOf]->(leaf4D:ActualIndividual)\n` +
902
- `RETURN root4D.id AS root, leaf4D.id AS component, leafState.id AS active_slice;\n` +
903
- `// IEC 63339 SMIM: Fast trajectory over timeless state compositions`;
904
- queryContainer.innerHTML = `<pre class="code-block">${cypher}</pre>`;
905
- } else {
906
- queryLang = 'SPARQL 1.1 (ISO 15926)';
907
- const sparql = `# Pure binary 4D navigation for :${ROOT_ID} at T = ${currentTime}\n` +
908
- `PREFIX iso: <http://standards.iso.org/iso/15926/part2#>\n` +
909
- `PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n\n` +
910
- `SELECT ?component4D ?activeStateSlice\n` +
911
- `WHERE {\n` +
912
- ` :${ROOT_ID}_4D ^iso:temporalPartOf ?rootState .\n` +
913
- ` ?rootState iso:validFrom ?from .\n` +
914
- ` OPTIONAL { ?rootState iso:validTo ?to . }\n` +
915
- ` FILTER (?from <= ${currentTime} && (!BOUND(?to) || ?to > ${currentTime}))\n\n` +
916
- ` ?rootState (iso:hasPart)+ ?activeStateSlice .\n` +
917
- ` ?activeStateSlice iso:temporalPartOf ?component4D .\n` +
918
- `}\n` +
919
- `# IEC 63339 SMIM: No reification needed; uses property paths (iso:hasPart)+`;
920
- queryContainer.innerHTML = `<pre class="code-block">${sparql}</pre>`;
921
- }
922
- }
923
-
924
- queryTag.innerHTML = `IEC 63339: SMIM<span class="sub-tag">${queryLang}</span>`;
925
- }
926
-
927
  function render() {
928
  const t = i18n[currentLang];
929
  const showHistory = document.getElementById('history-toggle').checked;
@@ -945,9 +886,11 @@
945
 
946
  updateLegend();
947
 
 
948
  const treeContainer = document.getElementById('tree-container');
949
  treeContainer.innerHTML = `<strong>${ROOT_ID}</strong>` + buildTreeHTML(ROOT_ID, activeEdges);
950
 
 
951
  const parentSelect = document.getElementById('parent-select');
952
  const removeSelect = document.getElementById('remove-select');
953
  parentSelect.innerHTML = '';
@@ -968,11 +911,10 @@
968
  removeSelect.appendChild(opt);
969
  });
970
 
971
- generateDatabaseQuery();
972
-
973
  const storageTag = document.getElementById('storage-paradigm-tag');
974
  const storageContent = document.getElementById('storage-content');
975
- storageTag.innerHTML = `IEC 63339: SMS<span class="sub-tag">${currentOntology} / ${currentMode}</span>`;
976
 
977
  if (currentOntology === 'BFO') {
978
  if (currentMode === 'LPG') {
@@ -988,7 +930,7 @@
988
  html += '</tbody></table>';
989
  storageContent.innerHTML = html;
990
  } else {
991
- let ttl = `# BFO 3D: RDF Turtle with Reification\n`;
992
  edgesStore.forEach(e => {
993
  const isActive = (e.valid_to === null || edge.valid_to > currentTime) && edge.valid_from <= currentTime;
994
  if (!isActive && !showHistory) return;
@@ -1000,6 +942,7 @@
1000
  storageContent.innerHTML = `<pre class="code-block">${ttl}</pre>`;
1001
  }
1002
  } else {
 
1003
  if (currentMode === 'LPG') {
1004
  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>`;
1005
  visibleEdges.forEach(e => {
@@ -1013,7 +956,7 @@
1013
  html += '</tbody></table>';
1014
  storageContent.innerHTML = html;
1015
  } else {
1016
- let ttl = `# ISO 15926-2: Pure Binary RDF Triples (Tenseless Composition)\n`;
1017
  visibleEdges.forEach(e => {
1018
  const pState = `:${e.from}_state_${e.id}`;
1019
  const cState = `:${e.to}_state_${e.id}`;
 
2
  <html lang="sv">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <title>IEC 63339 Knowledge Architecture Workbench</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
+ .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); }
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; }
 
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
+ .sidebar { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 350px; }
122
+ .card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; overflow-y: auto; flex: 1; }
123
+ .card h4 { margin: 0 0 8px 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; display: flex; justify-content: space-between; align-items: center; }
124
+ ul.tree, ul.tree ul { list-style-type: none; padding-left: 16px; margin: 4px 0; }
125
+ ul.tree li { position: relative; padding: 2px 0; font-size: 13px; }
 
 
 
 
 
 
 
 
 
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: 5px 6px; border-bottom: 1px solid #f1f5f9; }
130
  th { color: #64748b; font-weight: 600; }
131
  .active-row { background: #f0fdf4; }
132
  .closed-row { color: #94a3b8; text-decoration: line-through; }
133
+ pre.code-block { margin: 0; font-family: monospace; font-size: 11px; color: #334155; line-height: 1.4; background: #f8fafc; padding: 8px; border-radius: 4px; border: 1px solid #e2e8f0; max-height: 180px; overflow-y: auto; }
 
134
  </style>
135
  </head>
136
  <body>
137
 
138
  <div class="control-deck">
139
+ <!-- ЯРУС 1: Архитектурные уровни IEC 63339 (SMIM & SMS) -->
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
 
154
  <div class="divider"></div>
155
 
156
+ <!-- SMS: Graph Database Storage -->
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
 
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
  </div>
182
  </div>
183
 
184
+ <!-- ЯРУС 2: SMRM Concept Repository & Ввод действий -->
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
  <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
+ <!-- URMSM: Viewpoint & Concerns -->
226
+ <div class="card" style="flex: 0 0 35%;">
 
 
 
 
 
 
 
 
 
227
  <h4>
228
+ <span id="title-bom"></span>
229
+ <span class="iec-badge">IEC 63339 / URMSM
230
+ <span class="iec-tooltip" id="tt-urmsm"></span>
231
+ </span>
232
  </h4>
233
+ <div id="tree-container"></div>
234
+ </div>
235
 
236
+ <!-- SMS: Low-Level Storage Details -->
237
+ <div class="card" style="flex: 1;">
238
  <h4>
239
+ <span id="title-storage"></span>
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>
246
 
247
  <script>
248
  mermaid.initialize({
 
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
  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 ISO-aligned 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
  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
  };
383
 
384
  let currentLang = 'sv';
385
+ let currentOntology = 'BFO'; // 'BFO' | 'ISO15926'
386
+ let currentMode = 'LPG'; // 'LPG' | 'RDF'
387
+ let currentEngine = 'vis'; // 'vis' | 'mermaid'
388
  let currentTime = 0;
389
  const ROOT_ID = 'System_A';
390
 
 
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
  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
  });
621
  }
622
  } else {
623
+ // ISO 15926
624
  baseNodes.forEach(n => {
625
  visNodes.add({
626
  id: `4d_${n.id}`,
 
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
  });
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
  `;
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
  }
866
  }
867
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
868
  function render() {
869
  const t = i18n[currentLang];
870
  const showHistory = document.getElementById('history-toggle').checked;
 
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
  removeSelect.appendChild(opt);
912
  });
913
 
914
+ // Storage Panel (SMS)
 
915
  const storageTag = document.getElementById('storage-paradigm-tag');
916
  const storageContent = document.getElementById('storage-content');
917
+ storageTag.innerText = `SMS / ${currentOntology} / ${currentMode}`;
918
 
919
  if (currentOntology === 'BFO') {
920
  if (currentMode === 'LPG') {
 
930
  html += '</tbody></table>';
931
  storageContent.innerHTML = html;
932
  } else {
933
+ let ttl = `# BFO 3D in SMS: RDF Turtle with Reification\n`;
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
  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
  html += '</tbody></table>';
957
  storageContent.innerHTML = html;
958
  } else {
959
+ let ttl = `# ISO 15926-2 in SMS: Pure Binary RDF Triples (Tenseless Composition)\n`;
960
  visibleEdges.forEach(e => {
961
  const pState = `:${e.from}_state_${e.id}`;
962
  const cState = `:${e.to}_state_${e.id}`;