4

I would like to develop a Freebase java application that lets you browse Freebase. I thought a good starting point would be to mimic the Freebase Schema Explorer and allow the user of my app to "drill down" through Domains, Types in a Domain, then Instances in a Type. Can someone please assist in how you retrieve a List of domains? Then a list in that domain? etc... The user can then select a domain and i would like to preset a list of types within that domain and so on until they have found the entry or entries they are investigating.

Hector
  • 4,016
  • 21
  • 112
  • 211

1 Answers1

12

MQL for domains:

[{
    "id":   null,
    "name": null,
    "type": "/type/domain",
    "!/freebase/domain_category/domains": {
        "id": "/category/commons"
    }
}]​

The "!/freebase/domain_category/domains" clause in there is to restrict things to just the Commons (official) domains - otherwise you get the domain which is automatically created for every user and probably isn't what you're after.

Types in a domain:

[{
    "id":     null,
    "name":   null,
    "type":   "/type/type",
    "domain": "/cvg"
}]​

Replace "/cvg" as appropriate.

Instances of a type:

[{
    "id":   null,
    "name": null,
    "type": "/cvg/computer_videogame"
}]​

Replace "/cvg/computer_videogame" as appropriate.

This should at least get you started.

Philip Kendall
  • 4,304
  • 1
  • 23
  • 42
  • Philip, thanks very much for taking the time to answer. it doe sexactly what i want. could you point me in th edirection of a good source (tutorial, book, examples) of how i can "Help myself" next time – Hector Jan 24 '12 at 14:56
  • Unfortunately, the Freebase team haven't put much effort into documentation in the past few years. There's a good, but now bitrotted, guide to MQL at http://mql.freebaseapps.com/ Experimentation will get you a long way once you've got your head around MQL, or try asking questions on the freebase-discuss list http://lists.freebase.com/mailman/listinfo/freebase-discuss – Philip Kendall Jan 27 '12 at 19:23
  • Thanks very much, all good suggestions. I will browse the links you have provided. Hopefully i can develop a useful mobile Freebase application based on this. – Hector Jan 28 '12 at 14:54
  • Depending on your requirements you might also want to add the "system" category, so as to get the system domains such as "/common". Just replace `"id": "/category/commons"` with `"id|=": ["/category/system", "/category/commons"]` – Régis Jean-Gilles Aug 08 '14 at 14:31
  • Find related doc in Freebase wiki: http://wiki.freebase.com/wiki/Domains and Test the code in online MQL query editor: https://www.freebase.com/query – Ivan Chau Mar 17 '15 at 06:29