kibi-core 0.17.1 → 0.17.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.
- package/package.json +1 -1
- package/src/checks.pl +27 -8
package/package.json
CHANGED
package/src/checks.pl
CHANGED
|
@@ -2766,7 +2766,7 @@ strict_req_fact_pairing_violation(violation(
|
|
|
2766
2766
|
strict_req_fact_pairing_issue(
|
|
2767
2767
|
ReqId,
|
|
2768
2768
|
Description,
|
|
2769
|
-
"Add a property_value fact via requires_property for the same subject_key, or link requires_predicate to a fact_kind: predicate fact
|
|
2769
|
+
"Add a property_value fact via requires_property for the same subject_key, or link requires_predicate to a fact_kind: predicate fact about that subject_key (its subject argument or its subject_key)"
|
|
2770
2770
|
) :-
|
|
2771
2771
|
kb:current_req(ReqId),
|
|
2772
2772
|
kb_relationship(constrains, ReqId, SubjectFactId),
|
|
@@ -2874,15 +2874,34 @@ strict_req_fact_pairing_fact_kind(FactId, Kind) :-
|
|
|
2874
2874
|
%% strict_req_predicate_grounds_subject(+ReqId, +SubjectKey)
|
|
2875
2875
|
% A requirement that constrains a subject fact may ground its claim through
|
|
2876
2876
|
% requires_predicate instead of requires_property (kb_model's replacementPlan
|
|
2877
|
-
% swaps one for the other). The predicate pairs with the subject when
|
|
2878
|
-
%
|
|
2879
|
-
%
|
|
2880
|
-
%
|
|
2877
|
+
% swaps one for the other). The predicate pairs with the subject when it is
|
|
2878
|
+
% about that subject_key: its own subject_key names it (kb_model sets it for
|
|
2879
|
+
% schemas whose arguments name no subject), or the argument its schema names
|
|
2880
|
+
% `subject` holds it, wherever that argument sits. A predicate without a
|
|
2881
|
+
% project-local schema and without subject_key keeps the catalog convention
|
|
2882
|
+
% of the subject as its first argument.
|
|
2883
|
+
% implements REQ-check-strict-pairing-predicate-grounding-v2
|
|
2881
2884
|
strict_req_predicate_grounds_subject(ReqId, SubjectKey) :-
|
|
2882
|
-
kb:effective_req_predicate(ReqId,
|
|
2883
|
-
|
|
2885
|
+
kb:effective_req_predicate(ReqId, FactId, Namespace, Name, Args, _Polarity),
|
|
2886
|
+
predicate_fact_subject_key(FactId, Namespace, Name, Args, PredicateSubject),
|
|
2887
|
+
PredicateSubject == SubjectKey,
|
|
2884
2888
|
!.
|
|
2885
2889
|
|
|
2890
|
+
%% predicate_fact_subject_key(+FactId, +Namespace, +Name, +Args, -SubjectKey)
|
|
2891
|
+
% The subject a predicate fact is about; at most one answer per fact.
|
|
2892
|
+
predicate_fact_subject_key(FactId, _Namespace, _Name, _Args, SubjectKey) :-
|
|
2893
|
+
kb_entity(FactId, fact, Props),
|
|
2894
|
+
memberchk(subject_key=Raw, Props),
|
|
2895
|
+
!,
|
|
2896
|
+
normalize_term_atom(Raw, SubjectKey).
|
|
2897
|
+
predicate_fact_subject_key(_FactId, Namespace, Name, Args, SubjectKey) :-
|
|
2898
|
+
length(Args, Arity),
|
|
2899
|
+
kb:predicate_schema(_SchemaId, Namespace, Name, Arity, ArgumentNames, _Types),
|
|
2900
|
+
!,
|
|
2901
|
+
nth1(Position, ArgumentNames, subject),
|
|
2902
|
+
nth1(Position, Args, SubjectKey).
|
|
2903
|
+
predicate_fact_subject_key(_FactId, _Namespace, _Name, [SubjectKey|_], SubjectKey).
|
|
2904
|
+
|
|
2886
2905
|
strict_req_fact_pairing_kind_label(legacy, "a legacy fact without fact_kind").
|
|
2887
2906
|
strict_req_fact_pairing_kind_label(Kind, Label) :-
|
|
2888
2907
|
format(string(Label), "a fact_kind=~w fact", [Kind]).
|
|
@@ -2932,7 +2951,7 @@ strict_readiness_issue(
|
|
|
2932
2951
|
strict_readiness_issue(
|
|
2933
2952
|
ReqId,
|
|
2934
2953
|
Description,
|
|
2935
|
-
"Add a matching property_value fact via requires_property for the same subject_key, or link requires_predicate to a predicate fact
|
|
2954
|
+
"Add a matching property_value fact via requires_property for the same subject_key, or link requires_predicate to a predicate fact about that subject_key (its subject argument or its subject_key)"
|
|
2936
2955
|
) :-
|
|
2937
2956
|
kb_entity(ReqId, req, _),
|
|
2938
2957
|
strict_readiness_level(ReqId, Level),
|