Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "musicbrainz"

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

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.1.10e960daa0e5d4dae25b1cfd8d89be69d9940b3941https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.1.1.tgz
0.1.2eeba90d7ef5853d6b9d35d8272d496b2f6698af21https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.1.2.tgz
0.1.30270e64ab9a2dc138e405c1f4b14b6355eee27ba1https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.1.3.tgz
0.1.40c8901d3de585ba980c70216cc4582aa817d46351https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.1.4.tgz
0.1.5c3bdbef2828b938f43e4c5135ce26a8f86a6c6e01https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.1.5.tgz
0.1.6092a7d645f4f8cdb2c792af4c1cac2428e1aa7171https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.1.6.tgz
0.1.7adaead0deaa60ec6e680fac3c3702996ce22bcc71https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.1.7.tgz
0.1.8d8b4ad8b0535533245b6dc5dd68e76d1886e2dd62https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.1.8.tgz
0.1.9b69584120d20159fc93791da5250e90506c881bb2https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.1.9.tgz
0.2.050926968a00d5d6034066b2a72981b7dbe209e161https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.2.0.tgz
0.3.0089dae37d52f7d52e670ddc1e43880271596c1f42https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.3.0.tgz
0.4.07b75a7861ceafc5fc7427e81f8fbc25c882201d21https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.4.0.tgz
0.4.1b85eb5c672206b72ad0d015051ed28095d54d2db1https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.4.1.tgz
0.5.0a136cef48ef88a3f61b4f73bcce237d8e12fc5721https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.5.0.tgz
0.6.04834189efc1c0211dc34ea1d4e96a73ae57a2c1c1https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.6.0.tgz
0.6.120704088e359437702e652bdff5391155f317fb81https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.6.1.tgz
0.6.2ee0cac636c2e2b05800d2954f76b0036aef8b2e31https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.6.2.tgz
0.6.33dc54f52905050e1784d852e6a19530141b353da1https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.6.3.tgz
0.6.4c1bf61c5b45641e891f9fb5012326b05db90e3631https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.6.4.tgz
0.6.5b77c977edeeeac66677ee8f40ee37b0b0a183d363https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.6.5.tgz
0.6.6d6fd192257e0b97c912fa9047e13228c29e9a3a91https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.6.6.tgz
0.7.094326ffb9d1dfe0f24c5c21f7ce112007eefdfc927https://github.com/samer--/prolog/raw/master/musicbrainz/release/musicbrainz-0.7.0.tgz

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.

Quick start

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)).

Prerequisites

You need the SWI Prolog SGML and HTTP libraries. They are both installed by default when you install SWI Prolog.

Planned enhancements

  • Switch to JSON return format for an easier life.

Changes in v0.7.0

  • ADDED sandbox awareness: lucence predicates are safe, mb_facet/2 is safe, Library users must declare mb_query/4 predicate safe if they wish to allow network access. Higher level predicates should become safe automatically.
  • FIXED inc option parameter checking.
  • CHANGED mb_facet/2 handles more relations and returns them as a term relation/3, where the 3rd argument includes begin/1, end/1, and attribute/1 terms.
  • FIXED mb_facet/2 handling of forward/backward relations.
  • ADDED mb_facet/2 now reports unrecognised relations
  • lookup and browse now accept URIs as well as XML elements or Class-ID pairs.
  • FIXED removed unwanted non-determinism in doc_item/4
  • ADDED new mb_relation/5 as an alternative to mb_facet for getting relations
    • ADDED new facets for birth place, death place, and whether or not an artist is dead.

Changes in v0.6

  • CHANGED mb_browse/3 and 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.
  • CHANGED mb_search/5 to mb_search/4. Thanks to changes in mb_browse and mb_lookup, there is not so much need to deal with Musicbrainz IDs directly, so this has been removed from mb_search.
  • ADDED beginnings of JSON and dict support for planned switch away from XML.

Changes in v0.5

Quite a few changes in this version.

  • ADDED mb_class/2 This extracts the MB class name of an XML entity.
  • CHANGED mb_lookup/3 now accepts options as the second parameter, and instead of accepting the class and ID of an entity as the first two parameters, these are now expected as a pair (Class-ID). Alternatively an XML element returned by a previous query can be used, in which case the class and ID will be extracted.
  • CHANGED inc parameter handling. Instead of accepting a single inc option string as expected by the MBZ server, inclusions are now specified in a more structured way, with validation.

    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.

  • ADDED lots of facets More facets are understood, but the code is starting to get messy. I plan to switch to receiving JSON enceded results from the server, and also change to a more compositional facet definition scheme so that derived facets can be defined in terms of lower-level facets.

Contents of pack "musicbrainz"

Pack contains 5 files holding a total of 44.2K bytes.