cjm-graph-plugin-sqlite 0.0.2__py3-none-any.whl

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.
@@ -0,0 +1 @@
1
+ __version__ = "0.0.2"
@@ -0,0 +1,67 @@
1
+ # Autogenerated by nbdev
2
+
3
+ d = { 'settings': { 'branch': 'main',
4
+ 'doc_baseurl': '/cjm-graph-plugin-sqlite',
5
+ 'doc_host': 'https://cj-mills.github.io',
6
+ 'git_url': 'https://github.com/cj-mills/cjm-graph-plugin-sqlite',
7
+ 'lib_path': 'cjm_graph_plugin_sqlite'},
8
+ 'syms': { 'cjm_graph_plugin_sqlite.meta': { 'cjm_graph_plugin_sqlite.meta.get_plugin_metadata': ( 'meta.html#get_plugin_metadata',
9
+ 'cjm_graph_plugin_sqlite/meta.py')},
10
+ 'cjm_graph_plugin_sqlite.plugin': { 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin': ( 'plugin.html#sqlitegraphplugin',
11
+ 'cjm_graph_plugin_sqlite/plugin.py'),
12
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.__init__': ( 'plugin.html#sqlitegraphplugin.__init__',
13
+ 'cjm_graph_plugin_sqlite/plugin.py'),
14
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin._dict_to_edge': ( 'plugin.html#sqlitegraphplugin._dict_to_edge',
15
+ 'cjm_graph_plugin_sqlite/plugin.py'),
16
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin._dict_to_node': ( 'plugin.html#sqlitegraphplugin._dict_to_node',
17
+ 'cjm_graph_plugin_sqlite/plugin.py'),
18
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin._init_db': ( 'plugin.html#sqlitegraphplugin._init_db',
19
+ 'cjm_graph_plugin_sqlite/plugin.py'),
20
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin._row_to_edge': ( 'plugin.html#sqlitegraphplugin._row_to_edge',
21
+ 'cjm_graph_plugin_sqlite/plugin.py'),
22
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin._row_to_node': ( 'plugin.html#sqlitegraphplugin._row_to_node',
23
+ 'cjm_graph_plugin_sqlite/plugin.py'),
24
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.add_edges': ( 'plugin.html#sqlitegraphplugin.add_edges',
25
+ 'cjm_graph_plugin_sqlite/plugin.py'),
26
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.add_nodes': ( 'plugin.html#sqlitegraphplugin.add_nodes',
27
+ 'cjm_graph_plugin_sqlite/plugin.py'),
28
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.cleanup': ( 'plugin.html#sqlitegraphplugin.cleanup',
29
+ 'cjm_graph_plugin_sqlite/plugin.py'),
30
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.delete_edges': ( 'plugin.html#sqlitegraphplugin.delete_edges',
31
+ 'cjm_graph_plugin_sqlite/plugin.py'),
32
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.delete_nodes': ( 'plugin.html#sqlitegraphplugin.delete_nodes',
33
+ 'cjm_graph_plugin_sqlite/plugin.py'),
34
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.execute': ( 'plugin.html#sqlitegraphplugin.execute',
35
+ 'cjm_graph_plugin_sqlite/plugin.py'),
36
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.export_graph': ( 'plugin.html#sqlitegraphplugin.export_graph',
37
+ 'cjm_graph_plugin_sqlite/plugin.py'),
38
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.find_nodes_by_label': ( 'plugin.html#sqlitegraphplugin.find_nodes_by_label',
39
+ 'cjm_graph_plugin_sqlite/plugin.py'),
40
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.find_nodes_by_source': ( 'plugin.html#sqlitegraphplugin.find_nodes_by_source',
41
+ 'cjm_graph_plugin_sqlite/plugin.py'),
42
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.get_config_schema': ( 'plugin.html#sqlitegraphplugin.get_config_schema',
43
+ 'cjm_graph_plugin_sqlite/plugin.py'),
44
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.get_context': ( 'plugin.html#sqlitegraphplugin.get_context',
45
+ 'cjm_graph_plugin_sqlite/plugin.py'),
46
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.get_current_config': ( 'plugin.html#sqlitegraphplugin.get_current_config',
47
+ 'cjm_graph_plugin_sqlite/plugin.py'),
48
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.get_edge': ( 'plugin.html#sqlitegraphplugin.get_edge',
49
+ 'cjm_graph_plugin_sqlite/plugin.py'),
50
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.get_node': ( 'plugin.html#sqlitegraphplugin.get_node',
51
+ 'cjm_graph_plugin_sqlite/plugin.py'),
52
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.get_schema': ( 'plugin.html#sqlitegraphplugin.get_schema',
53
+ 'cjm_graph_plugin_sqlite/plugin.py'),
54
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.import_graph': ( 'plugin.html#sqlitegraphplugin.import_graph',
55
+ 'cjm_graph_plugin_sqlite/plugin.py'),
56
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.initialize': ( 'plugin.html#sqlitegraphplugin.initialize',
57
+ 'cjm_graph_plugin_sqlite/plugin.py'),
58
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.name': ( 'plugin.html#sqlitegraphplugin.name',
59
+ 'cjm_graph_plugin_sqlite/plugin.py'),
60
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.update_edge': ( 'plugin.html#sqlitegraphplugin.update_edge',
61
+ 'cjm_graph_plugin_sqlite/plugin.py'),
62
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.update_node': ( 'plugin.html#sqlitegraphplugin.update_node',
63
+ 'cjm_graph_plugin_sqlite/plugin.py'),
64
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPlugin.version': ( 'plugin.html#sqlitegraphplugin.version',
65
+ 'cjm_graph_plugin_sqlite/plugin.py'),
66
+ 'cjm_graph_plugin_sqlite.plugin.SQLiteGraphPluginConfig': ( 'plugin.html#sqlitegraphpluginconfig',
67
+ 'cjm_graph_plugin_sqlite/plugin.py')}}}
@@ -0,0 +1,55 @@
1
+ """Metadata introspection for the SQLite Graph plugin used by cjm-ctl to generate the registration manifest."""
2
+
3
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/meta.ipynb.
4
+
5
+ # %% auto 0
6
+ __all__ = ['get_plugin_metadata']
7
+
8
+ # %% ../nbs/meta.ipynb 3
9
+ import os
10
+ import sys
11
+ from typing import Any, Dict
12
+
13
+ # %% ../nbs/meta.ipynb 4
14
+ def get_plugin_metadata() -> Dict[str, Any]: # Plugin metadata for manifest generation
15
+ """Return metadata required to register this plugin with the PluginManager."""
16
+ # Fallback base path (current behavior for backward compatibility)
17
+ base_path = os.path.dirname(os.path.dirname(sys.executable))
18
+
19
+ # Use CJM config if available, else fallback to env-relative paths
20
+ cjm_data_dir = os.environ.get("CJM_DATA_DIR")
21
+
22
+ # Plugin data directory
23
+ plugin_name = "cjm-graph-plugin-sqlite"
24
+ if cjm_data_dir:
25
+ data_dir = os.path.join(cjm_data_dir, plugin_name)
26
+ else:
27
+ data_dir = os.path.join(base_path, "data")
28
+
29
+ db_path = os.path.join(data_dir, "context_graph.db")
30
+
31
+ # Ensure data directory exists
32
+ os.makedirs(data_dir, exist_ok=True)
33
+
34
+ return {
35
+ "name": plugin_name,
36
+ "version": "0.1.0",
37
+ "type": "graph",
38
+ "category": "knowledge-management",
39
+ "interface": "cjm_graph_plugin_system.plugin_interface.GraphPlugin",
40
+
41
+ "module": "cjm_graph_plugin_sqlite.plugin",
42
+ "class": "SQLiteGraphPlugin",
43
+
44
+ # Critical: The absolute path to THIS environment's python
45
+ "python_path": sys.executable,
46
+
47
+ "db_path": db_path,
48
+
49
+ "resources": {
50
+ "requires_gpu": False,
51
+ "min_system_ram_mb": 512
52
+ },
53
+
54
+ "env_vars": {}
55
+ }
@@ -0,0 +1,639 @@
1
+ """Plugin implementation for Context Graph using SQLite"""
2
+
3
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/plugin.ipynb.
4
+
5
+ # %% auto 0
6
+ __all__ = ['SQLiteGraphPluginConfig', 'SQLiteGraphPlugin']
7
+
8
+ # %% ../nbs/plugin.ipynb 3
9
+ import json
10
+ import logging
11
+ import os
12
+ import sqlite3
13
+ import time
14
+ from dataclasses import dataclass, field
15
+ from typing import Any, Dict, List, Optional, Tuple, Union
16
+
17
+ from cjm_plugin_system.utils.validation import (
18
+ dict_to_config, config_to_dict, dataclass_to_jsonschema,
19
+ SCHEMA_TITLE, SCHEMA_DESC
20
+ )
21
+ from cjm_graph_plugin_system.plugin_interface import GraphPlugin
22
+ from cjm_graph_plugin_system.core import (
23
+ GraphNode, GraphEdge, GraphContext, GraphQuery, SourceRef
24
+ )
25
+
26
+ from .meta import get_plugin_metadata
27
+
28
+ # %% ../nbs/plugin.ipynb 5
29
+ @dataclass
30
+ class SQLiteGraphPluginConfig:
31
+ """Configuration for SQLite Graph Plugin."""
32
+ db_path: Optional[str] = field(
33
+ default=None,
34
+ metadata={
35
+ SCHEMA_TITLE: "Database Path",
36
+ SCHEMA_DESC: "Absolute path to SQLite DB. If None, uses default env path."
37
+ }
38
+ )
39
+ readonly: bool = field(
40
+ default=False,
41
+ metadata={
42
+ SCHEMA_TITLE: "Read Only",
43
+ SCHEMA_DESC: "Open database in read-only mode."
44
+ }
45
+ )
46
+
47
+ # %% ../nbs/plugin.ipynb 7
48
+ class SQLiteGraphPlugin(GraphPlugin):
49
+ """Local, file-backed Context Graph implementation using SQLite."""
50
+
51
+ config_class = SQLiteGraphPluginConfig
52
+
53
+ def __init__(self):
54
+ self.logger = logging.getLogger(f"{__name__}.{type(self).__name__}")
55
+ self.config: SQLiteGraphPluginConfig = None
56
+ self._db_path: str = None
57
+
58
+ @property
59
+ def name(self) -> str: # Plugin name identifier
60
+ """Get the plugin name identifier."""
61
+ return "sqlite_graph"
62
+
63
+ @property
64
+ def version(self) -> str: # Plugin version string
65
+ """Get the plugin version string."""
66
+ return "0.1.0"
67
+
68
+ def get_current_config(self) -> Dict[str, Any]: # Current configuration as dictionary
69
+ """Return current configuration state."""
70
+ if not self.config:
71
+ return {}
72
+ return config_to_dict(self.config)
73
+
74
+ def get_config_schema(self) -> Dict[str, Any]: # JSON Schema for configuration
75
+ """Return JSON Schema for UI generation."""
76
+ return dataclass_to_jsonschema(SQLiteGraphPluginConfig)
77
+
78
+ def initialize(
79
+ self,
80
+ config: Optional[Any] = None # Configuration dataclass, dict, or None
81
+ ) -> None:
82
+ """Initialize DB connection and schema."""
83
+ self.config = dict_to_config(SQLiteGraphPluginConfig, config or {})
84
+
85
+ # Determine DB path (Config override > Meta default)
86
+ meta_path = get_plugin_metadata()["db_path"]
87
+ self._db_path = self.config.db_path if self.config.db_path else meta_path
88
+
89
+ self.logger.info(f"Initializing SQLite Graph at: {self._db_path}")
90
+ self._init_db()
91
+
92
+ def _init_db(self) -> None:
93
+ """Create tables and indices."""
94
+ with sqlite3.connect(self._db_path) as con:
95
+ # Enable Foreign Keys
96
+ con.execute("PRAGMA foreign_keys = ON;")
97
+
98
+ # Nodes Table
99
+ con.execute("""
100
+ CREATE TABLE IF NOT EXISTS nodes (
101
+ id TEXT PRIMARY KEY,
102
+ label TEXT NOT NULL,
103
+ properties JSON,
104
+ sources JSON,
105
+ created_at REAL,
106
+ updated_at REAL
107
+ )
108
+ """)
109
+ con.execute("CREATE INDEX IF NOT EXISTS idx_nodes_label ON nodes(label);")
110
+
111
+ # Edges Table
112
+ con.execute("""
113
+ CREATE TABLE IF NOT EXISTS edges (
114
+ id TEXT PRIMARY KEY,
115
+ source_id TEXT NOT NULL,
116
+ target_id TEXT NOT NULL,
117
+ relation_type TEXT NOT NULL,
118
+ properties JSON,
119
+ created_at REAL,
120
+ updated_at REAL,
121
+ FOREIGN KEY(source_id) REFERENCES nodes(id) ON DELETE CASCADE,
122
+ FOREIGN KEY(target_id) REFERENCES nodes(id) ON DELETE CASCADE
123
+ )
124
+ """)
125
+ con.execute("CREATE INDEX IF NOT EXISTS idx_edges_source ON edges(source_id);")
126
+ con.execute("CREATE INDEX IF NOT EXISTS idx_edges_target ON edges(target_id);")
127
+ con.execute("CREATE INDEX IF NOT EXISTS idx_edges_type ON edges(relation_type);")
128
+
129
+ # -------------------------------------------------------------------------
130
+ # Helpers
131
+ # -------------------------------------------------------------------------
132
+
133
+ def _row_to_node(
134
+ self,
135
+ row: Tuple # DB row: (id, label, properties_json, sources_json)
136
+ ) -> GraphNode: # Reconstructed GraphNode
137
+ """Convert DB row to GraphNode DTO."""
138
+ props = json.loads(row[2]) if row[2] else {}
139
+ sources_raw = json.loads(row[3]) if row[3] else []
140
+ sources = [SourceRef(**s) for s in sources_raw]
141
+ return GraphNode(id=row[0], label=row[1], properties=props, sources=sources)
142
+
143
+ def _row_to_edge(
144
+ self,
145
+ row: Tuple # DB row: (id, source_id, target_id, relation_type, properties_json)
146
+ ) -> GraphEdge: # Reconstructed GraphEdge
147
+ """Convert DB row to GraphEdge DTO."""
148
+ props = json.loads(row[4]) if row[4] else {}
149
+ return GraphEdge(
150
+ id=row[0],
151
+ source_id=row[1],
152
+ target_id=row[2],
153
+ relation_type=row[3],
154
+ properties=props
155
+ )
156
+
157
+ def _dict_to_node(
158
+ self,
159
+ data: Dict[str, Any] # Node data as dictionary
160
+ ) -> GraphNode: # Reconstructed GraphNode
161
+ """Convert dictionary to GraphNode, handling nested sources."""
162
+ sources = []
163
+ for s in data.get("sources", []):
164
+ if isinstance(s, dict):
165
+ sources.append(SourceRef(**s))
166
+ else:
167
+ sources.append(s)
168
+ return GraphNode(
169
+ id=data["id"],
170
+ label=data["label"],
171
+ properties=data.get("properties", {}),
172
+ sources=sources
173
+ )
174
+
175
+ def _dict_to_edge(
176
+ self,
177
+ data: Dict[str, Any] # Edge data as dictionary
178
+ ) -> GraphEdge: # Reconstructed GraphEdge
179
+ """Convert dictionary to GraphEdge."""
180
+ return GraphEdge(
181
+ id=data["id"],
182
+ source_id=data["source_id"],
183
+ target_id=data["target_id"],
184
+ relation_type=data["relation_type"],
185
+ properties=data.get("properties", {})
186
+ )
187
+
188
+ # -------------------------------------------------------------------------
189
+ # EXECUTE - Main dispatcher for RemotePluginProxy
190
+ # -------------------------------------------------------------------------
191
+
192
+ def execute(
193
+ self,
194
+ action: str = "get_schema", # Action to perform
195
+ **kwargs
196
+ ) -> Dict[str, Any]: # JSON-serializable result
197
+ """Dispatch to appropriate method based on action."""
198
+
199
+ if action == "get_schema":
200
+ return self.get_schema()
201
+
202
+ elif action == "add_nodes":
203
+ # Convert dicts to GraphNode objects
204
+ nodes_data = kwargs.get("nodes", [])
205
+ nodes = []
206
+ for n in nodes_data:
207
+ if isinstance(n, dict):
208
+ nodes.append(self._dict_to_node(n))
209
+ else:
210
+ nodes.append(n)
211
+ ids = self.add_nodes(nodes)
212
+ return {"created_ids": ids, "count": len(ids)}
213
+
214
+ elif action == "add_edges":
215
+ edges_data = kwargs.get("edges", [])
216
+ edges = []
217
+ for e in edges_data:
218
+ if isinstance(e, dict):
219
+ edges.append(self._dict_to_edge(e))
220
+ else:
221
+ edges.append(e)
222
+ ids = self.add_edges(edges)
223
+ return {"created_ids": ids, "count": len(ids)}
224
+
225
+ elif action == "get_node":
226
+ node = self.get_node(kwargs["node_id"])
227
+ return {"node": node.to_dict() if node else None}
228
+
229
+ elif action == "get_edge":
230
+ edge = self.get_edge(kwargs["edge_id"])
231
+ return {"edge": edge.to_dict() if edge else None}
232
+
233
+ elif action == "get_context":
234
+ ctx = self.get_context(
235
+ kwargs["node_id"],
236
+ depth=kwargs.get("depth", 1),
237
+ filter_labels=kwargs.get("filter_labels")
238
+ )
239
+ return ctx.to_dict()
240
+
241
+ elif action == "find_nodes_by_source":
242
+ ref_data = kwargs["source_ref"]
243
+ if isinstance(ref_data, dict):
244
+ ref = SourceRef(**ref_data)
245
+ else:
246
+ ref = ref_data
247
+ nodes = self.find_nodes_by_source(ref)
248
+ return {"nodes": [n.to_dict() for n in nodes], "count": len(nodes)}
249
+
250
+ elif action == "find_nodes_by_label":
251
+ nodes = self.find_nodes_by_label(
252
+ kwargs["label"],
253
+ limit=kwargs.get("limit", 100)
254
+ )
255
+ return {"nodes": [n.to_dict() for n in nodes], "count": len(nodes)}
256
+
257
+ elif action == "update_node":
258
+ success = self.update_node(kwargs["node_id"], kwargs["properties"])
259
+ return {"success": success}
260
+
261
+ elif action == "update_edge":
262
+ success = self.update_edge(kwargs["edge_id"], kwargs["properties"])
263
+ return {"success": success}
264
+
265
+ elif action == "delete_nodes":
266
+ count = self.delete_nodes(
267
+ kwargs["node_ids"],
268
+ cascade=kwargs.get("cascade", True)
269
+ )
270
+ return {"deleted_count": count}
271
+
272
+ elif action == "delete_edges":
273
+ count = self.delete_edges(kwargs["edge_ids"])
274
+ return {"deleted_count": count}
275
+
276
+ elif action == "import_graph":
277
+ graph_data = kwargs["graph_data"]
278
+ if isinstance(graph_data, dict):
279
+ graph_data = GraphContext.from_dict(graph_data)
280
+ stats = self.import_graph(
281
+ graph_data,
282
+ merge_strategy=kwargs.get("merge_strategy", "overwrite")
283
+ )
284
+ return stats
285
+
286
+ elif action == "export_graph":
287
+ ctx = self.export_graph(filter_query=kwargs.get("filter_query"))
288
+ return ctx.to_dict()
289
+
290
+ elif action == "query":
291
+ # Raw query execution (future enhancement)
292
+ query = kwargs.get("query", "")
293
+ self.logger.warning(f"Raw query action not fully implemented: {query}")
294
+ return {"status": "not_implemented", "query": str(query)}
295
+
296
+ else:
297
+ raise ValueError(f"Unknown action: {action}")
298
+
299
+ # -------------------------------------------------------------------------
300
+ # CREATE
301
+ # -------------------------------------------------------------------------
302
+
303
+ def add_nodes(
304
+ self,
305
+ nodes: List[GraphNode] # Nodes to create
306
+ ) -> List[str]: # Created node IDs
307
+ """Bulk create nodes."""
308
+ ids = []
309
+ now = time.time()
310
+ with sqlite3.connect(self._db_path) as con:
311
+ for n in nodes:
312
+ sources_json = json.dumps([s.to_dict() for s in n.sources])
313
+ props_json = json.dumps(n.properties)
314
+ try:
315
+ con.execute(
316
+ "INSERT INTO nodes (id, label, properties, sources, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)",
317
+ (n.id, n.label, props_json, sources_json, now, now)
318
+ )
319
+ ids.append(n.id)
320
+ except sqlite3.IntegrityError:
321
+ self.logger.warning(f"Node ID collision or error: {n.id}")
322
+ return ids
323
+
324
+ def add_edges(
325
+ self,
326
+ edges: List[GraphEdge] # Edges to create
327
+ ) -> List[str]: # Created edge IDs
328
+ """Bulk create edges."""
329
+ ids = []
330
+ now = time.time()
331
+ with sqlite3.connect(self._db_path) as con:
332
+ con.execute("PRAGMA foreign_keys = ON;")
333
+ for e in edges:
334
+ props_json = json.dumps(e.properties)
335
+ try:
336
+ con.execute(
337
+ "INSERT INTO edges (id, source_id, target_id, relation_type, properties, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)",
338
+ (e.id, e.source_id, e.target_id, e.relation_type, props_json, now, now)
339
+ )
340
+ ids.append(e.id)
341
+ except sqlite3.IntegrityError as err:
342
+ self.logger.warning(f"Edge creation error (likely missing node): {err}")
343
+ return ids
344
+
345
+ # -------------------------------------------------------------------------
346
+ # READ
347
+ # -------------------------------------------------------------------------
348
+
349
+ def get_node(
350
+ self,
351
+ node_id: str # UUID of node to retrieve
352
+ ) -> Optional[GraphNode]: # Node or None if not found
353
+ """Get a single node by ID."""
354
+ with sqlite3.connect(self._db_path) as con:
355
+ cur = con.execute(
356
+ "SELECT id, label, properties, sources FROM nodes WHERE id = ?",
357
+ (node_id,)
358
+ )
359
+ row = cur.fetchone()
360
+ return self._row_to_node(row) if row else None
361
+
362
+ def get_edge(
363
+ self,
364
+ edge_id: str # UUID of edge to retrieve
365
+ ) -> Optional[GraphEdge]: # Edge or None if not found
366
+ """Get a single edge by ID."""
367
+ with sqlite3.connect(self._db_path) as con:
368
+ cur = con.execute(
369
+ "SELECT id, source_id, target_id, relation_type, properties FROM edges WHERE id = ?",
370
+ (edge_id,)
371
+ )
372
+ row = cur.fetchone()
373
+ return self._row_to_edge(row) if row else None
374
+
375
+ def find_nodes_by_source(
376
+ self,
377
+ source_ref: SourceRef # External resource reference
378
+ ) -> List[GraphNode]: # Nodes attached to this source
379
+ """Find all nodes linked to a specific external resource."""
380
+ # Use SQLite's json_each() to search within the sources JSON array
381
+ query = """
382
+ SELECT DISTINCT n.id, n.label, n.properties, n.sources
383
+ FROM nodes n, json_each(n.sources) as src
384
+ WHERE json_extract(src.value, '$.plugin_name') = ?
385
+ AND json_extract(src.value, '$.row_id') = ?
386
+ """
387
+ params = [source_ref.plugin_name, source_ref.row_id]
388
+
389
+ # If segment slice is specified, add it to query
390
+ if source_ref.segment_slice:
391
+ query += " AND json_extract(src.value, '$.segment_slice') = ?"
392
+ params.append(source_ref.segment_slice)
393
+
394
+ results = []
395
+ with sqlite3.connect(self._db_path) as con:
396
+ cur = con.execute(query, tuple(params))
397
+ for row in cur:
398
+ results.append(self._row_to_node(row))
399
+ return results
400
+
401
+ def find_nodes_by_label(
402
+ self,
403
+ label: str, # Node label to search for
404
+ limit: int = 100 # Max results
405
+ ) -> List[GraphNode]: # Matching nodes
406
+ """Find nodes by label."""
407
+ results = []
408
+ with sqlite3.connect(self._db_path) as con:
409
+ cur = con.execute(
410
+ "SELECT id, label, properties, sources FROM nodes WHERE label = ? LIMIT ?",
411
+ (label, limit)
412
+ )
413
+ for row in cur:
414
+ results.append(self._row_to_node(row))
415
+ return results
416
+
417
+ def get_context(
418
+ self,
419
+ node_id: str, # Starting node UUID
420
+ depth: int = 1, # Traversal depth (1 = immediate neighbors)
421
+ filter_labels: Optional[List[str]] = None # Only include nodes with these labels
422
+ ) -> GraphContext: # Subgraph containing node and its neighborhood
423
+ """Get the neighborhood of a specific node."""
424
+ # For depth=1, use simple query; for deeper, use recursive CTE
425
+ edge_ids = []
426
+ with sqlite3.connect(self._db_path) as con:
427
+ if depth == 1:
428
+ cur = con.execute(
429
+ "SELECT id FROM edges WHERE source_id = ? OR target_id = ?",
430
+ (node_id, node_id)
431
+ )
432
+ else:
433
+ # Recursive CTE for multi-hop traversal
434
+ query = """
435
+ WITH RECURSIVE traversal(edge_id, node_id, depth) AS (
436
+ -- Base case: edges connected to the start node
437
+ SELECT id,
438
+ CASE WHEN source_id = ? THEN target_id ELSE source_id END,
439
+ 1
440
+ FROM edges
441
+ WHERE source_id = ? OR target_id = ?
442
+
443
+ UNION
444
+
445
+ -- Recursive step: edges connected to discovered nodes
446
+ SELECT e.id,
447
+ CASE WHEN e.source_id = t.node_id THEN e.target_id ELSE e.source_id END,
448
+ t.depth + 1
449
+ FROM edges e
450
+ JOIN traversal t ON (e.source_id = t.node_id OR e.target_id = t.node_id)
451
+ WHERE t.depth < ?
452
+ )
453
+ SELECT DISTINCT edge_id FROM traversal;
454
+ """
455
+ cur = con.execute(query, (node_id, node_id, node_id, depth))
456
+
457
+ edge_ids = [row[0] for row in cur.fetchall()]
458
+
459
+ # Fetch full Edge objects
460
+ edges = []
461
+ node_ids_in_context = {node_id} # Always include the center
462
+
463
+ if edge_ids:
464
+ placeholders = ','.join('?' for _ in edge_ids)
465
+ with sqlite3.connect(self._db_path) as con:
466
+ cur = con.execute(
467
+ f"SELECT id, source_id, target_id, relation_type, properties FROM edges WHERE id IN ({placeholders})",
468
+ tuple(edge_ids)
469
+ )
470
+ for row in cur:
471
+ e = self._row_to_edge(row)
472
+ edges.append(e)
473
+ node_ids_in_context.add(e.source_id)
474
+ node_ids_in_context.add(e.target_id)
475
+
476
+ # Fetch full Node objects
477
+ nodes = []
478
+ if node_ids_in_context:
479
+ placeholders = ','.join('?' for _ in node_ids_in_context)
480
+ with sqlite3.connect(self._db_path) as con:
481
+ sql = f"SELECT id, label, properties, sources FROM nodes WHERE id IN ({placeholders})"
482
+
483
+ # Apply optional label filtering
484
+ params = list(node_ids_in_context)
485
+ if filter_labels:
486
+ sql += f" AND label IN ({','.join('?' for _ in filter_labels)})"
487
+ params.extend(filter_labels)
488
+
489
+ cur = con.execute(sql, tuple(params))
490
+ for row in cur:
491
+ nodes.append(self._row_to_node(row))
492
+
493
+ return GraphContext(
494
+ nodes=nodes,
495
+ edges=edges,
496
+ metadata={"depth": depth, "center": node_id}
497
+ )
498
+
499
+ # -------------------------------------------------------------------------
500
+ # UPDATE
501
+ # -------------------------------------------------------------------------
502
+
503
+ def update_node(
504
+ self,
505
+ node_id: str, # UUID of node to update
506
+ properties: Dict[str, Any] # Properties to merge/update
507
+ ) -> bool: # True if successful
508
+ """Partial update of node properties."""
509
+ with sqlite3.connect(self._db_path) as con:
510
+ # Fetch existing to merge
511
+ cur = con.execute("SELECT properties FROM nodes WHERE id = ?", (node_id,))
512
+ row = cur.fetchone()
513
+ if not row:
514
+ return False
515
+
516
+ existing = json.loads(row[0]) if row[0] else {}
517
+ existing.update(properties) # Merge
518
+
519
+ con.execute(
520
+ "UPDATE nodes SET properties = ?, updated_at = ? WHERE id = ?",
521
+ (json.dumps(existing), time.time(), node_id)
522
+ )
523
+ return True
524
+
525
+ def update_edge(
526
+ self,
527
+ edge_id: str, # UUID of edge to update
528
+ properties: Dict[str, Any] # Properties to merge/update
529
+ ) -> bool: # True if successful
530
+ """Partial update of edge properties."""
531
+ with sqlite3.connect(self._db_path) as con:
532
+ cur = con.execute("SELECT properties FROM edges WHERE id = ?", (edge_id,))
533
+ row = cur.fetchone()
534
+ if not row:
535
+ return False
536
+
537
+ existing = json.loads(row[0]) if row[0] else {}
538
+ existing.update(properties)
539
+
540
+ con.execute(
541
+ "UPDATE edges SET properties = ?, updated_at = ? WHERE id = ?",
542
+ (json.dumps(existing), time.time(), edge_id)
543
+ )
544
+ return True
545
+
546
+ # -------------------------------------------------------------------------
547
+ # DELETE
548
+ # -------------------------------------------------------------------------
549
+
550
+ def delete_nodes(
551
+ self,
552
+ node_ids: List[str], # UUIDs of nodes to delete
553
+ cascade: bool = True # Also delete connected edges
554
+ ) -> int: # Number of nodes deleted
555
+ """Delete nodes (and optionally connected edges)."""
556
+ with sqlite3.connect(self._db_path) as con:
557
+ if cascade:
558
+ con.execute("PRAGMA foreign_keys = ON;") # Ensures cascade works
559
+ else:
560
+ con.execute("PRAGMA foreign_keys = OFF;")
561
+
562
+ placeholders = ','.join('?' for _ in node_ids)
563
+ cur = con.execute(
564
+ f"DELETE FROM nodes WHERE id IN ({placeholders})",
565
+ tuple(node_ids)
566
+ )
567
+ return cur.rowcount
568
+
569
+ def delete_edges(
570
+ self,
571
+ edge_ids: List[str] # UUIDs of edges to delete
572
+ ) -> int: # Number of edges deleted
573
+ """Delete edges."""
574
+ with sqlite3.connect(self._db_path) as con:
575
+ placeholders = ','.join('?' for _ in edge_ids)
576
+ cur = con.execute(
577
+ f"DELETE FROM edges WHERE id IN ({placeholders})",
578
+ tuple(edge_ids)
579
+ )
580
+ return cur.rowcount
581
+
582
+ # -------------------------------------------------------------------------
583
+ # LIFECYCLE & INTROSPECTION
584
+ # -------------------------------------------------------------------------
585
+
586
+ def get_schema(self) -> Dict[str, Any]: # Graph schema/ontology
587
+ """Return the current ontology/schema of the graph."""
588
+ schema = {"node_labels": [], "edge_types": [], "counts": {}}
589
+ with sqlite3.connect(self._db_path) as con:
590
+ # Labels
591
+ cur = con.execute("SELECT DISTINCT label FROM nodes")
592
+ schema["node_labels"] = [r[0] for r in cur.fetchall()]
593
+
594
+ # Types
595
+ cur = con.execute("SELECT DISTINCT relation_type FROM edges")
596
+ schema["edge_types"] = [r[0] for r in cur.fetchall()]
597
+
598
+ # Counts
599
+ cur = con.execute("SELECT label, COUNT(*) FROM nodes GROUP BY label")
600
+ for row in cur:
601
+ schema["counts"][row[0]] = row[1]
602
+
603
+ return schema
604
+
605
+ def import_graph(
606
+ self,
607
+ graph_data: GraphContext, # Data to import
608
+ merge_strategy: str = "overwrite" # "overwrite", "skip", or "merge"
609
+ ) -> Dict[str, int]: # Import statistics {nodes_created, edges_created, ...}
610
+ """Bulk import a GraphContext (e.g., from backup or another plugin)."""
611
+ # Reuse bulk add methods (currently uses overwrite via INSERT)
612
+ n = self.add_nodes(graph_data.nodes)
613
+ e = self.add_edges(graph_data.edges)
614
+ return {"nodes_created": len(n), "edges_created": len(e)}
615
+
616
+ def export_graph(
617
+ self,
618
+ filter_query: Optional[GraphQuery] = None # Optional filter
619
+ ) -> GraphContext: # Exported subgraph or full graph
620
+ """Export the entire graph or a filtered subset."""
621
+ # For now, dump everything (future: use filter_query)
622
+ all_nodes = []
623
+ all_edges = []
624
+
625
+ with sqlite3.connect(self._db_path) as con:
626
+ cur = con.execute("SELECT id, label, properties, sources FROM nodes")
627
+ for row in cur:
628
+ all_nodes.append(self._row_to_node(row))
629
+
630
+ cur = con.execute("SELECT id, source_id, target_id, relation_type, properties FROM edges")
631
+ for row in cur:
632
+ all_edges.append(self._row_to_edge(row))
633
+
634
+ return GraphContext(nodes=all_nodes, edges=all_edges)
635
+
636
+ def cleanup(self) -> None:
637
+ """Clean up resources."""
638
+ # SQLite connections are managed via context managers, nothing to do here
639
+ pass
@@ -0,0 +1,274 @@
1
+ Metadata-Version: 2.4
2
+ Name: cjm-graph-plugin-sqlite
3
+ Version: 0.0.2
4
+ Summary: A local, file-backed Context Graph worker for the cjm-plugin-system that implements graph storage, traversal, and querying using SQLite.
5
+ Home-page: https://github.com/cj-mills/cjm-graph-plugin-sqlite
6
+ Author: Christian J. Mills
7
+ Author-email: 9126128+cj-mills@users.noreply.github.com
8
+ License: Apache Software License 2.0
9
+ Keywords: nbdev jupyter notebook python
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Natural Language :: English
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: cjm_graph_plugin_system
20
+ Provides-Extra: dev
21
+ Dynamic: author
22
+ Dynamic: author-email
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: description-content-type
26
+ Dynamic: home-page
27
+ Dynamic: keywords
28
+ Dynamic: license
29
+ Dynamic: license-file
30
+ Dynamic: provides-extra
31
+ Dynamic: requires-dist
32
+ Dynamic: requires-python
33
+ Dynamic: summary
34
+
35
+ # cjm-graph-plugin-sqlite
36
+
37
+
38
+ <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
39
+
40
+ ## Install
41
+
42
+ ``` bash
43
+ pip install cjm_graph_plugin_sqlite
44
+ ```
45
+
46
+ ## Project Structure
47
+
48
+ nbs/
49
+ ├── meta.ipynb # Metadata introspection for the SQLite Graph plugin used by cjm-ctl to generate the registration manifest.
50
+ └── plugin.ipynb # Plugin implementation for Context Graph using SQLite
51
+
52
+ Total: 2 notebooks
53
+
54
+ ## Module Dependencies
55
+
56
+ ``` mermaid
57
+ graph LR
58
+ meta[meta<br/>Metadata]
59
+ plugin[plugin<br/>SQLite Graph Plugin]
60
+
61
+ plugin --> meta
62
+ ```
63
+
64
+ *1 cross-module dependencies detected*
65
+
66
+ ## CLI Reference
67
+
68
+ No CLI commands found in this project.
69
+
70
+ ## Module Overview
71
+
72
+ Detailed documentation for each module in the project:
73
+
74
+ ### Metadata (`meta.ipynb`)
75
+
76
+ > Metadata introspection for the SQLite Graph plugin used by cjm-ctl to
77
+ > generate the registration manifest.
78
+
79
+ #### Import
80
+
81
+ ``` python
82
+ from cjm_graph_plugin_sqlite.meta import (
83
+ get_plugin_metadata
84
+ )
85
+ ```
86
+
87
+ #### Functions
88
+
89
+ ``` python
90
+ def get_plugin_metadata() -> Dict[str, Any]: # Plugin metadata for manifest generation
91
+ """Return metadata required to register this plugin with the PluginManager."""
92
+ # Fallback base path (current behavior for backward compatibility)
93
+ base_path = os.path.dirname(os.path.dirname(sys.executable))
94
+
95
+ # Use CJM config if available, else fallback to env-relative paths
96
+ cjm_data_dir = os.environ.get("CJM_DATA_DIR")
97
+
98
+ # Plugin data directory
99
+ plugin_name = "cjm-graph-plugin-sqlite"
100
+ if cjm_data_dir
101
+ "Return metadata required to register this plugin with the PluginManager."
102
+ ```
103
+
104
+ ### SQLite Graph Plugin (`plugin.ipynb`)
105
+
106
+ > Plugin implementation for Context Graph using SQLite
107
+
108
+ #### Import
109
+
110
+ ``` python
111
+ from cjm_graph_plugin_sqlite.plugin import (
112
+ SQLiteGraphPluginConfig,
113
+ SQLiteGraphPlugin
114
+ )
115
+ ```
116
+
117
+ #### Classes
118
+
119
+ ``` python
120
+ @dataclass
121
+ class SQLiteGraphPluginConfig:
122
+ "Configuration for SQLite Graph Plugin."
123
+
124
+ db_path: Optional[str] = field(...)
125
+ readonly: bool = field(...)
126
+ ```
127
+
128
+ ``` python
129
+ class SQLiteGraphPlugin:
130
+ def __init__(self):
131
+ self.logger = logging.getLogger(f"{__name__}.{type(self).__name__}")
132
+ self.config: SQLiteGraphPluginConfig = None
133
+ "Local, file-backed Context Graph implementation using SQLite."
134
+
135
+ def __init__(self):
136
+ self.logger = logging.getLogger(f"{__name__}.{type(self).__name__}")
137
+ self.config: SQLiteGraphPluginConfig = None
138
+
139
+ def name(self) -> str: # Plugin name identifier
140
+ """Get the plugin name identifier."""
141
+ return "sqlite_graph"
142
+
143
+ @property
144
+ def version(self) -> str: # Plugin version string
145
+ "Get the plugin name identifier."
146
+
147
+ def version(self) -> str: # Plugin version string
148
+ """Get the plugin version string."""
149
+ return "0.1.0"
150
+
151
+ def get_current_config(self) -> Dict[str, Any]: # Current configuration as dictionary
152
+ "Get the plugin version string."
153
+
154
+ def get_current_config(self) -> Dict[str, Any]: # Current configuration as dictionary
155
+ """Return current configuration state."""
156
+ if not self.config
157
+ "Return current configuration state."
158
+
159
+ def get_config_schema(self) -> Dict[str, Any]: # JSON Schema for configuration
160
+ """Return JSON Schema for UI generation."""
161
+ return dataclass_to_jsonschema(SQLiteGraphPluginConfig)
162
+
163
+ def initialize(
164
+ self,
165
+ config: Optional[Any] = None # Configuration dataclass, dict, or None
166
+ ) -> None
167
+ "Return JSON Schema for UI generation."
168
+
169
+ def initialize(
170
+ self,
171
+ config: Optional[Any] = None # Configuration dataclass, dict, or None
172
+ ) -> None
173
+ "Initialize DB connection and schema."
174
+
175
+ def execute(
176
+ self,
177
+ action: str = "get_schema", # Action to perform
178
+ **kwargs
179
+ ) -> Dict[str, Any]: # JSON-serializable result
180
+ "Dispatch to appropriate method based on action."
181
+
182
+ def add_nodes(
183
+ self,
184
+ nodes: List[GraphNode] # Nodes to create
185
+ ) -> List[str]: # Created node IDs
186
+ "Bulk create nodes."
187
+
188
+ def add_edges(
189
+ self,
190
+ edges: List[GraphEdge] # Edges to create
191
+ ) -> List[str]: # Created edge IDs
192
+ "Bulk create edges."
193
+
194
+ def get_node(
195
+ self,
196
+ node_id: str # UUID of node to retrieve
197
+ ) -> Optional[GraphNode]: # Node or None if not found
198
+ "Get a single node by ID."
199
+
200
+ def get_edge(
201
+ self,
202
+ edge_id: str # UUID of edge to retrieve
203
+ ) -> Optional[GraphEdge]: # Edge or None if not found
204
+ "Get a single edge by ID."
205
+
206
+ def find_nodes_by_source(
207
+ self,
208
+ source_ref: SourceRef # External resource reference
209
+ ) -> List[GraphNode]: # Nodes attached to this source
210
+ "Find all nodes linked to a specific external resource."
211
+
212
+ def find_nodes_by_label(
213
+ self,
214
+ label: str, # Node label to search for
215
+ limit: int = 100 # Max results
216
+ ) -> List[GraphNode]: # Matching nodes
217
+ "Find nodes by label."
218
+
219
+ def get_context(
220
+ self,
221
+ node_id: str, # Starting node UUID
222
+ depth: int = 1, # Traversal depth (1 = immediate neighbors)
223
+ filter_labels: Optional[List[str]] = None # Only include nodes with these labels
224
+ ) -> GraphContext: # Subgraph containing node and its neighborhood
225
+ "Get the neighborhood of a specific node."
226
+
227
+ def update_node(
228
+ self,
229
+ node_id: str, # UUID of node to update
230
+ properties: Dict[str, Any] # Properties to merge/update
231
+ ) -> bool: # True if successful
232
+ "Partial update of node properties."
233
+
234
+ def update_edge(
235
+ self,
236
+ edge_id: str, # UUID of edge to update
237
+ properties: Dict[str, Any] # Properties to merge/update
238
+ ) -> bool: # True if successful
239
+ "Partial update of edge properties."
240
+
241
+ def delete_nodes(
242
+ self,
243
+ node_ids: List[str], # UUIDs of nodes to delete
244
+ cascade: bool = True # Also delete connected edges
245
+ ) -> int: # Number of nodes deleted
246
+ "Delete nodes (and optionally connected edges)."
247
+
248
+ def delete_edges(
249
+ self,
250
+ edge_ids: List[str] # UUIDs of edges to delete
251
+ ) -> int: # Number of edges deleted
252
+ "Delete edges."
253
+
254
+ def get_schema(self) -> Dict[str, Any]: # Graph schema/ontology
255
+ """Return the current ontology/schema of the graph."""
256
+ schema = {"node_labels": [], "edge_types": [], "counts": {}}
257
+ "Return the current ontology/schema of the graph."
258
+
259
+ def import_graph(
260
+ self,
261
+ graph_data: GraphContext, # Data to import
262
+ merge_strategy: str = "overwrite" # "overwrite", "skip", or "merge"
263
+ ) -> Dict[str, int]: # Import statistics {nodes_created, edges_created, ...}
264
+ "Bulk import a GraphContext (e.g., from backup or another plugin)."
265
+
266
+ def export_graph(
267
+ self,
268
+ filter_query: Optional[GraphQuery] = None # Optional filter
269
+ ) -> GraphContext: # Exported subgraph or full graph
270
+ "Export the entire graph or a filtered subset."
271
+
272
+ def cleanup(self) -> None
273
+ "Clean up resources."
274
+ ```
@@ -0,0 +1,10 @@
1
+ cjm_graph_plugin_sqlite/__init__.py,sha256=QvlVh4JTl3JL7jQAja76yKtT-IvF4631ASjWY1wS6AQ,22
2
+ cjm_graph_plugin_sqlite/_modidx.py,sha256=Q-V3YHsVnjemTwVD0J0KgSoV9vrruOSTNQxadAHkRPU,9565
3
+ cjm_graph_plugin_sqlite/meta.py,sha256=pdPbBoFwgzWKrVdFMZwg-LX5L2BaE_UYFzED-RCgt4k,1700
4
+ cjm_graph_plugin_sqlite/plugin.py,sha256=dmOIxjTitguj0xljj0ZFfqNDQSUbGbqvSX82eAGq0VA,24445
5
+ cjm_graph_plugin_sqlite-0.0.2.dist-info/licenses/LICENSE,sha256=xV8xoN4VOL0uw9X8RSs2IMuD_Ss_a9yAbtGNeBWZwnw,11337
6
+ cjm_graph_plugin_sqlite-0.0.2.dist-info/METADATA,sha256=CjzqZsjRbNakN8_r0NO_UYAUv_4UT2FzguYzJMr9R1o,8667
7
+ cjm_graph_plugin_sqlite-0.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ cjm_graph_plugin_sqlite-0.0.2.dist-info/entry_points.txt,sha256=b4RcREuJqQa18xxv-SrLDxz3c1NGZ5tpb_AIbgSgCrc,68
9
+ cjm_graph_plugin_sqlite-0.0.2.dist-info/top_level.txt,sha256=gA6ujPX6sBbQL1jKizsx1cQss0qNUNEp8AiTiQQOc0I,24
10
+ cjm_graph_plugin_sqlite-0.0.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [nbdev]
2
+ cjm_graph_plugin_sqlite = cjm_graph_plugin_sqlite._modidx:d
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2022, fastai
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1 @@
1
+ cjm_graph_plugin_sqlite