kibi-core 0.17.2 → 0.17.3

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/discovery.pl +26 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-core",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "private": false,
5
5
  "description": "Core Prolog modules and RDF graph logic for Kibi",
6
6
  "type": "module",
package/src/discovery.pl CHANGED
@@ -461,6 +461,7 @@ matching_gap_row(TypeFilter, MissingRelationships, PresentRelationships, Tags, S
461
461
  kb_entity(Id, Type, Props),
462
462
  matches_type(TypeFilter, Type),
463
463
  matches_tags(Tags, Props),
464
+ \+ hidden_provenance_stub(Tags, Type, Props),
464
465
  matches_source(SourceFilter, Props),
465
466
  relationships_missing(Id, MissingRelationships),
466
467
  relationships_present(Id, PresentRelationships),
@@ -477,6 +478,22 @@ matching_gap_row(TypeFilter, MissingRelationships, PresentRelationships, Tags, S
477
478
  source: Source
478
479
  }.
479
480
 
481
+ %% provenance_stub_props(+Type, +Props)
482
+ % A bootstrap provider fact that records only where an entry came from
483
+ % (tagged bootstrap:provenance-stub). It is not knowledge: gap rows and
484
+ % type coverage counts leave it out unless the caller asks for the tag.
485
+ % implements REQ-bootstrap-provenance-stubs
486
+ provenance_stub_props(fact, Props) :-
487
+ memberchk(tags=Tags, Props),
488
+ is_list(Tags),
489
+ member(Tag, Tags),
490
+ kb:normalize_term_atom(Tag, 'bootstrap:provenance-stub'),
491
+ !.
492
+
493
+ hidden_provenance_stub(RequestedTags, Type, Props) :-
494
+ \+ memberchk('bootstrap:provenance-stub', RequestedTags),
495
+ provenance_stub_props(Type, Props).
496
+
480
497
  relationships_missing(_Id, []).
481
498
  relationships_missing(Id, [Relationship|Rest]) :-
482
499
  relationship_count(Id, Relationship, 0),
@@ -537,7 +554,8 @@ coverage_rows(type, _Tags, _IncludePassing, _IncludeTransitive, _VerificationSna
537
554
  Pairs),
538
555
  maplist(type_pair_row, Pairs, Rows),
539
556
  length(Rows, Total),
540
- Summary = _{total: Total}.
557
+ aggregate_all(count, provenance_stub_entity(_), StubCount),
558
+ Summary = _{total: Total, provenanceStubs: StubCount}.
541
559
 
542
560
  coverage_rows(req, Tags, IncludePassing, IncludeTransitive, VerificationSnapshot, CheckedAt, MaxAgeSeconds, Rows, Summary) :-
543
561
  !,
@@ -890,10 +908,16 @@ must_priority(Priority) :-
890
908
  downcase_atom(Priority, Lowercase),
891
909
  sub_atom(Lowercase, _, 4, 0, must).
892
910
 
911
+ % Provenance stubs are counted apart (summary.provenanceStubs), never as facts.
912
+ % implements REQ-bootstrap-provenance-stubs
893
913
  type_entity_count(Type, Count) :-
894
- setof(Id, Props^kb_entity(Id, Type, Props), Ids),
914
+ setof(Id, Props^(kb_entity(Id, Type, Props), \+ provenance_stub_props(Type, Props)), Ids),
895
915
  length(Ids, Count).
896
916
 
917
+ provenance_stub_entity(Id) :-
918
+ kb_entity(Id, fact, Props),
919
+ provenance_stub_props(fact, Props).
920
+
897
921
  type_pair_row(Type-Count, _{id: Type, type: Type, count: Count}).
898
922
 
899
923
  bfs_layers(_Frontier, SeenNodes, SeenEdges, _Relationships, _Direction, 0, _MaxNodes, _MaxEdges, SeenNodes, SeenEdges, false) :- !.