1:- use_module(library(semweb/rdf_db)).
2:- use_module(library(http/html_write)).
3
4:- rdf_register_ns(rss, 'http://purl.org/rss/1.0/').
5:- rdf_register_ns(dc, 'http://purl.org/dc/elements/1.1/').
6
(Resource, Source, Target) :-
8 rdf_load(Source),
9 rdf(Resource, rss:title, literal(Title)),
10 phrase(rss_html_list(Title), TargetHtml),
11 tell(Target),
12 print_html(TargetHtml),
13 told.
14
(ChannelTitle) -->
16 page(\rss_list_head(ChannelTitle),
17 \rss_list_body(ChannelTitle)).
18
(PageTitle) -->
20 html([title([PageTitle])]).
21rss_list_body(Header) -->
22 { findall(Item, rdf(Item, rdf:type, rss:item), Items),
23 sort(Items, Unique)
24 },
25 html([h2(align(center),[Header]),
26 ul(\rss_list_items(Unique))]).
27
([]) -->
29 [].
30rss_list_items([First_item|Rest_of_items]) -->
31 html([li([\list_item_content(First_item)])]),
32 rss_list_items(Rest_of_items).
33
34list_item_content(Item) -->
35 {rdf(Item,dc:description,literal(Description))},
36 html([\rss_link(Item),br([]),Description]).
37
(Item) -->
39 { rdf(Item,rss:link,literal(Link)),
40 rdf(Item,rss:title,literal(Title))
41 },
42 html(i(a(href(Link),Title)))