I’m using: SWI-Prolog version 8.2.0 for x86_64-linux
I have a module with a predicate isa/2
that checks whether word1 is more specific (a direct hyponym of) than word2. For this, I use a prolog format of WordNet (WN). Given that WN can be language-specific, I would like to control from a command line what language WN I am loading.
My issue is that loaded WN facts are not visible from the module. Here is the MWE:
% module file named isa.pl
:- module(isa, [isa/2]).
:- multifile s/6, hyp/2.
% :- dynamic s/6. % makes no difference
% :- dynamic hyp/2.
isa(W1, W2) :-
s(SS1,_,W1,_,_,_), % facts are defined in WNProlog/wn_s
s(SS2,_,W2,_,_,_),
hyp(SS1, SS2). % facts are defined in WNProlog/wn_hyp
isa(dog, animal).
% WordNet wrapper file named wn.pl
:- ensure_loaded([
'WNProlog/wn_hyp',
'WNProlog/wn_s'
]).
Command line behaviour shows that at least s/6
facts are not visible for isa/2
.
swipl wn.pl isa.pl
?- isa(man, person).
false.
?- isa(dog, animal).
true.
?- s(A,_,man,_,_,_), s(B,_,person,_,_,_), hyp(A, B).
A = 110289039,
B = 100007846 ;
false.
When a module directive :- module(isa, [isa/2]).
is removed, isa(man, person)
succeeds.
What is a proper way to load clauses from command line that are accessible from a predefined module?