Freebase
Start typing to get some suggestions
  • Explore
  • Use
  • Build
  • Developers

        Discussions on The Complete Metaweb Query Language (MQL) Reference Guide

        The Complete Metaweb Query Language (MQL) Reference Guide » Discuss

        Start a New Discussion

        Discussion will be posted in:

        • The Complete Metaweb Query Language (MQL) Reference Guide
        • Developing Applications

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

        • General Support,
        • Developer Support
        1.  

          sort by random

          5 posts, latest post: doconnor, Aug 3, 2009
          Link to discussion
          1. Mar 28, 2008
            divideby0 says:

            is there any way to retrieve a random item in list of items?  I often run into scenarios where i want to test a random series of (valid) us addresses against my business rules.  it would be great if i could so something like this:

             {

              "query" : [
            {
            "citytown" : null,
            "limit" : 10,
            "sort" : random,
            "state_province_region" : null,
            "street_address" : null,
            "type" : "/location/mailing_address"
            }
            ]

             

            1. cheunger Metaweb Staff
              Apr 1, 2008
              cheunger says:

              Currently there is no way to have MQL return a random set of items.  You might want to post this as an enhancement request here.

            2. dorjeduck
              Jun 6, 2008
              dorjeduck says:

              Good morning all.

              Has a random feature become manifest in the meantime or is is on the agenda?

              Cheers

               martin

            3. efi
              Mar 19, 2009
              efi says:

              Hi.

              Are there any news about random selection?

              I could imagine some pseudo-randomization that would work by sorting the items by guid and introducing a "guid > random guid" condition. With really huge ammount of data there should practically always be 10 elements returning at "limit":10

              But before I try that out I'd like to hear if there has been any progress on random set queries in MQL.

              Best Regards

              Thomas 

            4. doconnor Top Contributor Freebase Experts
              Aug 3, 2009
              doconnor says:

              +1 to random sorting!

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        2.  

          Limit and offset

          9 posts, latest post: willmoffat, Apr 23, 2009
          Link to discussion
          1. Aug 4, 2008
            rishav says:

            I figured enough that you can use "limit" reserved to get the first few results of a query,

             say for some query

               "limit" : 5

             this fetches the first five , 

            how do I fetch the next 5

            1. crism Metaweb Staff
              Aug 4, 2008
              crism says:
              You use cursors. Ask for cursor:null in your first query. It will come back with a token filled in; pass that back to get the next set of results and a new cursor.
            2. Sep 11, 2008
              maccaday says:

              Can you explain this a little further, please?  I tried the query :

               {
                "cursor" : null,
                "limit" : 5,
                "name" : null,
                "type" : "/music/artist"
              }

               

              and I got an error saying that cursor was a reserved word.

               

              Thanks

            3. Sep 11, 2008
              maccaday says:
              Wouldn't using the 'offset' reserved word be a more elegant (and intuitive for those with experience in databases) method of implementing this?
            4. crism Metaweb Staff
              Sep 11, 2008
              crism says:

              Sorry; the cursor needs to go in the query envelope, not the query itself. See §4.7 of the API doc:

              {

                "cursor":null,

                "query" : {

                  "limit" : 5,

                  "name" : null,

                  "type" : "/music/artist"

                }

              }

              The cursor is not the same as offset; we don’t currently have arbitrary offset support. The cursor must be sent back to the server to get the next page of results; a query can’t yet skip forward an arbitrary number of results.

            5. Apr 22, 2009
              marco79 says:

              Hi,

              I'd like to use the cursors to paginate my result but I haven't found any good documentation/example about how to use them... The parameter I need are the convential 'page' and 'per_page',

              for 'per_page' parameter I'm using use 'limit',

              How can I use the cursor to fetch the right offset of result?

            6. skud Metaweb Staff
              Apr 22, 2009
              skud says:

              Marco: paginated results is a future feature which a lot of people have been asking for.  I believe it requires changes to our underlying graph database (we do not use an RDBMS, it's something completely different).  When it's done and released, you can bet we'll be publicising the fact broadly, so stay tuned.  For now, cursors are the only way to handle this.

            7. Apr 23, 2009
              marco79 says:

              Thanks Skud for your fast replay!

              Could you please show me an example or give me a link to a tutorial about how to handle this using cursors?

              thanks!

            8. willmoffat Metaweb Staff
              Apr 23, 2009
              willmoffat says:

              Hi Macro79, recently our graph database got support for pages.

              You just need to use the 'page' and 'limit' keywords in your mql query, here's the first page:

              http://api.freebase.com/api/service/mqlread?query={"page":0,"query":[{"name":null,"type":"/music/artist","limit":5}]}

              The new Query Editor supports pages in the 'envelope' options: http://www.freebase.com/app/queryeditor

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        3.  

          Get data from 2 contents

          2 posts, latest post: crism, Mar 24, 2009
          Link to discussion
          1. Mar 24, 2009
            srnar says:

            Hi,

            I'm new in MQL. I try to get list of countries sorted by population. I came from the Vietnamese restaurant query which is working:

            [
              {
              "/business/business_location/address" : {
              "citytown" : null,
              "state_province_region" : null
              },
              "cuisine" : "Vietnamese",
              "name" : null,
              "type" : "/dining/restaurant"
              }
            ]

            Modified query gives me surprisingly an error (not mentioned the sorting issue):

            [
              {
              "/location/statistical_region" : {
              "population" : null
              },
              "name" : null,
              "sort" : "name",
              "type" : "/location/country"
              }
            ]
             

            Any help is appreciated

            Robert 

            1. crism Metaweb Staff
              Mar 24, 2009
              crism says:

              The problem with your query is that you are looking for a country that has a statistical region that has a population. That is not what you want. You want a country which, when considered as a statistical region, has a population. Or more succinctly, you want a country with a population.

              When treating a topic with more than one type, you often need to use the fully-qualified property names. You were on the right track, but rather than using a subordinate object, you just wanted a longer string. Consider:

              [{"name":null,"type":"/location/country", /location/statistical_region/population":[{"number":null,"year":null}]}]

              That will get you the populations. Note also that we have to delve into the population, since it actually has a number and a year, not just a number.

              You can sort by any property present in the response, and use periods to nest. To sort by the population number, you’ll want to sort the populations for a specific country first, then sort the countries by their highest populations:

              [{"name":null,"type":"/location/country", /location/statistical_region/population":[{"number":null,"year":null,"sort":"-number"}],"sort":"-/location/statistical_region/population.number"}]

              That will sort the way you want. You will find that former countries show up in that list; you may want to constrain the years for the population counts.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        4.  

          Can someone please fix the typography and layout of this page

          3 posts, latest post: philg, Sep 11, 2008
          Link to discussion
          1. obie
            Aug 13, 2008
            obie says:
            Dense, hard-to-understand material is made doubly difficult to read and process by lousy typography. The way that headers and lists are smooshed into each other on this page makes it very difficult to understand.
            1. cheunger Metaweb Staff
              Aug 13, 2008
              cheunger says:
              Thanks for letting us know - I have heard that it was a bug in this release and will be fixed in the next one.
            2. philg Metaweb Staff
              Sep 11, 2008
              philg says:
              This is a problem caused by an update in the CSS used to layout the page, and some faulty mark-up in the original file. We hope to have this all fixed in the next couple weeks when the new version of the manual is posted.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        5.  

          c# example

          also posted to
          • philg
          3 posts, latest post: philg, Sep 11, 2008
          Link to discussion
          1. weblivz
            Aug 19, 2008
            weblivz says:

            As there is not one above, i created a C# version here :

            http://tinyurl.com/6y6hea

            If anyone knows a good place to put it please do so. New to this so don't wanna edit the description of the article!

            1. skud Metaweb Staff
              Aug 29, 2008
              skud says:
              Thanks, weblivz!  Probably the best place to put this is under Application Developer Tips, but I'm copying our docs guy, Phil, on this so he can help you out.
            2. philg Metaweb Staff
              Sep 11, 2008
              philg says:
              Hey there, sorry it took so long, I was on vacation when you posted this. I've added the code to our Application Developer Tips and will add it to the full manual when the next version goes live in a couple weeks.

          Discussion is posted in:

          • close philg
          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        6.  

          * doesn't appear to process a single word as stated

          6 posts, latest post: philg, Sep 11, 2008
          Link to discussion
          1. Sep 11, 2008
            maccaday says:
            In the documentation it says that * matches a single word, but when I ran the queries for band names with two / three names, the lists were the same.  The number of *'s and spaces didn't seem to make a difference to the search.
            1. crism Metaweb Staff
              Sep 11, 2008
              crism says:
              Good catch, thanks. I filed a bug with our doc team on that.
            2. philg Metaweb Staff
              Sep 11, 2008
              philg says:
              HI Maccaday, can you tell me what the query was, and what results were returned? * matches any single word, so "I * you" matches both "I love you" and "I hate you." So, depending on the query, it's possible to get the kind of results you describe, but I'd need to see the query and the results before I can figure out what's going on.
            3. philg Metaweb Staff
              Sep 11, 2008
              philg says:
              Hey Maccaday, can you provide both the query you were using and the results? * can be used to match any single word, so "I * you" will return both "I love you" and "I hate you," so it's possible to get the kind of results you describe, depending on what the query was. Send that info on and I'll try to figure out what's up and, if necessary, correct the docs.
            4. philg Metaweb Staff
              Sep 11, 2008
              philg says:
              Further investigation has revealed some genuine wonkiness in the use of the single * as a wildcard; as soon as we track down what's really happening we'll try to fix the functionality and the documentation as well. Stay tuned, but please do send me that query so we can have a test case to work with.
            5. philg Metaweb Staff
              Sep 11, 2008
              philg says:

              Hey Maccaday, I found something in the new, updated version of the MQL manual that we'll be publishing soon that may explain your problem. If you're trying to use the wildcard for phrase matching, where you want word order respected and the wildcard to stand-in for one word, you need to use escaped quotes around the phrase. So, instead of:

              {
                "name" : null,
                "name~=" : "I * you",
                "type" : "/music/track"
              }

              you would need to use the following query to get all track names that contain the phrase "I * you" :

              {
                "name" : null,
                "name~=" : "\"I * you\"",
                "type" : "/music/track"
              }

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        7.  

          bidirectional links

          2 posts, latest post: crism, Jun 17, 2008
          Link to discussion
          1. vtalwar Metaweb Staff
            Jun 17, 2008
            vtalwar says:

            "One of the fundamental aspects of Metaweb is that all links between nodes are bi-directional."

            Is this really true? There are properties that have no reverse property defined, and are in effect unidirectional.

            These can be found with the following query:

            [
              {
                "id" : null,
                "limit" : 10,
                "reverse_property" : {
                  "id" : null,
                  "optional" : "forbidden"
                },
                "type" : "/type/property"
              }
            ]

            1. crism Metaweb Staff
              Jun 17, 2008
              crism says:

              All links are truly bidirectional. The client may not show them, but that is not the same thing. The Explore view (change view to tools/explore in the URL, or hit F8 to expose the tool bar at the bottom of the page) shows all incoming and outgoing links. Non-reciprocated properties can also be accessed in MQL using the ! operator:

              {
                "!/music/release/artist" : [
                  {
                    "name" : null
                  }
                ],
                "id" : "/en/the_beatles"
              }

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        8.  

          Howto forbid a property from existing

          1 post, latest post: dwiel, Jun 12, 2008
          Link to discussion
          1. dwiel Metaweb Staff
            Jun 12, 2008
            dwiel says:

            something which is not documented here is that "optional" : "forbidden" can be used to require that nothing like that object exist.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        9.  

          Retrieivng data for multiple guid's with a single equery

          also posted to
          • Developing Applications
          3 posts, latest post: biosopher, Jun 11, 2008
          Link to discussion
          1. Jun 10, 2008
            biosopher says:

            I need to obtain data across multiple guid's within a single query.  E.g. this simple query gets the name for a single guid.  Is there a way to pass in multiple IDs to get back information on each?  I.e. I don't want to perform 100's of individual queries.

             

            {

              "id" : "/guid/9202a8c04000641f800000000023907a",

              "name" : null,

            }

            Thanks,
            biosopher

            1. gmackenz Metaweb Staff
              Jun 10, 2008
              gmackenz says:

              Your excellent question here (and also on the Query Builder page) might already be answered in the archives of the App developers mail list (linked to on the App page). In fact I know the question about getting the description was answered recently on one of our two mail lists.

            2. Jun 11, 2008
              biosopher says:

              Thanks for the pointer gmackenz.  I was searching for the wrong terms and getting zero results.  You pointed me in the right direction:

               

              http://www.freebase.com/api/trans/raw/guid/9202a8c04000641f80000000001170a3
              http://www.freebase.com/api/trans/blurb/guid/9202a8c04000641f80000000001170a3
              http://www.freebase.com/api/trans/blurb/guid/9202a8c04000641f800000000038e04d?maxlength=300

              As discussed in detail here 

              http://markmail.org/message/fot76nyzeprvsgly#query:+page:1+mid:hkzgwbs6pbznui4w+state:results
              http://markmail.org/message/fot76nyzeprvsgly#query:freebase.com%20API%2Ftrans+page:1+mid:balofou7axzv53vr+state:results

              Thanks,
              biosopher 

               

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide
          • close Developing Applications

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

          • General Support,
          • Developer Support
        10.  

          Fetching Content with trans

          1 post, latest post: amsterdamharu, Jun 8, 2008
          Link to discussion
          1. Jun 8, 2008
            amsterdamharu says:

            section 4.8 states "The trans service does not support a callback parameter as the mqlread service does", this is outdated since the api states it can and it can:

            http://www.freebase.com/view/guid/9202a8c04000641f8000000007628edf

            The trans example could use some improvement too since it is digging out "unrelated" documents from the store. It would be more informative and more consistent to get documents on the band "the police"

            Query to get guid's for articles and images
            {
              "article" : [
                {
                  "guid" : [
                    {}
                  ],
                  "id" : null
                }
              ],
              "id" : "/en/the_police",
              "image" : [
                {
                  "guid" : [
                    {}
                  ],
                  "id" : null
                }
              ],
              "type" : "/common/topic"
            }

            Query to get the article (function foo can format result without using a proxy):
            http://www.freebase.com/api/trans/raw/guid/9202a8c04000641f800000000006df25?callback=foo

            Query to get the image (you can use this as the source property of the image element)
            http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000003c18713?maxwidth=300&maxheight=300
            Note: you cannot make an image bigger than the origional with maxwith and maxheight

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        11.  

          Writing Weblink

          2 posts, latest post: jeff, Jun 3, 2008
          Link to discussion
          1. jamslevy
            May 31, 2008
            jamslevy says:

            It looks like it isn't possible to use the write service to create weblinks, as it's outside the schema. But maybe I'm wrong.

             If we want to establish a link for an object, am I correct in guessing that the schema would need to incorporate a link property?

            1. jeff Metaweb Staff
              Jun 3, 2008
              jeff says:

              The type /common/topic has a property "webpage" that you can use.  All topics should include /common/topic as one of the types (although it won't be listed explicitly on the page) -- it's what gives them the images, weblinks, description, and "also known as" properties.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        12.  

          MQL query for instance count

          4 posts, latest post: cheunger, Jun 2, 2008
          Link to discussion
          1. May 31, 2008
            amanshakya says:

            Helo,

            I am trying to write an MQL to count the number of instances of a given type but not being able to figure out. Can anyone help please? 

            1. cheunger Metaweb Staff
              Jun 1, 2008
              cheunger says:

              {

               "type" : "/type/type_name",

               "return" : "count"

              }

              I tried to find the documentation for this, but I wasn't able to.  We're in the process of cleaning up the documenation, and I am sure will be included.

            2. Jun 1, 2008
              amanshakya says:

              Thanks a lot  cheunger. That was of great help.

            3. cheunger Metaweb Staff
              Jun 2, 2008
              cheunger says:

              No problem!  One thing though... the query may time out on types with a large number of instances.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        13.  

          Clarification required - relationship between namespaces and domains

          1 post, latest post: willmoffat, May 29, 2008
          Link to discussion
          1. willmoffat Metaweb Staff
            May 29, 2008
            willmoffat says:

            Section 2.4. Domains states that "domain objects are also instances of /type/namespace," which enforce id uniqueness.

            But that doesn't seem to be true as there are only 8 domains co-typed as namespace:  (and 19,000+ domains that aren't).

            Is it true that domains behave like namespaces (without needing to be co-typed)? I did a quick test and it seems like they enforce unqiue ids just like namespaces.

             I think it would be helpful to clarify exactly what are the differences between domains and namespaces.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        14.  

          Finding user defined types

          also posted to
          • Developing Applications
          1 post, latest post: amanshakya, May 28, 2008
          Link to discussion
          1. May 28, 2008
            amanshakya says:

            Helo all,

             I am trying to analyze user define types in freebase - types defined the users in their default domains or user defined domains, not yet promoted to the standard freebase domains. I have been trying to make up an MQL for that but it doesn't seem to be easy (as I cannot do pattern matching on the "id"). Any ideas?

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide
          • close Developing Applications

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

          • General Support,
          • Developer Support
        15.  

          query editor

          1 post, latest post: dorjeduck, Apr 26, 2008
          Link to discussion
          1. dorjeduck
            Apr 26, 2008
            dorjeduck says:

            Good morning freebaser,

            I just began to dive into freebase API - the query editor is invaluable, makes it so easy to get started. Congrats .... 

            cheers 

            martin

             

            ps An Actionscript example would be handy ;-) 

             

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        16.  

          Making a category list

          also posted to
          • Developing Applications
          2 posts, latest post: faye, Apr 16, 2008
          Link to discussion
          1. Apr 16, 2008
            zodiac7 says:

            I'm writing a small app on FreeBase.
            I'm trying to build a category tree which shows the main categories (sports, arts & crafts, etc.) and lets the user drill down to additional sub categories.
            Is there something like this already built which I can use?

            I notice that I can get a list of the categories for "Sports" like this:

            { "query" : [ { "domains" : [ { "id" : null, "name" : null, "type" : "/type/domain" } ], "name" : "Sports", "type" : "/freebase/domain_category" } ]}

            but I can't figure out how to get a list of categories under "Sports/Basketball"

            1. faye Metaweb Staff
              Apr 16, 2008
              faye says:

              Sports is a "domain category", which has a list of domains (via a property). Sports/Basketball (id: /Basketball) is a domain, and when you say a "list of categories" in that domain, you're referring to the types in that domain. So, the query to look up types in a specific domain by id /Basketball is:

              {
              "query" : [
              {
              "id" : "/basketball",
              "type" : "/type/domain",
              "types" : [
              {
              "id" : null,
              "name" : null,
              "type" : "/type/type"
              }
              ]
              }
              ]
              }

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide
          • close Developing Applications

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

          • General Support,
          • Developer Support
        17.  

          Errata

          4 posts, latest post: nix, Mar 25, 2008
          Link to discussion
          1. willmoffat Metaweb Staff
            Mar 14, 2008
            willmoffat says:

            If you spot a mistake in the mqlwrite docs then please reply here.

            1. willmoffat Metaweb Staff
              Mar 14, 2008
              willmoffat says:

              5.1.11. Namespaces

              What if we query the id of a note?
              We get the guids of the notes rather than the fully-qualified names we've just defined.

              This behaviour seems to have changed. I get the fully-quailified names and not the guids as stated above:

                "note":[{"id":"/user/willmoffat/note/C"}
              ... snip ... ]
            2. willmoffat Metaweb Staff
              Mar 14, 2008
              willmoffat says:

              5.1.12.1. Creating Self-Referential Reciprocal Properties

              At the time of this writing, the freebase.com client does not allow us to create reciprocal properties where both ends of the link refer the same type
              This is no longer true.
            3. nix Metaweb Staff
              Mar 25, 2008
              nix says:

              The "creating a domain" section is misleading: the new domain will not have the special permission structure that is usually associated with an instance of /type/domain.  The only way to create that permission is to use a special domain creation entrypoint, which should be documented elsewhere rather than as part of the mqlwrite tutorial.

               

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        18.  

          Don't forget the {query:{}} envelope!

          1 post, latest post: willmoffat, Mar 14, 2008
          Link to discussion
          1. willmoffat Metaweb Staff
            Mar 14, 2008
            willmoffat says:

            If you've just started the tutorial, remember that you can't just copy and paste the examples. You need to add the envelope.

            So, the first example

            {
            "create":"unless_exists",
            ... snip ...
            }

            Becomes

            {"query":
            {
            "create":"unless_exists",
            ... snip ...
            }
            }

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        19.  

          Bug in Example 4.8

          1 post, latest post: erichanson, Jan 25, 2008
          Link to discussion
          1. Jan 25, 2008
            erichanson says:

            There's a bug in Example 4.8.   The line that reads

            "?queries=" + querytext + "&callback;=Metaweb." + callbackName

            should read

            "?queries=" + querytext + "&callback=Metaweb." + callbackName

            (no semicolon)

            Otherwise the callback doesn't get called.

            Eric

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        20.  

          requesting lists with minimum counts

          2 posts, latest post: cheunger, Jan 16, 2008
          Link to discussion
          1. lmz
            Jan 16, 2008
            lmz says:

            Is there any way to require a number of items in a list?  For example, query for all movie actors with 20+ films to their name?

             

            1. cheunger Metaweb Staff
              Jan 16, 2008
              cheunger says:

              Good question - currently, MQL supports constraints on number and datetime properties, but not properties where the expected type is something other than that.  I'll pass your request on to the MQL team.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        21.  

          GET has a URL limit of around 4000 characters

          2 posts, latest post: crism, Jan 15, 2008
          Link to discussion
          1. Jan 14, 2008
            cotton says:

            If you try a GET query that has the URL length go above about 4000 characters, you will get a "Transient Error" from the Freebase API. The API should really return an error of "URL too long, use POST".

             Even though it isn't mentioned, the MQL Read does support POST. I recommend using it instead of GET.

            1. crism Metaweb Staff
              Jan 15, 2008
              crism says:

              We should change the documentation; I have forwarded this suggestion, thanks.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        22.  

          Cursor Lifetime

          2 posts, latest post: cheunger, Jan 11, 2008
          Link to discussion
          1. Jan 10, 2008
            rath says:

            I can't seem to find anything documenting the lifetime of a cursor value returned from the MQL read service.

            Do cursors persist between query sessions? If so, for how long? Could I run a query to obtain some data, save the cursor, and then continue where I left off a few days later?

            Thanks.

            1. cheunger Metaweb Staff
              Jan 11, 2008
              cheunger says:

              Hi rath,

              The short answer is that cursors are stateless. The kinds of things that invalidate cursors are cursor format changes that happen with database software upgrades; but they're safe against time, session ends, or reuse.

              If you're trying to use a cursor, and get a BADCURSOR reply from the server back, and there wasn't a database software upgrade, there are two possible explanations:

              (a) a bug - cursors are complicated and underused, and it's quite possible that you're running into a bug.

              (b) you've changed the query in some small way, so the cursor checksum that encodes the constraint around the cursor as well as the cursor text no longer matches the constraint you're actually submitting along with the cursor.

              If it's an intermittent problem, it's likely (a); if it fails reliably, it's likely (b).

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        23.  

          Perl?

          also posted to
          • Developing Applications
          2 posts, latest post: crism, Jan 11, 2008
          Link to discussion
          1. Jan 11, 2008
            tehmoth says:

            No mention of the WWW::Metaweb Perl Module?

            1. crism Metaweb Staff
              Jan 11, 2008
              crism says:

              No, and I don’t think any other community-created modules are mentioned here either. Someone has added a Python client to the list of Freebase Application instances; you could add WWW::Metaweb there, too.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide
          • close Developing Applications

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

          • General Support,
          • Developer Support
        24.  

          trans service DOES support a callback parameter

          2 posts, latest post: willmoffat, Jan 8, 2008
          Link to discussion
          1. willmoffat Metaweb Staff
            Aug 16, 2007
            willmoffat says:

            Despite what it says in 4.8. Fetching Content with trans, the trans service DOES support a callback parameter. See

            1. willmoffat Metaweb Staff
              Jan 8, 2008
              willmoffat says:

              For some reason my Exhibit A link above has been corrupted.

              Here is a link showing the 'raw' API with a callback param:
              http://www.freebase.com/api/trans/raw/%239202a8c04000641f8000000003c1978c?callback=cb

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        25.  

          Graph data model

          2 posts, latest post: skud, Dec 10, 2007
          Link to discussion
          1. Dec 8, 2007
            thsoft says:

            Hi,
            this graph data model is so general and versatile that it should replace the outdated relational model! Do you know about an existing implementation of this on top of a RDBMS in PHP? Or is the Metaweb backend data access layer available under some licence?

            1. skud Metaweb Staff
              Dec 10, 2007
              skud says:

              Hi thsoft! You probably want to look into RDF and related semantic web technologies. One implementation I recently came across is Mulgara. I don't know much about it except that people were raving about it at a recent conference I attended, and it's meant to be pretty good. It's not in PHP nor does it sit atop an RDBMS, but it is open source software and should be installable on most systems if you want to play with it. If you specifically want a PHP/RDBMS one, hopefully I've given you enough background to help you google for it ;)

              While Freebase's backend is something different again, it can be mapped into RDF for use with applications like Mulgara. I know there are people working on creating a full RDF dump of Freebase for just that sort of purpose. So in theory you could take those RDF dumps and load them into whatever it is that you end up using.

              Best of luck, and let us know how it goes. If you're not already on the freebase developers' mailing list, you might want to join it. That's where most of these conversations usually take place.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        26.  

          language argument

          also posted to
          • Developing Applications
          2 posts, latest post: alecf, Nov 26, 2007
          Link to discussion
          1. Nov 21, 2007
            thsoft says:

            In Chapter 5, it is mentioned that there is an argument for the mqlwrite (possibly mqlread too?) service which specifies the default language for the text values, but it is not documented anywhere. Is there such an argument and if yes, what is its usage?

            1. alecf Metaweb Staff
              Nov 26, 2007
              alecf says:

              Though the infrastructure is there for supporting multiple languages when you specifically ask for values, we haven't yet implemented the full support for being able to specify the language in the query envelope.

              When that is implemented, you'll be able to say something along the lines of:
              {"lang": "/lang/es",
              "query": {"id": "/foo/bar", "name": null}}

              to get the spanish name of /foo/bar

              We'll be sure to make a large announcment when there is significant progress on this front.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide
          • close Developing Applications

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

          • General Support,
          • Developer Support
        27.  

          links to chapters broken

          3 posts, latest post: gmackenz, Nov 21, 2007
          Link to discussion
          1. Nov 21, 2007
            baleksan says:

            Links to chapters detailing Freebase APIs (Chapter 1, etc...) appears to be broken in my browser (Mac/Firefox). Is there any other place on the website where I can get the detailed information about developer APIs for Freebase?

            1. gmackenz Metaweb Staff
              Nov 21, 2007
              gmackenz says:

              Oops! We change the format recently for the URLs of the Help topics and those links weren't updated.

              Until I can get someone to correct the links, this is the index of the complete guide to API building:

              Developing Metaweb-enabled Web Applications


            2. gmackenz Metaweb Staff
              Nov 21, 2007
              gmackenz says:

              Fixed, was easier than expected to edit. All links should work correctly. Be sure to refresh the page/browser cache if the links still result in error pages for you.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        28.  

          Broken Link

          2 posts, latest post: jnutting512, Oct 26, 2007
          Link to discussion
          1. jnutting512
            Oct 26, 2007
            jnutting512 says:

            The "Chapter 4" link in this article appears to be broken.

            1. jnutting512
              Oct 26, 2007
              jnutting512 says:

              Oops sorry. I just figured out which "Chapter 4" it was referring to. No worries. I know you have bigger fish to fry than to worry about every little link on the site. ;-)

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        29.  

          incorrect list of examples

          also posted to
          • Developing Applications
          1 post, latest post: ssak, Oct 16, 2007
          Link to discussion
          1. Oct 16, 2007
            ssak says:

            examples A.4 and A.5 are not actually in the appendix.
            example "4.8. metaweb.js: Metaweb queries with script tags" does not exist.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide
          • close Developing Applications

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

          • General Support,
          • Developer Support
        30.  

          3.2.3 Suggested Correction

          2 posts, latest post: jdouglas, Oct 13, 2007
          Link to discussion
          1. lee
            Oct 12, 2007
            lee says:

            In section 3.2.3, and example is given on how to get the ID of an object, more specifically, its guid. However, following along with the example, the online query editor actually returns the full-qualified name (right?), for example: "topic/en/the_police."

            1. jdouglas Metaweb Staff
              Oct 13, 2007
              jdouglas says:

              You are correct that this section is incorrect. We need to correct that. Two issues:

              1) the syntax for guids in the ID field just changed to /guid/9202a8c04000641f800000000006df1b
              2) if there's a human-readable ID for a topic, that we will be returned rather than the guid, so as you pointed out: /topic/en/the_police.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        31.  

          No Fig 1.2?

          1 post, latest post: danm, Oct 4, 2007
          Link to discussion
          1. danm Metaweb Staff
            Oct 4, 2007
            danm says:

            This has (finally) been fixed. Sorry for the long delay...

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        32.  

          Searchable?

          also posted to
          • Developing Applications
          2 posts, latest post: jdouglas, Sep 24, 2007
          Link to discussion
          1. mikelove Top Contributor
            Sep 22, 2007
            mikelove says:

            Can you make the API searchable here?

            1. jdouglas Metaweb Staff
              Sep 24, 2007
              jdouglas says:

              Good point. I'll look into it.

              Just as an FYI, we are also working on a different approach to producing API reference documentation that should help us keep it in better sync with what's actually in production. I know that's been an issue.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide
          • close Developing Applications

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

          • General Support,
          • Developer Support
        33.  

          PDF file

          also posted to
          • Developing Applications
          2 posts, latest post: danm, Sep 13, 2007
          Link to discussion
          1. ptomblin
            Sep 13, 2007
            ptomblin says:

            Can somebody please update the PDF file? I downloaded it to read and discovered it was obsolete.

            1. danm Metaweb Staff
              Sep 13, 2007
              danm says:

              We should probably remove the link for now. We changed the way we're maintaining this content and don't have an up-to-date XML representation of the contents anymore. We're going to try to create a single unified view of all the chapters, but this may be a few weeks out.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide
          • close Developing Applications

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

          • General Support,
          • Developer Support
        34.  

          No Fig 1.2?

          1 post, latest post: robertm, Aug 20, 2007
          Link to discussion
          1. Aug 20, 2007
            robertm says:

            Fig 1.2 does not appear in my browser (Firefox 2.0.0.6) - just its alt text.

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support
        35.  

          help for a simple piece of mqlwrite

          2 posts, latest post: vtalwar, Jul 15, 2007
          Link to discussion
          1. Jul 15, 2007
            dsp13 says:

            Suppose I'd like to set George Eliot's gender to 'Female'. I can find an id for her, and another for her gender, with a read query: {"query":{ "gender":[{ "id":null }], "id":null, "key":"George_Eliot", "type":"/people/person" }} But I can't work out how to use this to write her gender in.

            1. vtalwar Metaweb Staff
              Jul 15, 2007
              vtalwar says:

              { "query":{ "gender":{ "connect":"update", "id":"#9202a8c04000641f8000000000017b14" }, "id":"#9202a8c04000641f800000000001b3f3", "type":"/people/person" } }

          Discussion is posted in:

          • close The Complete Metaweb Query Language (MQL) Reference Guide

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

          • General Support,
          • Developer Support

        Search Discussions

        Related Discussions

        • philg
        • Developing Applications
        ©2009  Metaweb
        • Page History
        • RDF
        • Feedback
        • Attribution Policy
        • Terms of Service
        • About Us
        • Jobs
        • Freebase Blog
        Freebase contains information on:
        • Arts & Entertainment
        • Products & Services
        • Science & Technology
        • Society
        • Special Interests
        • Sports
        • Time & Space
        Dev Tools
        Refresh cache | Query Editor | Normal view | Explore | Explore2 | Admin view | View transaction log | Suggest transaction log | Client transaction log | hide (F8) | debug-level
        TID(s):
        Controller: 1.494s
        Template: 0.538s
        Cost: br=82.0, cc=1.22, ch=0.0, cm=0.0, cm+h=0.0, cr=0.0, cs=94.0, cw=90.0, dr=21911.0, dt=2.082, dw=0.0, gqr=0.0, in=14213.0, ir=271.0, iw=0.0, lh=0.0, lm=1.0, lr=1.0, mcs=0.008, mcu=0.403, mr=90.0, nivcsw=293.0, nreqs=99.0, nvcsw=233.0, pf=0.0, pr=0.0, stime=0.028, te=0.197, tf=0.75, tg=0.696, tm=1.088, tr=0.15, ts=0.0, tu=0.148, utime=1.192, va=63921.0