1:- module(
2 rdf_download,
3 [
4 rdf_download/1, 5 rdf_download/2, 6 rdf_download/3 7 ]
8).
14:- use_module(library(apply)). 15:- use_module(library(yall)). 16
17:- use_module(library(dict)). 18:- use_module(library(file_ext)). 19:- use_module(library(http_client2)). 20:- use_module(library(rdf_clean)). 21:- use_module(library(rdf_deref)). 22:- use_module(library(rdf_export)). 23:- use_module(library(uri_ext)).
33rdf_download(Uri) :-
34 rdf_download(Uri, _).
35
36
37rdf_download(Uri, File) :-
38 rdf_download(Uri, File, options{}).
39
40
41rdf_download(Uri, File, Options) :-
42 ensure_file_(Uri, File),
43 ( uri_file_is_fresh(Uri, File)
44 -> true
45 ; write_to_file(
46 File,
47 {Uri,Options}/[Out0]>>rdf_deref_uri(Uri, callback_(Out0), Options)
48 )
49 ).
50
51callback_(Out, Site, Tuples1, _) :-
52 convlist(rdf_clean_tuple(Site), Tuples1, Tuples2),
53 maplist(rdf_write_tuple(Out), Tuples2).
54
55ensure_file_(_, File) :-
56 ground(File), !.
57ensure_file_(Uri, File) :-
58 uri_data_file(Uri, data, File)
RDF download
*/