-->

How to get aliases from Freebase?

2019-05-31 04:05发布

问题:

I just want to get from Freebase the different aliases a person can have. My PHP query is :

$query = array(
    array(
        'id' => NULL, 
        'alias' => NULL, 
        'name' => "Barack Obama", 
        'type' => "/people/person"
    )
);

The result is:

Array ( 
    [code] => /api/status/error 
    [messages] => Array ( 
        [0] => Array ( 
            [code] => /api/status/error/mql/type 
            [info] => Array ( 
                [expected_type] => /people/person 
                [property] => alias 
            ) 
            [message] => Type /people/person does not have property alias 
            [path] => 
            [query] => Array (
                [0] => Array (
                    [alias] => 
                    [error_inside] => . 
                    [id] => 
                    [name] => Barack Obama 
                    [type] => /people/person 
                ) 
            ) 
        ) 
    ) 
    [status] => 200 OK 
    [transaction_id] => cache;cache01.p01.sjc1:8101;2012-05-11T16:17:29Z;0082 
)

Can someone help me?

回答1:

The full name of the property is /common/topic/alias. Unless the property belongs to the type you're working with or is a property of /type/object, you need to fully specify it.

You can either change the type to /common/topic (since you don't appear to be using /people/person at all) or change the property to be /common/topic/alias.



标签: php freebase mql