mql

Freebase “Key cursor is a reserved word”

前提是你 提交于 2019-12-10 10:04:41
问题 Following the Freebase docs on Envelope Parameters, running { "cursor":true, "query":[{ "type":"/music/album", "artist":"The Police", "name":null, "limit":10 }] }​ results in error "Key cursor is a reserved word" as @Domenic notes. What's going wrong? Edit 1 So this query without a cursor works but this one doesn't because cursor was a variable name not a string enclosed in quotes. As a user it makes sense to type the broken version of "cursor" because the read parameter type table has both

Array of Freebase MIDs and sending multiple queries to freebase

这一生的挚爱 提交于 2019-12-09 22:59:20
问题 I want to loop through the MySQL results which is an array of Freebase MIDs and I want the output to be the names of the Freebase article! Here's my code: $query = "SELECT `mid` FROM `items`"; $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $mid = $row['mid']; $simple_query = array('name'=> null, 'mid'=>$mid); $q_array = array('q'.$count=>array('query'=>$simple_query)); array_push ($query_array, $q_array ); $count++; } $jsonquerystr = json_encode($query

Freebase search_api and excluding results by specified type

僤鯓⒐⒋嵵緔 提交于 2019-12-08 04:46:38
问题 is anyone know, how to exclude some topics with specified type(s) using search api and mql? For example i'm try to find all topics "Voodoo People", and exclude only those, that have composition and release types, and sort result by score desc: http://tinyurl.com/3tjkb7y. Sorting work perfect, but i can't find functionality for excluding :( I'm try to use mql_filter: http://tinyurl.com/644xkow, but releases still there. And one more question: i see in type_strict param possible values: "all",

Multiple Queries in MQL on Freebase

核能气质少年 提交于 2019-12-08 02:18:24
问题 I am trying to get a list of results from Freebase. I have an array of MIDs. Can someone explain how I would structure the query and pass it to the API in PHP? I'm new to MQL - I can't even seem to get the example to work: $simplequery = array('id'=>'/topic/en/philip_k_dick', '/film/writer/film'=>array()); $jsonquerystr = json_encode($simplequery); // The Freebase API requires a query envelope (which allows you to run multiple queries simultaneously) so we need to wrap our original,

[Freebase]: Finding relationship between nodes

拟墨画扇 提交于 2019-12-07 18:55:02
问题 I am new to Freebase and I have been trying to find relationships between 2 nodes without success. For example, I want to find if there is link between Lewis Hamilton(/en/lewis_hamilton) and Formula One(/en/formula_one), which there is in real life, but I can't seem to find it. I have tried the following MQL codes, alternating IDs as well : 1) [{ "type" : "/type/link", "source" : { "id" : "/en/lewis_hamilton" }, "master_property" : null, "target" : { "id" : "/en/formula_one" }, "target_value"

Is there a hierarchical representation of the Freebase types?

余生长醉 提交于 2019-12-07 04:13:43
问题 For example, if some topic (Ex: Texas) is of type /location/citytown, I also see that there is a type "/location/location" attached to the same topic. In addition, here as the topic is the name of a city or town, it is also by default a general location, right? So, would that conclude if a topic has a type /location/citytown, then it would by default have /location/location also as a type associated with the same topic? In summary, does Freebase have a hierarchical representation of the types

[Freebase]: Finding relationship between nodes

◇◆丶佛笑我妖孽 提交于 2019-12-06 15:48:21
I am new to Freebase and I have been trying to find relationships between 2 nodes without success. For example, I want to find if there is link between Lewis Hamilton(/en/lewis_hamilton) and Formula One(/en/formula_one), which there is in real life, but I can't seem to find it. I have tried the following MQL codes, alternating IDs as well : 1) [{ "type" : "/type/link", "source" : { "id" : "/en/lewis_hamilton" }, "master_property" : null, "target" : { "id" : "/en/formula_one" }, "target_value" : null }] 2) { "id":"/en/lewis_hamilton", "/type/reflect/any_master":[{ "link":null, "name":null }], "

Getting Wikipedia IDs in MQL

随声附和 提交于 2019-12-06 15:31:44
Freebase WEX dumps contain a wpid column corresponding to the page_id from the source MediaWiki database in the freebase_wpid table. This table provides a mapping between Wikipedia numeric article/redirect IDs and Freebase GUIDs (Global Unique IDs). guid use as foreign keys is deprecated by mid for lots of good reasons , but that doesn't change the fact that guids are still used at a system level so I'm going to call mid an accessor from here on. Using the mid accessor is flexible in MQL. One can query using "mid": null and using "mid":[] depending on whether one needs the current mid or every

How to get aliases from Freebase?

半城伤御伤魂 提交于 2019-12-06 14:35:16
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 ) )

Multiple Queries in MQL on Freebase

浪尽此生 提交于 2019-12-06 08:30:11
I am trying to get a list of results from Freebase. I have an array of MIDs. Can someone explain how I would structure the query and pass it to the API in PHP? I'm new to MQL - I can't even seem to get the example to work: $simplequery = array('id'=>'/topic/en/philip_k_dick', '/film/writer/film'=>array()); $jsonquerystr = json_encode($simplequery); // The Freebase API requires a query envelope (which allows you to run multiple queries simultaneously) so we need to wrap our original, simplequery structure in two more arrays before we can pass it to the API: $queryarray = array('q1'=>array(