kibi-core 0.20.0 → 0.21.0
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.
- package/package.json +1 -1
- package/src/kb.pl +38 -0
package/package.json
CHANGED
package/src/kb.pl
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
kb_log_relationship_upsert/4,
|
|
39
39
|
kb_relationship/3,
|
|
40
40
|
symbol_owns_requirement/2,
|
|
41
|
+
kb_domain_contradiction_pairs_examined/1,
|
|
41
42
|
scenario_verified_by_test/2,
|
|
42
43
|
requirement_test_fallback_allowed/1,
|
|
43
44
|
test_satisfies_requirement_semantics/2,
|
|
@@ -2717,6 +2718,43 @@ req_conflict_witness(ReqA, ReqB, Witness) :-
|
|
|
2717
2718
|
right: Right
|
|
2718
2719
|
}.
|
|
2719
2720
|
|
|
2721
|
+
%% kb_domain_contradiction_pairs_examined(-Count)
|
|
2722
|
+
% implements REQ-search-answer-hygiene
|
|
2723
|
+
% How many distinct pairs of requirement facts the domain-contradictions
|
|
2724
|
+
% rule compared on the current KB: strict property facts of two current
|
|
2725
|
+
% requirements constraining the same subject and property, predicate facts
|
|
2726
|
+
% of two current requirements with the same namespace, name and ordered
|
|
2727
|
+
% arguments, and decision-predicate facts agreeing on every key argument.
|
|
2728
|
+
% A check that found no contradiction over zero pairs evaluated nothing, and
|
|
2729
|
+
% kb_check says so; the count never implies the pairs are consistent.
|
|
2730
|
+
kb_domain_contradiction_pairs_examined(Count) :-
|
|
2731
|
+
findall(FactA-FactB, domain_contradiction_candidate_pair(FactA, FactB), Pairs0),
|
|
2732
|
+
sort(Pairs0, Pairs),
|
|
2733
|
+
length(Pairs, Count).
|
|
2734
|
+
|
|
2735
|
+
domain_contradiction_candidate_pair(FactA, FactB) :-
|
|
2736
|
+
current_req(ReqA),
|
|
2737
|
+
current_req(ReqB),
|
|
2738
|
+
ReqA @< ReqB,
|
|
2739
|
+
kb_relationship(constrains, ReqA, SubjectFactA),
|
|
2740
|
+
kb_relationship(constrains, ReqB, SubjectFactB),
|
|
2741
|
+
fact_subject_key(SubjectFactA, SubjectKey),
|
|
2742
|
+
fact_subject_key(SubjectFactB, SubjectKey),
|
|
2743
|
+
effective_req_property_fact(ReqA, SubjectKey, FactA, PropertyKey, _, _, _, _, _, _, _, _),
|
|
2744
|
+
effective_req_property_fact(ReqB, SubjectKey, FactB, PropertyKey, _, _, _, _, _, _, _, _),
|
|
2745
|
+
FactA \= FactB.
|
|
2746
|
+
domain_contradiction_candidate_pair(FactA, FactB) :-
|
|
2747
|
+
current_req(ReqA),
|
|
2748
|
+
current_req(ReqB),
|
|
2749
|
+
ReqA @< ReqB,
|
|
2750
|
+
effective_req_predicate(ReqA, FactA, Namespace, Name, Args, _),
|
|
2751
|
+
effective_req_predicate(ReqB, FactB, Namespace, Name, Args, _),
|
|
2752
|
+
FactA \= FactB.
|
|
2753
|
+
domain_contradiction_candidate_pair(FactA, FactB) :-
|
|
2754
|
+
decision_signatures(Signatures),
|
|
2755
|
+
Signatures \== [],
|
|
2756
|
+
decision_conflict_pair(Signatures, _, _, FactA, FactB, _, _, _, _, _, _, _, _).
|
|
2757
|
+
|
|
2720
2758
|
%% decision_conflict_pair(+Signatures, ?ReqA, ?ReqB, -FactA, -FactB, -Namespace, -Name, -ArgsA, -ArgsB, -PolarityA, -PolarityB, -KeyPositions, -DecisionPosition)
|
|
2721
2759
|
% Two decision-predicate facts of current requirements ReqA @< ReqB that
|
|
2722
2760
|
% agree on every key argument. Starts from the bound requirement.
|