Did you know ... | Search Documentation: |
Packs (add-ons) for SWI-Prolog |
Title: | Musicbrainz client library |
---|---|
Rating: | Not rated. Create the first rating! |
Latest version: | 0.7.0 |
SHA1 sum: | 94326ffb9d1dfe0f24c5c21f7ce112007eefdfc9 |
Author: | Samer Abdallah <s.abdallah@ucl.ac.uk> |
Download URL: | https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.7.0.tgz |
Requires: | dcgutils |
No reviews. Create the first review!.
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:
?- use_module(library(musicbrainz)).
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
being retrieved.
Relations to include are specified using the rels(Rels:list(mb_class))
option,
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
querying releases.
Pack contains 5 files holding a total of 44.2K bytes.