kibi-core 0.18.1 → 0.18.2

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 +19 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-core",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
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
@@ -513,17 +513,34 @@ hidden_provenance_stub(RequestedTags, Type, Props) :-
513
513
  \+ memberchk('bootstrap:provenance-stub', RequestedTags),
514
514
  provenance_stub_props(Type, Props).
515
515
 
516
+ % A requested missing/present relationship is satisfied by its documented
517
+ % inverse as well (docs/entity-schema.md: `validates` is the inverse edge of
518
+ % `verified_by` for req/scenario <-> test links), so a requirement whose test
519
+ % `validates` it is not a `verified_by` gap. relationshipCounts stay per name.
520
+ % implements REQ-mcp-search-discovery
516
521
  relationships_missing(_Id, []).
517
522
  relationships_missing(Id, [Relationship|Rest]) :-
518
- relationship_count(Id, Relationship, 0),
523
+ linked_relationship_count(Id, Relationship, 0),
519
524
  relationships_missing(Id, Rest).
520
525
 
526
+ % implements REQ-mcp-search-discovery
521
527
  relationships_present(_Id, []).
522
528
  relationships_present(Id, [Relationship|Rest]) :-
523
- relationship_count(Id, Relationship, Count),
529
+ linked_relationship_count(Id, Relationship, Count),
524
530
  Count > 0,
525
531
  relationships_present(Id, Rest).
526
532
 
533
+ inverse_relationship(verified_by, validates).
534
+ inverse_relationship(validates, verified_by).
535
+
536
+ linked_relationship_count(Id, Relationship, Count) :-
537
+ relationship_count(Id, Relationship, Direct),
538
+ ( inverse_relationship(Relationship, Inverse)
539
+ -> relationship_count(Id, Inverse, Reverse)
540
+ ; Reverse = 0
541
+ ),
542
+ Count is Direct + Reverse.
543
+
527
544
  relationship_counts(Id, CountsDict) :-
528
545
  findall(Relationship-Count,
529
546
  (relationship_type(Relationship), relationship_count(Id, Relationship, Count)),