|Did you know ...||Search Documentation:|
|Pack musicbrainz -- README|
This package provides access to the Musicbrainz XML web service. See musicbrainz.pl for details. It also provides a language for building Lucene queries, which Musicbrainz uses for doing complex searches. See lucene.pl.
Install this pack. Then load the modules:
Then, simple search returning a 'goodness of match' in Score and an XML element in E, then extracting info from E with mb_facet/2:
?- mb_search(artist,'John Coltrane',Score,E), forall(mb_facet(E,F),(print(F),nl)).
Lucene search for releases with 'trane' in the title but not by anyone with 'coltrane' in the name, using general purpose mb_query/5 to get progress info:
?- mb_query(release,search([trane, -artist:coltrane]),,Prog,E).
Search for artist then browse releases:
?- mb_search(artist,'John Coltrane',_,Artist), mb_browse(release,Artist,E), forall(mb_facet(E,F),(print(F),nl)).
Lucene search for male artist then direct lookup all releases:
?- mb_search(artist,[coltrane, gender:male],_,Artist), mb_lookup(Artist,[inc([releases])],Item), forall(mb_facet(Item,F),(print(F),nl)).
You need the SWI Prolog SGML and HTTP libraries. They are both installed by default when you install SWI Prolog.
mb_query(_,browse(...),...)In line with the changes to mb_lookup/3 in v0.5, browse queries now accept the linked-to entity either as a pair Class-Id or an element returned by a previous query.
Quite a few changes in this version.
Ordinary includes are specified using the
inc(Includes:list(atom)) option, where
Includes is a list of atoms chosen from
[recordings,releases,artists, ...], ie
the standard MBZ API names. These are validated with respect to the kind of entity
Relations to include are specified using the
which accepts a list of MBZ class names. The are checked and translated
by having "-rels" appended.
The "work-level-rels" and "recording-level-rels" includes are specified using the
lrels(LRs:list(oneof([recording,work]))) option, and can only be used when