@nahisaho/katashiro-knowledge 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/graph/index.d.ts +7 -0
  2. package/dist/graph/index.d.ts.map +1 -0
  3. package/dist/graph/index.js +7 -0
  4. package/dist/graph/index.js.map +1 -0
  5. package/dist/graph/knowledge-graph.d.ts +164 -0
  6. package/dist/graph/knowledge-graph.d.ts.map +1 -0
  7. package/dist/graph/knowledge-graph.js +298 -0
  8. package/dist/graph/knowledge-graph.js.map +1 -0
  9. package/dist/index.d.ts +15 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +18 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/interfaces.d.ts +20 -0
  14. package/dist/interfaces.d.ts.map +1 -0
  15. package/dist/interfaces.js +5 -0
  16. package/dist/interfaces.js.map +1 -0
  17. package/dist/persistence/graph-persistence.d.ts +102 -0
  18. package/dist/persistence/graph-persistence.d.ts.map +1 -0
  19. package/dist/persistence/graph-persistence.js +222 -0
  20. package/dist/persistence/graph-persistence.js.map +1 -0
  21. package/dist/persistence/index.d.ts +7 -0
  22. package/dist/persistence/index.d.ts.map +1 -0
  23. package/dist/persistence/index.js +7 -0
  24. package/dist/persistence/index.js.map +1 -0
  25. package/dist/query/graph-query.d.ts +103 -0
  26. package/dist/query/graph-query.d.ts.map +1 -0
  27. package/dist/query/graph-query.js +237 -0
  28. package/dist/query/graph-query.js.map +1 -0
  29. package/dist/query/index.d.ts +7 -0
  30. package/dist/query/index.d.ts.map +1 -0
  31. package/dist/query/index.js +7 -0
  32. package/dist/query/index.js.map +1 -0
  33. package/dist/sync/graph-sync.d.ts +132 -0
  34. package/dist/sync/graph-sync.d.ts.map +1 -0
  35. package/dist/sync/graph-sync.js +338 -0
  36. package/dist/sync/graph-sync.js.map +1 -0
  37. package/dist/sync/index.d.ts +7 -0
  38. package/dist/sync/index.d.ts.map +1 -0
  39. package/dist/sync/index.js +7 -0
  40. package/dist/sync/index.js.map +1 -0
  41. package/dist/types.d.ts +43 -0
  42. package/dist/types.d.ts.map +1 -0
  43. package/dist/types.js +5 -0
  44. package/dist/types.js.map +1 -0
  45. package/dist/visualization/graph-visualization.d.ts +139 -0
  46. package/dist/visualization/graph-visualization.d.ts.map +1 -0
  47. package/dist/visualization/graph-visualization.js +259 -0
  48. package/dist/visualization/graph-visualization.js.map +1 -0
  49. package/dist/visualization/index.d.ts +7 -0
  50. package/dist/visualization/index.d.ts.map +1 -0
  51. package/dist/visualization/index.js +7 -0
  52. package/dist/visualization/index.js.map +1 -0
  53. package/package.json +39 -0
@@ -0,0 +1,338 @@
1
+ /**
2
+ * GraphSync - Synchronization between knowledge graphs
3
+ *
4
+ * Handles merging and syncing graph data between local and remote
5
+ *
6
+ * @module @nahisaho/katashiro-knowledge
7
+ * @task TSK-044
8
+ */
9
+ import { ok, err, isOk } from '@nahisaho/katashiro-core';
10
+ /**
11
+ * GraphSync
12
+ *
13
+ * Synchronizes knowledge graphs between local and remote sources
14
+ */
15
+ export class GraphSync {
16
+ localGraph;
17
+ remoteGraph;
18
+ lastSyncTime = null;
19
+ constructor(localGraph, remoteGraph) {
20
+ this.localGraph = localGraph;
21
+ this.remoteGraph = remoteGraph;
22
+ }
23
+ /**
24
+ * Compare local and remote graphs
25
+ *
26
+ * @returns Comparison result
27
+ */
28
+ compare() {
29
+ try {
30
+ const localNodes = this.localGraph.getAllNodes();
31
+ const remoteNodes = this.remoteGraph.getAllNodes();
32
+ const localNodeMap = new Map(localNodes.map((n) => [n.id, n]));
33
+ const remoteNodeMap = new Map(remoteNodes.map((n) => [n.id, n]));
34
+ const localOnly = [];
35
+ const remoteOnly = [];
36
+ const modified = [];
37
+ const identical = [];
38
+ // Check local nodes
39
+ for (const node of localNodes) {
40
+ const remoteNode = remoteNodeMap.get(node.id);
41
+ if (!remoteNode) {
42
+ localOnly.push(node);
43
+ }
44
+ else if (this.isNodeModified(node, remoteNode)) {
45
+ modified.push({ local: node, remote: remoteNode });
46
+ }
47
+ else {
48
+ identical.push(node);
49
+ }
50
+ }
51
+ // Check remote-only nodes
52
+ for (const node of remoteNodes) {
53
+ if (!localNodeMap.has(node.id)) {
54
+ remoteOnly.push(node);
55
+ }
56
+ }
57
+ // Compare edges
58
+ const localEdges = this.localGraph.getAllEdges();
59
+ const remoteEdges = this.remoteGraph.getAllEdges();
60
+ const localEdgeMap = new Map(localEdges.map((e) => [e.id, e]));
61
+ const remoteEdgeMap = new Map(remoteEdges.map((e) => [e.id, e]));
62
+ const localOnlyEdges = [];
63
+ const remoteOnlyEdges = [];
64
+ const modifiedEdges = [];
65
+ const identicalEdges = [];
66
+ for (const edge of localEdges) {
67
+ const remoteEdge = remoteEdgeMap.get(edge.id);
68
+ if (!remoteEdge) {
69
+ localOnlyEdges.push(edge);
70
+ }
71
+ else if (this.isEdgeModified(edge, remoteEdge)) {
72
+ modifiedEdges.push({ local: edge, remote: remoteEdge });
73
+ }
74
+ else {
75
+ identicalEdges.push(edge);
76
+ }
77
+ }
78
+ for (const edge of remoteEdges) {
79
+ if (!localEdgeMap.has(edge.id)) {
80
+ remoteOnlyEdges.push(edge);
81
+ }
82
+ }
83
+ return ok({
84
+ localOnly: { nodes: localOnly, edges: localOnlyEdges },
85
+ remoteOnly: { nodes: remoteOnly, edges: remoteOnlyEdges },
86
+ modified: { nodes: modified, edges: modifiedEdges },
87
+ identical: { nodes: identical, edges: identicalEdges },
88
+ });
89
+ }
90
+ catch (error) {
91
+ return err(error instanceof Error ? error : new Error(String(error)));
92
+ }
93
+ }
94
+ /**
95
+ * Pull changes from remote to local
96
+ *
97
+ * @param options - Sync options
98
+ * @returns Sync result
99
+ */
100
+ pull(options = {}) {
101
+ try {
102
+ const compareResult = this.compare();
103
+ if (!isOk(compareResult)) {
104
+ return err(compareResult.error);
105
+ }
106
+ const comparison = compareResult.value;
107
+ let nodesAdded = 0;
108
+ let nodesUpdated = 0;
109
+ let edgesAdded = 0;
110
+ let edgesUpdated = 0;
111
+ const conflicts = [];
112
+ // Add remote-only nodes to local
113
+ for (const node of comparison.remoteOnly.nodes) {
114
+ if (options.nodeTypes && !options.nodeTypes.includes(node.type)) {
115
+ continue;
116
+ }
117
+ const result = this.localGraph.addNode(node);
118
+ if (isOk(result)) {
119
+ nodesAdded++;
120
+ }
121
+ }
122
+ // Update modified nodes if requested
123
+ if (options.updateExisting) {
124
+ for (const { local, remote } of comparison.modified.nodes) {
125
+ // Remove old and add new
126
+ this.localGraph.removeNode(local.id);
127
+ const result = this.localGraph.addNode(remote);
128
+ if (isOk(result)) {
129
+ nodesUpdated++;
130
+ }
131
+ }
132
+ }
133
+ // Add remote-only edges to local
134
+ for (const edge of comparison.remoteOnly.edges) {
135
+ if (options.predicates && !options.predicates.includes(edge.predicate)) {
136
+ continue;
137
+ }
138
+ // Only add if both nodes exist
139
+ const sourceExists = this.localGraph.getNode(edge.source);
140
+ const targetExists = this.localGraph.getNode(edge.target);
141
+ if (isOk(sourceExists) && sourceExists.value && isOk(targetExists) && targetExists.value) {
142
+ const result = this.localGraph.addEdge(edge);
143
+ if (isOk(result)) {
144
+ edgesAdded++;
145
+ }
146
+ }
147
+ }
148
+ const timestamp = new Date().toISOString();
149
+ this.lastSyncTime = timestamp;
150
+ return ok({
151
+ nodesAdded,
152
+ nodesUpdated,
153
+ nodesRemoved: 0,
154
+ edgesAdded,
155
+ edgesUpdated,
156
+ edgesRemoved: 0,
157
+ conflicts,
158
+ timestamp,
159
+ });
160
+ }
161
+ catch (error) {
162
+ return err(error instanceof Error ? error : new Error(String(error)));
163
+ }
164
+ }
165
+ /**
166
+ * Push changes from local to remote
167
+ *
168
+ * @param options - Sync options
169
+ * @returns Sync result
170
+ */
171
+ push(options = {}) {
172
+ try {
173
+ const compareResult = this.compare();
174
+ if (!isOk(compareResult)) {
175
+ return err(compareResult.error);
176
+ }
177
+ const comparison = compareResult.value;
178
+ let nodesAdded = 0;
179
+ let nodesUpdated = 0;
180
+ let edgesAdded = 0;
181
+ let edgesUpdated = 0;
182
+ const conflicts = [];
183
+ // Add local-only nodes to remote
184
+ for (const node of comparison.localOnly.nodes) {
185
+ if (options.nodeTypes && !options.nodeTypes.includes(node.type)) {
186
+ continue;
187
+ }
188
+ const result = this.remoteGraph.addNode(node);
189
+ if (isOk(result)) {
190
+ nodesAdded++;
191
+ }
192
+ }
193
+ // Update modified nodes if requested
194
+ if (options.updateExisting) {
195
+ for (const { local, remote } of comparison.modified.nodes) {
196
+ this.remoteGraph.removeNode(remote.id);
197
+ const result = this.remoteGraph.addNode(local);
198
+ if (isOk(result)) {
199
+ nodesUpdated++;
200
+ }
201
+ }
202
+ }
203
+ // Add local-only edges to remote
204
+ for (const edge of comparison.localOnly.edges) {
205
+ if (options.predicates && !options.predicates.includes(edge.predicate)) {
206
+ continue;
207
+ }
208
+ const sourceExists = this.remoteGraph.getNode(edge.source);
209
+ const targetExists = this.remoteGraph.getNode(edge.target);
210
+ if (isOk(sourceExists) && sourceExists.value && isOk(targetExists) && targetExists.value) {
211
+ const result = this.remoteGraph.addEdge(edge);
212
+ if (isOk(result)) {
213
+ edgesAdded++;
214
+ }
215
+ }
216
+ }
217
+ const timestamp = new Date().toISOString();
218
+ this.lastSyncTime = timestamp;
219
+ return ok({
220
+ nodesAdded,
221
+ nodesUpdated,
222
+ nodesRemoved: 0,
223
+ edgesAdded,
224
+ edgesUpdated,
225
+ edgesRemoved: 0,
226
+ conflicts,
227
+ timestamp,
228
+ });
229
+ }
230
+ catch (error) {
231
+ return err(error instanceof Error ? error : new Error(String(error)));
232
+ }
233
+ }
234
+ /**
235
+ * Bidirectional sync
236
+ *
237
+ * @param options - Sync options
238
+ * @returns Sync result
239
+ */
240
+ sync(options = {}) {
241
+ try {
242
+ // First pull, then push
243
+ const pullResult = this.pull(options);
244
+ if (!isOk(pullResult)) {
245
+ return pullResult;
246
+ }
247
+ const pushResult = this.push(options);
248
+ if (!isOk(pushResult)) {
249
+ return pushResult;
250
+ }
251
+ const timestamp = new Date().toISOString();
252
+ this.lastSyncTime = timestamp;
253
+ return ok({
254
+ nodesAdded: pullResult.value.nodesAdded + pushResult.value.nodesAdded,
255
+ nodesUpdated: pullResult.value.nodesUpdated + pushResult.value.nodesUpdated,
256
+ nodesRemoved: 0,
257
+ edgesAdded: pullResult.value.edgesAdded + pushResult.value.edgesAdded,
258
+ edgesUpdated: pullResult.value.edgesUpdated + pushResult.value.edgesUpdated,
259
+ edgesRemoved: 0,
260
+ conflicts: [
261
+ ...pullResult.value.conflicts,
262
+ ...pushResult.value.conflicts,
263
+ ],
264
+ timestamp,
265
+ });
266
+ }
267
+ catch (error) {
268
+ return err(error instanceof Error ? error : new Error(String(error)));
269
+ }
270
+ }
271
+ /**
272
+ * Get conflicts between graphs
273
+ *
274
+ * @returns Array of conflicts
275
+ */
276
+ getConflicts() {
277
+ try {
278
+ const compareResult = this.compare();
279
+ if (!isOk(compareResult)) {
280
+ return err(compareResult.error);
281
+ }
282
+ const conflicts = [];
283
+ const comparison = compareResult.value;
284
+ for (const { local, remote } of comparison.modified.nodes) {
285
+ if (local.label !== remote.label) {
286
+ conflicts.push({
287
+ type: 'node',
288
+ id: local.id,
289
+ local,
290
+ remote,
291
+ field: 'label',
292
+ });
293
+ }
294
+ }
295
+ for (const { local, remote } of comparison.modified.edges) {
296
+ if (local.weight !== remote.weight) {
297
+ conflicts.push({
298
+ type: 'edge',
299
+ id: local.id,
300
+ local,
301
+ remote,
302
+ field: 'weight',
303
+ });
304
+ }
305
+ }
306
+ return ok(conflicts);
307
+ }
308
+ catch (error) {
309
+ return err(error instanceof Error ? error : new Error(String(error)));
310
+ }
311
+ }
312
+ /**
313
+ * Get last sync timestamp
314
+ *
315
+ * @returns Last sync timestamp or null
316
+ */
317
+ getLastSyncTime() {
318
+ return this.lastSyncTime;
319
+ }
320
+ /**
321
+ * Check if a node has been modified
322
+ */
323
+ isNodeModified(local, remote) {
324
+ return (local.label !== remote.label ||
325
+ local.type !== remote.type ||
326
+ JSON.stringify(local.properties) !== JSON.stringify(remote.properties));
327
+ }
328
+ /**
329
+ * Check if an edge has been modified
330
+ */
331
+ isEdgeModified(local, remote) {
332
+ return (local.source !== remote.source ||
333
+ local.target !== remote.target ||
334
+ local.predicate !== remote.predicate ||
335
+ local.weight !== remote.weight);
336
+ }
337
+ }
338
+ //# sourceMappingURL=graph-sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-sync.js","sourceRoot":"","sources":["../../src/sync/graph-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAe,MAAM,0BAA0B,CAAC;AAgEtE;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAIV;IACA;IAJF,YAAY,GAAkB,IAAI,CAAC;IAE3C,YACU,UAA0B,EAC1B,WAA2B;QAD3B,eAAU,GAAV,UAAU,CAAgB;QAC1B,gBAAW,GAAX,WAAW,CAAgB;IAClC,CAAC;IAEJ;;;;OAIG;IACH,OAAO;QACL,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;YACjD,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;YAEnD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAEjE,MAAM,SAAS,GAAgB,EAAE,CAAC;YAClC,MAAM,UAAU,GAAgB,EAAE,CAAC;YACnC,MAAM,QAAQ,GAAmD,EAAE,CAAC;YACpE,MAAM,SA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M;wBACN,KAAK,EAAE,QAAQ;qBAChB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;OAEG;IACK,cAAc,CAAC,KAAgB,EAAE,MAAiB;QACxD,OAAO,CACL,KAAK,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK;YAC5B,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI;YAC1B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CACvE,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,cAAc,CAAC,KAAgB,EAAE,MAAiB;QACxD,OAAO,CACL,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;YAC9B,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;YAC9B,KAAK,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS;YACpC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAC/B,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Sync module exports
3
+ *
4
+ * @module @nahisaho/katashiro-knowledge
5
+ */
6
+ export { GraphSync, type SyncOptions, type SyncResult, type ComparisonResult, type Conflict, } from './graph-sync.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,QAAQ,GACd,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Sync module exports
3
+ *
4
+ * @module @nahisaho/katashiro-knowledge
5
+ */
6
+ export { GraphSync, } from './graph-sync.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,SAAS,GAKV,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Knowledge型定義
3
+ */
4
+ import type { ID, Timestamp, URL, Source } from '@nahisaho/katashiro-core';
5
+ export type LLMProvider = 'claude' | 'openai' | 'gemini' | 'ollama';
6
+ export interface LLMConfig {
7
+ readonly provider?: LLMProvider;
8
+ readonly model?: string;
9
+ readonly maxTokens?: number;
10
+ readonly temperature?: number;
11
+ readonly systemPrompt?: string;
12
+ }
13
+ export interface LLMResponse {
14
+ readonly text: string;
15
+ readonly provider: LLMProvider;
16
+ readonly model: string;
17
+ readonly usage: {
18
+ readonly promptTokens: number;
19
+ readonly completionTokens: number;
20
+ readonly totalTokens: number;
21
+ };
22
+ readonly latency: number;
23
+ }
24
+ export interface TrackedSource extends Source {
25
+ readonly contentHash: string;
26
+ readonly usageCount: number;
27
+ readonly lastUsedAt: Timestamp;
28
+ }
29
+ export interface KnowledgeEntity {
30
+ readonly id: ID;
31
+ readonly type: string;
32
+ readonly label: string;
33
+ readonly properties: Record<string, unknown>;
34
+ readonly relations: KnowledgeRelation[];
35
+ readonly sources: URL[];
36
+ readonly createdAt: Timestamp;
37
+ }
38
+ export interface KnowledgeRelation {
39
+ readonly predicate: string;
40
+ readonly object: ID | string;
41
+ readonly confidence: number;
42
+ }
43
+ //# sourceMappingURL=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;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,iBAAiB,EAAE,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B"}
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Knowledge型定義
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * GraphVisualization - Graph export to various formats
3
+ *
4
+ * Generates visual representations of knowledge graphs
5
+ *
6
+ * @module @nahisaho/katashiro-knowledge
7
+ * @task TSK-043
8
+ */
9
+ import { type Result } from '@nahisaho/katashiro-core';
10
+ import { KnowledgeGraph } from '../graph/knowledge-graph.js';
11
+ /**
12
+ * Visualization configuration
13
+ */
14
+ export interface VisualizationConfig {
15
+ /** Graph direction (Mermaid) */
16
+ direction?: 'TB' | 'BT' | 'LR' | 'RL';
17
+ /** Show edge labels */
18
+ showEdgeLabels?: boolean;
19
+ /** Node shapes by type */
20
+ nodeShapes?: Record<string, string>;
21
+ /** Node colors by type */
22
+ nodeColors?: Record<string, string>;
23
+ /** Edge colors by predicate */
24
+ edgeColors?: Record<string, string>;
25
+ }
26
+ /**
27
+ * D3.js compatible data format
28
+ */
29
+ export interface D3GraphData {
30
+ nodes: Array<{
31
+ id: string;
32
+ label: string;
33
+ type: string;
34
+ properties: Record<string, unknown>;
35
+ }>;
36
+ links: Array<{
37
+ source: string;
38
+ target: string;
39
+ predicate: string;
40
+ weight: number;
41
+ }>;
42
+ }
43
+ /**
44
+ * Cytoscape.js compatible data format
45
+ */
46
+ export interface CytoscapeData {
47
+ elements: {
48
+ nodes: Array<{
49
+ data: {
50
+ id: string;
51
+ label: string;
52
+ type: string;
53
+ [key: string]: unknown;
54
+ };
55
+ }>;
56
+ edges: Array<{
57
+ data: {
58
+ id: string;
59
+ source: string;
60
+ target: string;
61
+ label: string;
62
+ weight: number;
63
+ };
64
+ }>;
65
+ };
66
+ }
67
+ /**
68
+ * Graph statistics
69
+ */
70
+ export interface GraphStats {
71
+ nodeCount: number;
72
+ edgeCount: number;
73
+ nodeTypes: string[];
74
+ predicates: string[];
75
+ density: number;
76
+ avgDegree: number;
77
+ }
78
+ /**
79
+ * GraphVisualization
80
+ *
81
+ * Exports knowledge graphs to various visualization formats
82
+ */
83
+ export declare class GraphVisualization {
84
+ private graph;
85
+ constructor(graph: KnowledgeGraph);
86
+ /**
87
+ * Generate Mermaid diagram syntax
88
+ *
89
+ * @param config - Visualization configuration
90
+ * @returns Mermaid syntax string
91
+ */
92
+ toMermaid(config?: VisualizationConfig): Result<string, Error>;
93
+ /**
94
+ * Generate DOT format (Graphviz)
95
+ *
96
+ * @param config - Visualization configuration
97
+ * @returns DOT syntax string
98
+ */
99
+ toDOT(config?: VisualizationConfig): Result<string, Error>;
100
+ /**
101
+ * Generate D3.js compatible JSON
102
+ *
103
+ * @returns D3 graph data
104
+ */
105
+ toD3Json(): Result<D3GraphData, Error>;
106
+ /**
107
+ * Generate Cytoscape.js compatible JSON
108
+ *
109
+ * @returns Cytoscape data
110
+ */
111
+ toCytoscape(): Result<CytoscapeData, Error>;
112
+ /**
113
+ * Get graph statistics
114
+ *
115
+ * @returns Graph statistics
116
+ */
117
+ getStats(): Result<GraphStats, Error>;
118
+ /**
119
+ * Generate subgraph around a node
120
+ *
121
+ * @param nodeId - Center node ID
122
+ * @param depth - Depth of neighbors to include
123
+ * @returns Subgraph data
124
+ */
125
+ getSubgraph(nodeId: string, depth?: number): Result<D3GraphData, Error>;
126
+ /**
127
+ * Get Mermaid shape markers for node type
128
+ */
129
+ private getMermaidShape;
130
+ /**
131
+ * Sanitize ID for Mermaid
132
+ */
133
+ private sanitizeId;
134
+ /**
135
+ * Escape label for diagram syntax
136
+ */
137
+ private escapeLabel;
138
+ }
139
+ //# sourceMappingURL=graph-visualization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-visualization.d.ts","sourceRoot":"","sources":["../../src/visualization/graph-visualization.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,gCAAgC;IAChC,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACtC,uBAAuB;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,0BAA0B;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,KAAK,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACrC,CAAC,CAAC;IACH,KAAK,EAAE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