[Developers] OR operator in query

Dae Park daepark at metaweb.com
Mon Jun 23 19:44:44 UTC 2008


If you want to duplicate the information that shows up on our topic  
page, you will first have to do a "schema query" for each type the  
topic is an instance of then do the "data query" depending on the  
schema of each type, Currently we are going "two plys out" but only  
grabbing "disambiguating" properties:

{
    "id": "/en/the_departed",
    "type": [{
      "id": null,
      "properties": [{
        "id": null,
        "expected_type": {
          "id": null,
          "/freebase/type_hints/mediator": null,
          "properties": [{
            "id": null,
            "/freebase/property_hints/disambiguator": true,
            "expected_type": {
              "id": null,
              "/freebase/type_hints/mediator": {
                "value": true,
                "optional": "forbidden"
              }
            }
          }]
        }
      }]
    }]
}

so if the expected type of a propery is a CVT ("/freebase/type_hints/ 
mediator" == true), then you will want to query for the expected  
type's disambiguating properties ("/freebase/property_hints/ 
disambiguator").


-dae



On Jun 22, 2008, at 10:36 PM, Christian Hirsch wrote:

> ...sorry, accidentally sent too early ;-)
>
> ok, so what I'm doing is to query all "basic" information for any
> topic. By basic I mean roughly all the content (properties) which also
> shows an a topic page in Freebase.
> More precisely, I'm starting with a topic ID (e.g. /en/the_departed)
> and am interested in all related topics (name plus ID) and the type of
> relationship (name plus ID), in the case of a movie this would be for
> example:
>
> - Country of origin (/film/film/country): United States (/en/ 
> united_states)
> - Genres (/film/film/genre): Thriller (/en/thriller)
> - Performances (...):
>   - list of actor / character ...
>
> I am doing all this successfully at the moment but would like to
> improve the performance (I'm using several queries which I guess can
> be combined)
>
> The way you suggested it works great, except that I don't get the
> CVT's. Any suggestions on how to include them somehow in there?
>
> This is the best "improved query" for that purpose so far (no  
> CVT's, though)
>
> {
>   "/type/reflect/any_master" : [
>     {
>       "link" : {
>         "master_property" : {
>           "id" : null,
>           "name" : null
>         },
>         "operation" : "insert",
>         "target" : {
>           "id" : null,
>           "name" : null
>         }
>       }
>     }
>   ],
>   "id" : "/en/the_departed"
> }
>
>
> Cheers,
> Christian
>
>
> On Mon, Jun 23, 2008 at 5:30 PM, Christian Hirsch
> <hirsch.christian at gmail.com> wrote:
>> ok, so what I'm doing is to query all "basic" information for any
>> topic. By basic I mean roughly all the content (properties) which  
>> also
>> shows an a topic page in Freebase.
>> More precisely, I'm starting with a topic ID (e.g. /en/the_departed)
>> and am interested in all related topics (name plus ID) and the  
>> type of
>> relationship (name plus ID), in the case of a movie this would be for
>> example:
>>
>> - Country of origin (/film/film/country): United States (/en/ 
>> united_states)
>> - Genres (/film/film/genre): Thriller (/en/thriller)
>> - Performances (...):
>>
>>
>>
>>
>> On Mon, Jun 23, 2008 at 4:50 PM, John Giannandrea <jg at metaweb.com>  
>> wrote:
>>>
>>> Christian Hirsch wrote:
>>>> Thanks. Can this query also be modified so that it also returns the
>>>> CVT's? In the case of a movie it doesn't for example return the
>>>> starring actors or the awards won.
>>>
>>> You can make the any_master, any_reverse queries two plys out but if
>>> you want the CVTs you need to know more about what the schema is  
>>> to be
>>> able to use it in the reply.   Perhaps it would be useful to know  
>>> what
>>> you are trying to do overall.  If you want all the data about a film
>>> for example why not write the query in terms of film properties?
>>> Reflection is mostly useful when you have no idea what you are
>>> inspecting.
>>>
>>>> Also, could the query be modified so that it additionally  
>>>> returns the
>>>> actual label of the properties?
>>>
>>> Yes, add master_property:{id:null, name:null}
>>>
>>> -jg
>>>
>>> _______________________________________________
>>> Developers mailing list
>>> Developers at freebase.com
>>> http://lists.freebase.com/mailman/listinfo/developers
>>>
>>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers



More information about the Developers mailing list