Recording Relationships

Hi, I can see on the recording page the relationships that I need:

recording

But when I query with ws and include recording-rels, I don’t get them all

https://musicbrainz.org/ws/2/recording/73008554-ec01-48d7-96fc-e76a75024201?inc=aliases+artist-credits+releases+recording-rels

I’m after:

producer:
violin:
orchestra:

All the entries on the web page under “Relationships

Thanks in advance

With recording-rels you are including relationships to other recording. For the additional ones you listed you must also include artist-rels and instrument-rels.

2 Likes

Thanks for a quick reply.

With this

https://musicbrainz.org/ws/2/recording/73008554-ec01-48d7-96fc-e76a75024201/?inc=artists+releases+isrcs+recording-rels+artist-rels+instrument-rels

Got the “violin” but still missing the others

producer
orchestra
recording engineer
editor
recorded at
recording of

I tried adding all rels but still missing the elements.

This page has the recording details that I’m looking for, hope there is a way to get them all.

Producer, orchestra, recording engineer (the relationship is just called “recording”) and editor are all in your link.

For the location you need to include place-rel, for the work relationship work-rels. The following link inudes all from your list:

https://musicbrainz.org/ws/2/recording/73008554-ec01-48d7-96fc-e76a75024201/?inc=artists+releases+isrcs+recording-rels+artist-rels+instrument-rels+work-rels+place-rels

2 Likes

Thanks again, still few missing or under tags or attributes that are not the same as on the page.

“producer” - all good
<relation type="producer" type-id="5c0ceac3-feb4-41f0-868d-dc06f6e27fc0">

“orchestra” - under different attribute, not what I want, need just “orchestra”
<relation type="performing orchestra" type-id="3b6616c5-88ba-4341-b4ee-81ce1e6d7ebb">

“recording engineer” - under diff attribute, does not match the page
<disambiguation>classical producer/engineer</disambiguation>

“recorded at” all good
<relation type="recorded at" type-id="ad462279-14b0-4180-9b58-571d0eef7c51">

“editor” - all good
<relation type="editor" type-id="40dff87a-e475-4aa6-b615-9935b564d756">

Am I’m expecting too much ? This pages are created from all kind of queries and subqueries, but still would like to have ws returning all the Relationships with attributes as on the page.

For example, where does “orchestra” comes from for Brecon Baroque - MusicBrainz. There are no aliases, no tags. How did the “orchesta” ended up on the page ?

Thanks for looking into it.

The correct relation ship types are

<relation type="performing orchestra" type-id="3b6616c5-88ba-4341-b4ee-81ce1e6d7ebb">
<relation type="recording" type-id="a01ee869-80a8-45ef-9447-c59e91aa7926">

These are exactly the relationships you see on the website for the recording, there are not other hidden ones. The type and type-id are the internal name and identifier to identify those relationships, you use them in your code to find the proper relationship. Those also do not change.

The display name used to present those relationships on the website are independent of those. What you see on the website are translatable labels meant for humans to read.

That’s done by the recording to artist relationship. When you edit that recording you can link it to an artist which represents the performing orchestra.

grafik

In the webservice you see this as:

<relation type="performing orchestra" type-id="3b6616c5-88ba-4341-b4ee-81ce1e6d7ebb">
    <target>3a120c40-daf2-4f7f-9999-05039ce6c429</target>
    <direction>backward</direction>
    <begin>2017-10-09</begin>
    <end>2017-10-12</end>
    <ended>true</ended>
    <artist id="3a120c40-daf2-4f7f-9999-05039ce6c429">
        <name>Brecon Baroque</name>
        <sort-name>Brecon Baroque</sort-name>
        <disambiguation>Rachael Podger's ensemble</disambiguation>
    </artist>
</relation>
4 Likes

Thanks again for detail explanation, what I was missing was the concept of labels, I thought they could be returned by the webservice. Since relationship types should not change, I can easily add my own labels, probably more consistent also.

One more question, if you don’t mind. Given the following recording:

How do I get “composer:”, no matter what the label is.
I tried work-rels, and any other rels, but it did not work.

To get the composer you need to have both work-level-rels and artist-rels as inc parameters.

By default only relationships for the entity you are querying are included, so in your case only relationships defined for the recording. But composer is defined for the work. The work-level-rels parameter makes the query also return relationships defined for the work.

But again it will only return the relationships to entities you define as inc parameters. A composer is an artist, so you need artist-rels.

1 Like

Using Recording did not return Vivaldi

https://musicbrainz.org/ws/2/recording/73008554-ec01-48d7-96fc-e76a75024201?inc=work-level-rels+artist-rels

but when using related work it did, with a nice attribute of a “composer”, so it’s just another call required

https://musicbrainz.org/ws/2/work/3f62d0d8-8ccd-31ab-bfca-768a1ae5708d?inc=artist-rels

All of this is less than intuitive, takes time getting used to. There is a json structure on the page source that has majority of the data that I need, labelled as you see it on page, tempting to just scrap the page…

I really appreciate your support. I’m obviously new to ws calls here and without your help would probably give up.

Sorry, I forgot to mention that you also need the work-rels included, because the works are linked to a recording also. So this will work:

https://musicbrainz.org/ws/2/recording/73008554-ec01-48d7-96fc-e76a75024201?inc=work-level-rels+work-rels+artist-rels

So to get the composer you search the recording for <relation-list target-type="work">, and there you look for a work linked to the recording with the relation type “performance”. This will give you the work, which again will have relationships. Target type “artist” with relation type “composer” is what you are looking for.

If you prefer to work with JSON you can make the WS also return JSON data by appending the fmt=json parameter, e.g.

https://musicbrainz.org/ws/2/recording/73008554-ec01-48d7-96fc-e76a75024201?inc=work-level-rels+work-rels+artist-rels&fmt=json

2 Likes

XML is fine, I find it easier than JSON to navigate and see the tree. I’ve picked Perl XML::LibXML along the way and have no issues extracting data, very well formatted.

When I mentioned scrapping the page for the included JSON, I was after the labels that are used on the page, likes of

  • composer
  • violin
  • conductor

as it appears on a page , nicely organised. I understand all of this can be retrieved with ws, so I will forget about scrapping for now, its like cheating anyway :slight_smile: