Re: JSON-LD format for music

On 06/22/2012 02:57 PM, wolfbiter@gmail.com wrote:
> My question is this: Can someone point me in the direction of anyone 
> who's already implementing a json-ld standard for music
> (specifically, songs)? If it doesn't exist, then I would definitely
> like input as to how to go about starting it!

Hi Daniel,

Yves Raimond (cc'd) and Frédérick Giasson have done a /ton/ of work in
this area and you could easily build on top of what they have created -
The Music Ontology. Here's a link to get you started:

http://musicontology.com/

Also, Gregg Kellogg - who is one of the editors and authors of the
JSON-LD spec - was involved with a big music industry initiative to
express music using Linked Data, so he might have some good pointers for
you.

You may also want to check out MusicBrainz, who releases all of their
data in Linked Data form (for free), using the Music Ontology among
other ontologies/vocabularies, - specifically, RDFa page markup. Check out:

http://musicbrainz.org/release/591a8885-6b0c-437c-8546-1a4398f483c2

If you "view source" you can see a bunch of RDFa markup that points out
the data in the page... search for "mo:" and you will see the Music
Ontology markup in the page. You can extract the data in the page by
going here:

http://rdf.greggkellogg.net/distiller?format=turtle&in_fmt=rdfa&uri=http://musicbrainz.org/release/591a8885-6b0c-437c-8546-1a4398f483c2

> I'm looking for something similar to the following (which is modeled 
> after the "What is JSON-LD?" video):
> 
> { "@context" : "http://example.com/sample.jsonld", "@id" :
> "http://example2.com/hotelcalifornia", "title" : "Hotel California", 
> "artist" : "The Eagles", ... }
> 
> But then, what is included by the ellipsis? The genre, track,
> length, and all other normal song identifiers? What about play count,
> rating, etc? 

Much of this is covered by the Music Ontology... you would have to
create a JSON-LD context that would map the simple 'terms' to full
URLs... then you could reference that context in your application and
make your music player a full-blown Linked Data music player. Here's an
outline of how you'd do it. The JSON-LD context file would look
something like this:

{
  "@context": {
    "mo": "http://purl.org/ontology/mo/",
    "dc": "http://purl.org/dc/terms/",
    "foaf": "http://xmlns.com/foaf/0.1/",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "Track": {
      "@id": "mo:Track"
    },
    "title": {
      "@id": "dc:title",
    },
    "trackNumber": {
      "@id": "mo:track_number",
      "@type": "xsd:positiveInteger"
    },
    "duration": {
      "@id": "mo:duration",
      "@type": "xsd:duration"
    },
    "publicationOf": {
      "@id": "mo:publication_of",
      "@type": "@id"
    },
    "maker": {
      "@id": "foaf:maker",
      "@type": "@id"
    },
    ... and so on
  }
}

Then you could use the context above like so in a JSON-LD document:

{
  "@context": "http://mysite.com/myMusicAppContext.jsonld",
  "@type": "Track",
  "title": "Paparazzi",
  "trackNumber": 3,
  "duration": "PT3M28S",
  "publicationOf":
"http://musicbrainz.org/recording/7a1040dc-bac0-479c-9921-f43797ed0b81#_",
  "maker":
"http://musicbrainz.org/artist/650e7db6-b795-4eb5-a702-5ea2fc46c848#_",
  ... and so on
}

The data above matches what the following page publishes as HTML+RDFa, btw:

http://musicbrainz.org/release/591a8885-6b0c-437c-8546-1a4398f483c2

> It seems like those would be a good basis, and i would
> assume that users could create their own categories within this same
> context. It almost has to be extensible in that way, so users can
> write programs based off their own notation.

This is easy with JSON-LD... your users would just do this:

{
  "@context": [
    "http://mysite.com/myMusicAppContext.jsonld",
    "http://extensionsite.com/myMusicAppExtension.jsonld"
  ],
  ...
}

Note that the first context is loaded, then the second one. Any term
defined in the second one overrides terms defined in the first one -
last declared wins.

> For example, someone could write a program that cares about
> particular places in songs - say, the beginning of the chorus.  The
> program could use some sort of notation to mark a location in the
> song in a way that both computers and humans can understand. Going
> with the theme above, the program would then only need to add to the
> sample's metadata a line like:
> 
> "chorus" : ["127.03", "180.45"]

Yep, easy to do in JSON-LD.

> wherein the values are the timestamps (in seconds) of the sample (to 
> which this particular data is attached) when the chorus begins.  I 
> would need to address the conflict when two different programs use
> the same name "chorus", and it is my understanding that use of
> json-ld would be appropriate.

Yes, you can prefix the app name to differentiate which "chorus" you
mean, like so:

{
  ...,
  "app1:chorus": ["127.03", "180.45"],
  "app2:chorus": "Best Chorusss Evarrr!"
}

or you could use two different terms:

{
  ...,
  "chorusTimestamps": ["127.03", "180.45"],
  "chorusTitle": "Best Chorusss Evarrr!"
}

JSON-LD is very flexible in this respect. Hope this helps, keep asking
questions if you have more. :)

-- manu

-- 
Manu Sporny (skype: msporny, twitter: manusporny)
Founder/CEO - Digital Bazaar, Inc.
blog: PaySwarm Website for Developers Launched
http://digitalbazaar.com/2012/02/22/new-payswarm-alpha/

Received on Monday, 25 June 2012 01:35:29 UTC