kibi-core 0.1.6 → 0.1.7

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 (2) hide show
  1. package/package.json +5 -2
  2. package/src/kb.pl +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-core",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "private": false,
5
5
  "description": "Core Prolog modules and RDF graph logic for Kibi",
6
6
  "type": "module",
@@ -9,7 +9,10 @@
9
9
  "bun": ">=1.0"
10
10
  },
11
11
  "main": "./src/kb.pl",
12
- "files": ["src/**/*.pl", "schema/**/*.pl"],
12
+ "files": [
13
+ "src/**/*.pl",
14
+ "schema/**/*.pl"
15
+ ],
13
16
  "license": "AGPL-3.0-or-later",
14
17
  "author": "Piotr Franczyk",
15
18
  "repository": {
package/src/kb.pl CHANGED
@@ -110,6 +110,16 @@ kb_detach :-
110
110
  ( kb_attached(_Directory)
111
111
  -> (
112
112
  kb_save,
113
+ % Unload RDF graph from memory to prevent duplication on reattach
114
+ ( kb_graph(GraphURI)
115
+ -> rdf_unload_graph(GraphURI)
116
+ ; true
117
+ ),
118
+ % Sync and close audit log
119
+ ( kb_audit_db(AuditLog)
120
+ -> db_sync(AuditLog)
121
+ ; true
122
+ ),
113
123
  % Clear state
114
124
  retractall(kb_attached(_)),
115
125
  retractall(kb_audit_db(_)),
@@ -151,6 +161,8 @@ with_kb_mutex(Goal) :-
151
161
  % Load legacy .pl entity files from the KB directory.
152
162
  % These files use entity/4 format: entity(Type, Id, Title, Props).
153
163
  load_kb_pl_files(Directory) :-
164
+ catch(abolish(entity/4), _, true),
165
+ dynamic(entity/4),
154
166
  retractall(entity(_, _, _, _)),
155
167
  directory_files(Directory, Files),
156
168
  forall(
@@ -692,4 +704,4 @@ changed_symbol_violation(Symbol, MinLinks, Count, File, Line, Col, Name) :-
692
704
  ( changed_symbol_loc(Symbol, FileRaw, Line, Col, NameRaw)
693
705
  -> File = FileRaw, Name = NameRaw
694
706
  ; File = '', Line = 0, Col = 0, Name = ''
695
- ).
707
+ ).