[Developers] any_reverse?

Alec Flett alecf at metaweb.com
Wed Dec 5 18:17:00 UTC 2007


Arthur van Hoff wrote:
>
> I am trying to write a query to find the broadcaster for a podcast 
> without inverting the query. I am guess that I can use "any_reverse", 
> but the query below is not working for me and I can't find a good 
> explanation of how it is supposed to work. Any suggestions on what I 
> might be doing wrong?
>
>  
>
> "query": [{
>
>     "name": "ABC News",
>
>     "type": "/user/cotton/default_domain/podcast",
>
>      "/type/reflect/any_reverse": [{
>
>         "optional":true,
>
>         "name": null,
>
>         "link": {
>
>             "master_property": 
> "/user/cotton/default_domain/broadcaster/broadcasts"
>
>          }
>
>     }]
>
> }]
>
>  
>
> PS: I know there is a back pointer 
> "/user/cotton/default_domain/broadcast/broadcaster" which makes this 
> easy, but I am trying to understand how to do it the hard way.
>
Heh, yeah sometimes the hard way is the only way to go.. sometimes 
programatically the only good way to phrase queries is with 
any_master/any_reverse. You'll see that we do this when viewing the 
properties of a particular topic in the filter view.. here's bill 
clinton's education - Use firebug to find the the any_master phrase in 
the MQL query:

 <http://www.freebase.com/view/filter/education/education?propertyId=%2Fpeople%2Fperson%2Feducation&topicId=%2Ftopic%2Fen%2Fbill_clinton>

You've got the right general idea though, and I think you've got 
any_reverse mixed up with the wrong master_property... so you can either 
use any_master and /user/cotton/default_domain/broadcaster/broadcasts, 
or you can use any_reverse with 
/user/cotton/default_domain/broadcast/broadcaster.

A third option is to phrase your master_property clause as such:

"link": {
      "master_property": {"reverse_property": 
"/user/cotton/default_domain/broadcaster/broadcasts" }}
}

this is saying "give me the reverse property, where the reverse of the 
link is ...broadcaster/broadcasts...

I suspect that any_master is really what you want though..

Alec
>
> ___________________________________________
>
> Arthur van Hoff, CTO Software and Services, Dell-ZING
>
> W: 650-267-2413, F: 650-267-2498, M: 650-283-0842
>
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebase.com/pipermail/developers/attachments/20071205/93d58da7/attachment.htm 


More information about the Developers mailing list