Search code examples
semanticsfreebaseleveldb

Retrieving freebase quad dump type names from id


I'm currently working on a project using the freebase dumps, which I insert assertions into a per-mid ordered LevelDB. My goal is to be able for a given name, like Bob Dylan, to retrieve every types linked to it name.

For example, "Bob Dylan" would correspond to "Musician", "Film Producer" and so on, each corresponding themselves to the types "/music/artist", "/film/producer" etc...

Unfortunatly, if it's rather easy to find out the Bob Dylan mid into the quad dump

/m/bobdylanmid        /common/topic/notable_types   /music/artist
/m/bobdylanmid        /common/topic/notable_types   /film/producer

I'd like to be able to find those types names in various languages now. But I can't find a logical way to retrieve them in the dump.

Any clue please?


Solution

  • I'm not 100% certain, but I don't think the schema is actually in the quad dump. I know it never used to be.

    You'll need to look up the names using a query like this. Unfortunately, the human readable names exist only in English, so you'd need to jump through some more hoops to get other languages. For that you could try something along the lines of this slightly more complicated query

    [{
      "id":   "/music/artist",
      "/freebase/type_profile/equivalent_topic": {
        "name": {
          "lang":  null,
          "value": null
        }
      },
      "name": null
    }]​
    

    It depends on the "equivalent topic" property being filled in, which may not be the case for all types. If you only want a few languages, you could modify the query to return those explicitly ("Musician" has 45 different language variants).