Performing a bulk match of guids to wikipedia/en_ids

  1.  
    1. I have one hundred wikipedia/en_ids that I want to get the corresponding Freebase guids for.  I could do this one at a time but hoped there was a way to perform a bulk lookup

       

      {

        "/common/topic/article" : [

          {

            "guid" : null

          }

        ],

        "key" : [

          {

            "namespace" : "/wikipedia/en_id",

            "value" : "426702"

          }

        ],

        "name" : null

      }

      Thanks,
      Biosopher

      1. At the very least you can reduce network latency by using the queries parameter to execute multiple queries per http request. See the examples on the mqlread page.

      2. Thanks Willmoffat,


        For anyone looking for a similar solution, here is the answer:

         

        http://www.freebase.com/api/service/mqlread?queries={"q0":{"query":[{"/common/topic/article" : [{"guid" : null}],"key" : [{"namespace":"/wikipedia/en_id","value":"426702"}]}]}, "q1":{"query":[{"/common/topic/article" : [{"guid" : null}],"key" : [{"namespace":"/wikipedia/en_id","value":"38252"}]}]}}


        You can simply keep adding more queries to your URL up to the limit of the URL string length.  Technically...the URL definition does not require a length limit but most servers have a limit around 256-500 chars typically.

        Cheers,
        Biosopher

         


    Discussion is posted in:

    Think this discussion also relates to something else? Cross-post it by adding a new discussion area: