Skip to content
Snippets Groups Projects
Commit 7fb18fae authored by Eric Würbel's avatar Eric Würbel
Browse files

config management. TODO test

parent e58225ba
No related branches found
No related tags found
No related merge requests found
:- module(config, [
load_config/2
]).
:- use_module(library(yaml)).
%! load_config(+Filename, -Config) is det
%
% Load a configuration file.
load_config(Filename, Config) :-
expand_file_name(Filename, [ExpFilename|_]),
absolute_file_name(ExpFilename, AbsFilename),
yaml_read(AbsFilename, Config),
!
.
load_config(_, nil).
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
:- use_module(generator). :- use_module(generator).
:- use_module(logic). :- use_module(logic).
:- use_module(evidence). :- use_module(evidence).
:- use_module(config).
optspec([ optspec([
[opt(raw), type(boolean), default(false), shortflags([r]), longflags([raw]), [opt(raw), type(boolean), default(false), shortflags([r]), longflags([raw]),
...@@ -54,6 +55,8 @@ go :- ...@@ -54,6 +55,8 @@ go :-
full_evidence_computation(Opts, PosArgs) :- full_evidence_computation(Opts, PosArgs) :-
[BFile, MuFile] = PosArgs, [BFile, MuFile] = PosArgs,
load_config('~/.wbel.cfg', Config),
set_config(Config),
nb_setval(clasppath, '/home/wurbel/local/anaconda3/envs/potassco/bin/clingo'), nb_setval(clasppath, '/home/wurbel/local/anaconda3/envs/potassco/bin/clingo'),
init_form_atom, init_form_atom,
init_subform_atom, init_subform_atom,
...@@ -128,6 +131,20 @@ test_wbel(Beliefs) :- ...@@ -128,6 +131,20 @@ test_wbel(Beliefs) :-
print_beliefs(Beliefs, Assoc) print_beliefs(Beliefs, Assoc)
. .
%! set_config(+Config)
set_config(Config) :-
is_dict(Config),
Config.get(clasppath) = ClaspPath,
nb_setval(clasppath, ClaspPath),
!
.
set_config(_) :-
nb_setval(clasppath, '/home/wurbel/local/anaconda3/envs/potassco/bin/clingo')
.
%! print_raw_beliefs(+Bels) is det %! print_raw_beliefs(+Bels) is det
print_raw_beliefs([]). print_raw_beliefs([]).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment