[Developers] Limiting mql results by count

Warren Harris warren at metaweb.com
Tue Apr 21 04:34:20 UTC 2009


Interesting... we were just discussing at Metaweb today the need to  
constrain by count. I'm sorry to say that the only way to do this  
currently is to have mql return the counts and filter the results on  
the receiving end. For a large set of potential results, you could  
sorting the results by count, and then use a cursor (or the new "page"  
envelop parameter) to iterate through chunks of them until your  
maximum count is exceeded.

Warren


On Apr 20, 2009, at 7:18 PM, James Taylor wrote:

> Hi,
> I'm wondering if anyone knows how to limit results by properties  
> that return a specific number of results.  For example, I want to  
> find all of the 'science_or_technology_company' topics that have  
> 0,1,or 2 'develops_treatments_for_disease' properties.
>
> Using the count directive, I'm able to find out how many such  
> properties exist for each topic:
>
> [
>   {
>     "/base/bioventurist/science_or_technology_company/ 
> develops_treatments_for_disease" : [
>       {
>         "count" : null,
>         "name" : null
>       }
>     ],
>     "guid" : null,
>     "name" : null,
>     "type" : "/base/bioventurist/science_or_technology_company"
>   }
> ]
>
> However, trying to use the count to limit results does not seem to  
> work:
>
> [
>   {
>     "/base/bioventurist/science_or_technology_company/ 
> develops_treatments_for_disease" : [
>       {
>         "count" : 1,
>         "name" : null
>       }
>     ],
>     "guid" : null,
>     "name" : null,
>     "type" : "/base/bioventurist/science_or_technology_company"
>   }
> ]
>
> Returns the error message:         "message" : "'count' directive  
> must be null",
>
> Thanks in advance!
> -JT
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers



More information about the Developers mailing list