Commit 6082eb14 authored by Siebers, Michael's avatar Siebers, Michael
Browse files

inlined explanation path into explanation/4 term

The path must be known to generate the desired JSON format.
parent 9d800fd4
......@@ -64,7 +64,7 @@ explain_mock('some_path', 4,
]).
setup_explain_mocks(Path,N,Expected) :-
findall(explanation(Message,Details,References),
findall(explanation(Path,Message,Details,References),
(
between(1, N, Key),
explain_mock(Path,Key,Message,Details,References),
......
......@@ -175,26 +175,34 @@ explain_entity_to_json(Entity,JSON) :-
%
% Generates textual explanations for the irrelevance of a file. Parameters may
% contain the following keys:
% - abs_path (required, atom): The absolute path of the file which's irrelevance shall be explained
% - limit (optional, integer, default: 5): The maximal number of explanations to create.
% - abs_path (required, atom): The absolute path of the file which's
% irrelevance shall be explained
% - limit (optional, integer, default: 5): The maximal number of explanations
% to create.
%
% The Result is a (possibly empty) list of explanation(Message,Details,References)
% terms. In these terms Message is a list which's elements are either strings or
% a term reference(DescribingString,ReferenceID). Details is a list of Message-type
% lists. Finally, References is a list of ref(ReferenceID,ListOfEntity) terms
% where each Entity is given as term entity(NameOfEntity,NameOfProperty).
% NameOfEntity and NameOfProperty are either atom or a string. If there are more
% explanations available than there are in Result More is bound to 'true'. Otherwise,
% More is bound to 'false'.
% The Result is a list of explanation(AbsPath,Message,Details,References) terms.
% The list might be empty. In these terms AbsPath is bound to the absolute path
% of the item which's irrelevance is explained. Message is a list which's
% elements are either strings or a term reference(DescribingString,ReferenceID).
% Details is a list of Message-type lists. Finally, References is a list of
% ref(ReferenceID,ListOfEntity) terms where each Entity is given as term
% entity(NameOfEntity,NameOfProperty). NameOfEntity and NameOfProperty are
% either atom or a string. If there are more explanations available than there
% are in Result, More is bound to 'true'. Otherwise, More is bound to 'false'.
%
% @throws not_irrelevant(AbsPath) If the provided absolut path denotes a file which is not irrelevant. Then, by definition, no explanation may be created.
% @throws not_irrelevant(AbsPath) If the provided absolut path denotes a file
% which is not irrelevant. Then, by definition, no explanation may be
% created.
% @error type_error(dict, Parameters) if Parameters is no dict
% @error existence_error(key, Key, Parameters) if Parameters does not contain the required key Key
% @error existence_error(key, Key, Parameters) if Parameters does not contain
% the required key Key
% @error instantiation_error if any used dict value is unbound
% @error uninstantiation_error(Result|More) if Result or More are bound
% @error type_error(Type, KeyName) if the dict value under KeyName is of a wrong type, expected Type
% @error type_error(Type, KeyName) if the dict value under KeyName is of a wrong
% type, expected Type
% @error unknown_key(KeyName, Dict) if the dict contains an unknown key KeyName
% @error implementation_error(Cause) if generating the explanation itself throws an exception
% @error implementation_error(Cause) if generating the explanation itself throws
% an exception
do_handle_explain(Parameters, Result, More) :-
AbsPath = Parameters.abs_path, % extract absolute path; might throw
% type_error(dict, Parameters) or
......@@ -230,7 +238,7 @@ do_handle_explain(Parameters, Result, More) :-
do_handle_explain_(AbsPath, Limit, Result, More) :-
findnsols(Limit,
explanation(Message, Details, References),
explanation(AbsPath,Message, Details, References),
explanations:explain(irrelevant(AbsPath), Message, Details, References),
Result),
deterministic(OpenChoicePoints),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment