kibi-core 0.1.7 → 0.1.8

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 +1 -1
  2. package/src/kb.pl +15 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-core",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "private": false,
5
5
  "description": "Core Prolog modules and RDF graph logic for Kibi",
6
6
  "type": "module",
package/src/kb.pl CHANGED
@@ -270,9 +270,21 @@ convert_legacy_prop(Prop, Prop, true).
270
270
  kb_entities_by_source(SourcePath, Ids) :-
271
271
  findall(Id,
272
272
  (kb_entity(Id, _Type, Props),
273
- memberchk(source-S, Props),
274
- sub_atom(S, _, _, _, SourcePath)),
275
- Ids).
273
+ memberchk(source=RawSource, Props),
274
+ source_value_atom(RawSource, SourceAtom),
275
+ sub_atom(SourceAtom, _, _, _, SourcePath)),
276
+ RawIds),
277
+ sort(RawIds, Ids).
278
+
279
+ source_value_atom(Value, Atom) :-
280
+ ( atom(Value)
281
+ -> Atom = Value
282
+ ; string(Value)
283
+ -> atom_string(Atom, Value)
284
+ ; Value = ^^(Inner, _)
285
+ -> source_value_atom(Inner, Atom)
286
+ ; term_string(Value, Atom)
287
+ ).
276
288
 
277
289
  %% kb_assert_relationship(+Type, +From, +To, +Metadata)
278
290
  % Assert a relationship between two entities with validation.