atom_feed.pl

new_feed(?Source, -Feed) is det
Read a Feed from Source. Source is one of

This is the first step in working with an Atom or RSS feed. If an RSS feed has multiple channels, only the first channel is considered.

id(+Item, -Id:atom) is det
True if Id is the 'id' of Item. Item can be a feed or an entry. RSS feeds don't have IDs.
author(+Item, -Author) is nondet
True if Author is the 'author' of Item. Item can be a feed or an entry. An author is a compound item. See name/2 for a predicate that works with this item. RSS feeds don't have an author.
content(+Entry, -Content:atom) is semidet
True if Content is the 'content' of Entry. There's currently no way to access the content's type or src attributes.
description(+Entry, -Description:atom) is semidet
True if Entry has a Description. This predicate is peculiar to RSS entries. The RSS spec confounds summary and content into a single 'description' field.
summary(+Entry, -Summary:atom) is semidet
True if Summary is a summary of Entry. Fails if an entry has no summary or the summary violates standards described in the Atom spec (exact copy the entry's title, etc).

It's not possible to reliably extract summaries from RSS entries. That's because summary and content is confounded into a single 'description' element.

title(+Item, -Title:atom) is det
True if Title is the title of Item. Item can be a feed, entry or link.
entry(+Feed, -Entry) is nondet
True if Entry is an entry of Feed. Iterates of the feed's entries on backtracking.
link(+Item, -Link) is nondet
True if Link is a 'link' of Item. Item can be a feed or an entry. Link is a compound item. One typically uses predicates like rel/2 and type/2 to refine which link is desired.

For example, to find the URL to an HTML alternative:

link(Feed, Link),
rel(Link, alternate),
type(Link, text/html),
href(Link, Url).
published(+Entry, -EpochSeconds:float) is semidet
True if Entry was published at time EpochSeconds. EpochSeconds is in the same format as that returned by get_time/1
updated(+Entry, -EpochSeconds:float) is semidet
True if Entry was last updated at time EpochSeconds. EpochSeconds is in the same format as that returned by get_time/1.
email(+Author, -Email:atom) is semidet
True if Name is email of Author.
name(+Author, -Name:atom) is semidet
True if Name is the 'name' of Author. According to the Atom spec, this should be a human readable name. RSS authors have no name, only an email. See email/2.
rel(+Link, -Rel) is det
True if Rel is the relationship between Link and its parent. If the Atom XML doesn't explicitly specify a 'rel', alternate is used instead. That's why this predicate's mode is det.

Because RSS links can't specify a 'rel', we use alternate for them too.

href(+Link, -Href:atom) is det
True if Href is the 'href' attribute of Link.
type(+Link, -MediaType) is semidet
True if Link has type attributed MediaType. MediaType has the form Type/Subtype which allows one to do things like
type(Link, text/_)  % link has a textual type

The Atom spec says that 'type' is optional. If it's missing, this predicate fails. RSS spec says the link points to "the HTML website", so MediaType is always text/html.

Subtype may contain punctuation so remember to quote: application/'atom+xml'.