Hey, I get a strange compilation failure with the following code:
:- use_module(library(semweb/rdf11)).
:- rdf_register_prefix(foo, 'https://www.example.com/ontology/foo#').
go :-
A = a,
rdf_assert(foo:A, rdf:type, literal(bar)).
when trying to load this file (say from bar.pl
), SWI-Prolog version 8.3.27 says:
$ swipl bar.pl
ERROR: /.../bar.pl:5:
ERROR: Arguments are not sufficiently instantiated
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.27)
...
?- go.
ERROR: Unknown procedure: go/0 (DWIM could not correct goal)
On the other hand, this works:
:- use_module(library(semweb/rdf11)).
:- rdf_register_prefix(foo, 'https://www.example.com/ontology/foo#').
go :-
A0 = a,
A = foo:A0,
rdf_assert(A, rdf:type, literal(bar)).
If we put the above snippet in foo.pl
it loads successfully:
$ swipl -q foo.pl
?- go.
true.
?- rdf(A, B, C).
A = 'https://www.example.com/ontology/foo#a',
B = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type',
C = "bar"^^'http://www.w3.org/2001/XMLSchema#string'.
I’m not very familiar with the semweb
package, but I was very surprised to see an instantiation error before actually executing any query.
So it seems to me to be some term_expansion/2 gone wrong for the argument of rdf_assert/3, maybe?
I’ve tried to look into rdf_expand/4 from semweb/rdf_prefixes.pl
as an immediate suspect, but decided to reach out for some help from the experts before digging any deeper.
Is this issue known? is the above workaround adequate?
Thanks!