freebase mql - notable_types empty? - freebase

I am sending the following mql query to get a list of topics, their mids and "notable types", but in the results notable types are always empty.
[{
"name": "The beatles",
"/common/topic/notable_types": [], //also tried "null"
"mid": null,
"limit": 10
}]
But this is inconsistent with the online freebase. For example, the query returns
{
"mid": "/m/07c0j",
"/common/topic/notable_types": [],
"name": "The Beatles"
},
And by checking the webpage "http://www.freebase.com/m/07c0j" you can see it has a notable type of "music artist".
Any suggestions if I have used wrong query or anything to do with the freebase database?
Many thanks!

They should really return on error on this query. Notably types isn't available through the MQL API -- only the Topic API.

Related

Why does Freebase think that all wineries lack official websites?

I’m trying to query for wine producers and their websites on Freebase with this query:
[{
  "/common/topic/official_website": [],
  "id": null,
  "name": null,
  "type": "/wine/wine_producer"
}]
Here it is in the Freebase query editor:
http://www.freebase.com/query?lang=%2Flang%2Fen&q=%5B%7B%22%2Fcommon%2Ftopic%2Fofficial_website%22%3A%5B%5D%2C%22id%22%3Anull%2C%22name%22%3Anull%2C%22type%22%3A%22%2Fwine%2Fwine_producer%22%7D%5D
Why do none of the vineyards have official websites? That seems like a unlikely coincidence. Also, none of the other properties of included types have non-null values.
How do I tell Freebase to obtain the properties of included types in addition to the ones on the wine producer type itself?
False premise. 185 of them do have values for the official web site:
[{
"/common/topic/official_website": [{
"value": null
}],
"id": null,
"name": null,
"type": "/wine/wine_producer",
"return": "count"
}]
You need to forget about the notion of included types for anything related to MQL querying. MQL doesn't know and doesn't care.

Return notable_for in mql

My code:
[{
"id": null,
"name": null,
"/common/topic/alias": [],
"/common/topic/notable_for": [],
"limit": 100,
"type": "/sports/sport"
}]
Link
"/common/topic/alias" is returned fine however notable_for is always empty. I also tried: null, [{}], {} and /common/notable_for which gives a schema error.
How can I return the notable_for value per instance in the /sports/sport example above?
The notable_for data is computed separately from other facts in Freebase and is not accessible from the MQL API. It is however available from the Search API, the Topic API and the RDF data dumps.
Search API:
https://www.googleapis.com/freebase/v1/search?filter=(all+type:/sports/sport)&output=(/common/topic/alias)
Topic API:
https://www.googleapis.com/freebase/v1/topic/m/071k0

Freebase Obtain All Information On One Subject

I'm trying to find the best way to get the information displayed on a Freebase page via a MQL query.
I've tried the topic API but that includes a lot of metadata.
I've also tried using links/reflection as in:
{
"id": "/en/samsung_electronics",
"/type/reflect/any_master": [{
"link": {
"master_property": null
},
"name": null,
"id": null
}],
"/type/reflect/any_reverse": [{
"link": {
"master_property": null
},
"name": null,
"id": null
}],
"/type/reflect/any_value": [{
"link": {
"master_property": null
},
"value": null
}]
}
But that means I'll be missing some information, such as the number of employees because that's given as a "Dated Integer" which, of course, doesn't get automatically expanded and I won't know what I would have to expand in general. My best attempts at expanding all objects by nesting that query once in itself were met with a
"code": 503,
"message": "Backend Error"
In RDF/SPARQL (e.g. DBpedia) I'd just do select ?p ?o where {URI ?p ?o} and select ?s ?p where {?s ?p URI}, am I missing such a simple way to do this in Freebase?
So to summarize, I'm looking for a way to get the information on a Freebase HTML page with as little overhead as possible and without missing anything.
The Topic API was designed specifically for this use case (and is what's used to construct the Freebase HTML page). It takes a filter parameter which can be used to tailor its output to include only parts of the schema which are of interest. What metadata is getting in your way? Why can't you just skip it?
If you'd prefer to use SPARQL, there's an RDF dump available that you could load in your own triple store and query with SPARQL.

Relate two entities using properties in Freebase

I want to find out how Wenjin SU and Jimei University are related in Freebase. I have found out the Wenjin SU has a type /business/board_member/which has property/business/board_member/leader_of. How can I use this information in an Freebase MQL to extract the term or mid of Jimei University?
If you go to the Freebase page for Wenjin SU you see that he has the type /business/board_member/ and under that section it lists him as the /business/board_member/leader_of Jimei University
The first thing you should do is go to the Query Editor and create a skeleton MQL query for that relationship:
{
"id": "/m/0sxhm9v",
"name": null,
"/business/board_member/leader_of": [{}]
}
When you run this query you get the following result:
{
"result": {
"name": "Wenjin SU",
"/business/board_member/leader_of": [{
"name": null,
"type": [
"/organization/leadership"
],
"id": "/m/0sxhm9s"
}],
"id": "/m/0sxhm9v"
}
}
This is not quite what you were asking for. It's saying that he is the leader_of an un-named topic /m/0sxhm9s. Now, if you visit the Freebase page for that topic you'll see that its a mediator node that connects a person and their role to an organization for a specific date range. You'll also notice that Jimei University is listed as the /organization/leadership/organization on this page.
We can now add this mediated property to our MQL query to get the full relationship that you're looking for:
{
"id": "/m/0sxhm9v",
"name": null,
"/business/board_member/leader_of": [{
"/organization/leadership/organization": {
}
}]
}
If you're building an application that has a pre-determined set of relationships like this then you can use this process of exploring the Freebase data to build MQL queries for those relationships. If you're looking to find any arbitrary connection between any two entities in Freebase then you'll need to download the Freebase Data Dumps and run a shortest path algorithm over the entire graph.

freebase - topic description/articles

I'm trying to retrieve the topic description for some film ("/film/film") and film genres ("film/film_genre") in italian language.
I think the problem is the same in both cases, so I post the MQL query that I'm trying to run for the film genre description:
Mql query
[{
"type": "/film/film_genre",
"name": "Film culto",
"/common/topic/article": [{
"id": null
}]
}]
Response
{
"result": [{
"type": "/film/film_genre",
"name": "Film culto",
"/common/topic/article": [{
"id": "/m/01q0d"
}]
}]
}
With the article ID received ("/m/01q0d"), I would use the "trans/wrap" service (http://api.freebase.com/api/trans/raw/m/01q0d). However, even though I use the query parameter "lang=it", the article is in English... :(
Any suggestions? I'm going crazy :D
Freebase contains non-English names, but it doesn't, for the most part, contain descriptions in anything other than English. You could use the Topic API and get the /common/topic/topic_equivalent_webpage for the Italian Wikipedia to fetch the article/description from there, but that's probably the closest you'll get.
https://www.googleapis.com/freebase/v1/topic/m/01q03
And, as Phil said, the api.freebase.com is going away in a matter of days, so you need to be using the new APIs.

Resources