Prolog Program for a recordings database

Posted by RP on Stack Overflow See other posts from Stack Overflow or by RP
Published on 2010-04-04T03:53:13Z Indexed on 2010/04/04 4:03 UTC
Read the original article Hit count: 409

Filed under:
|

I have three types of facts:

album(code, artist, title, date).

songs(code, songlist).

musicians(code, list).

Example:

album(123, 'Rolling Stones', 'Beggars Banquet', 1968).

songs(123, ['Sympathy for the Devil', 'Street Fighting Man']).

musicians(123, [[vocals, 'Mick Jagger'], [guitar, 'Keith Richards', 'Brian Jones']].

I need to create these 4 rules:

together(X,Y) This succeeds if X and Y have played on the same album.

artistchain(X,Y) This succeeds if a chain of albums exists from X to Y; two musicians are linked in the chain by 'together'.

role(X,Y) This succeeds if X had role Y (e.g. guitar) ever.

song(X,Y) This succeeds if artist X recorded song Y.

Any help?

© Stack Overflow or respective owner

Related posts about prolog

Related posts about list