[Developers] Need an alternative query for topics with date properties

will luo will at metaweb.com
Thu Sep 13 01:53:18 UTC 2007


jack, you can use the "json key aliasing" trick to get the type
names (the list value of "n:type" in this case):

{
   "query":[{
     "/common/topic/image":[{
       "id":null,
       "limit":1,
       "optional":true
     }],
     "/type/reflect/any_value":[{
       "link":{
         "master_property":{
           "name":null,
           "schema":{
             "domain":{
               "id":null,
               "name":null
             },
             "name":null
           }
         }
       },
       "type":"/type/datetime",
       "value":null,
       "value<":"1908",
       "value>=":"1907"
     }],
     "id":null,
     "name":null,
 
"sort":["/type/reflect/any_value.link.master_property.name","/type/reflect/any_value.link.master_property.schema.name"],
     "type":[],
     "type|=":["/film/actor","/tv/tv_actor"],
     "n:type":[{ "name":null }]
   }]
}


Jack Alves wrote:
> I don't get the timeout if I restrict results to specific types but
> then I don't know a way to get the type names instead of the ids:
> 
> {
>   "query":[{
>     "/common/topic/image":[{
>       "id":null,
>       "limit":1,
>       "optional":true
>     }],
>     "/type/reflect/any_value":[{
>       "link":{
>         "master_property":{
>           "name":null,
>           "schema":{
>             "domain":{
>               "id":null,
>               "name":null
>             },
>             "name":null
>           }
>         }
>       },
>       "type":"/type/datetime",
>       "value":null,
>       "value<":"1908",
>       "value>=":"1907"
>     }],
>     "id":null,
>     "name":null,
>     "sort":["/type/reflect/any_value.link.master_property.name","/type/reflect/any_value.link.master_property.schema.name"],
>     "type":[],
>     "type|=":["/film/actor","/tv/tv_actor"]
>   }]
> }
> 
> 
> I also discovered a few great actors were born in 1907.
> 
> 
> On 9/7/07, Jack Alves <jack.alves at gmail.com> wrote:
>> Howdy,
>>
>> I'm still tinkering with a MJT script I wrote awhile ago.
>>
>> www.tigerlight.com/mjt/day_history.html
>>
>> The script shows topics that have a property value matching a specific date.
>> I iterate through the specified years to to get results. I want to add a
>> feature to show topics with dates any day of a specified year. The query
>> times out if I use a date range. Is there another way to accomplish what I
>> want to do?
>>
>>  {
>>  /type/reflect/any_value: [
>>  {
>>  link: {
>>  master_property: {
>>  schema: {
>>  name: null
>>  domain: {
>>  id: null
>>  name: null } }
>>  name: null } }
>>  type: "/type/datetime"
>>  value: null
>>  value>=: "2007"
>>  value<: "2008" } ]
>>  sort: [
>>  "/type/reflect/any_value.link.master_property.name"
>>  "/type/reflect/any_value.link.master_property.schema.name"
>> ]
>>  id: null
>>  name: null
>>  /common/topic/image: [
>>  {
>>  id: null
>>  optional: true
>>  limit: 1 } ]
>>  type: [
>>  {
>>  name: null } ] }
>>
>>
>> Also, I would love to have functionality to query a date like "*-09-07".
>> Interesting topics in freebase go back about 150 years. Iterating through
>> each year is a little slow.
>>
>>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers



More information about the Developers mailing list