It is funny you mention this right now. A couple of days ago I was trying to scrape a web site; here is a tiny incantation that gets the links inside a page (oversimplified for demonstration):
html_links(Source, Link) :-
load_html(Source, DOM, []),
xpath(DOM, //a, Link).
Now, load_html/3 is documented as:
Availability: :- use_module(library(sgml)).
(can be autoloaded)
And xpath/3 is documented as:
Availability: :- use_module(library(xpath)).
(can be autoloaded)
But if you tried to run this, you get two problems. One, the //
doesn’t seem to be yet defined, so:
?- [scrape].
ERROR: scrape.pl:4:16: Syntax error: Operator expected
true.
Then, if you do load library(xpath), it compiles but you still get:
?- html_links("https://swi-prolog.org", Links).
ERROR: iri_scheme `https' does not exist
Loading library(sgml) does not help. A minimal working example is:
:- use_module(library(http/http_open)).
:- use_module(library(xpath)).
html_links(Source, Link) :-
load_html(Source, DOM, []),
xpath(DOM, //a, Link).
Why can I skip library(http/http_ssl_plugin)? I don’t know that either.
PS: I probably don’t quite understand autoloading.