MQL Query Help Required: Getting aliases of episodes from a season MID - freebase

I am trying to capture 351 and their aliases of season - "/m/07mx74h", but when I am using my query it gives only not-null values, while I also need those records which are null. PFA query and let me know how can I get all results for 351 records.
Thanks in advance!
MQL Query:
[{
"id": "/m/07mx74h",
"/tv/tv_series_season/episodes": [{
"limit": 1000,
"mid": null,
"name": null,
"/common/topic/alias": [{
"value": null
}]
}]
}]

I'm not sure I completely understand your question, but if the goal is to also include episodes which don't have an alias, you can use this:
[{
"id": "/m/07mx74h",
"/tv/tv_series_season/episodes": [{
"limit": 1000,
"mid": null,
"name": null,
"/common/topic/alias": []
}]
}]
The inner text value is the default returned, so you don't need the inner curly braces.

Related

Run query on previous result in Freebase

I would like to run a query on a preselected set of topics in freebase.
Specifically, I'd like to find out how many, out of 1000 movies do not have a Netflix ID.
What I tried:
[{
"type": "/film/film",
"mid": null,
"name": null,
"netflix_id": {
"optional": "forbidden",
"return": "count"
},
"limit": 1000,
"return": "count"
}]
This, of course, returns 1000. What I wanted was, to select 1000 movies
[{
"type": "/film/film",
"mid": null,
"name": null,
"limit": 1000,
}]
and then look for objects without netflix_id within this result.
Can anybody help me with that?
Edit:
What I am actually looking for is a kind of statistic: x out of 1000 movies do not have a netflix_id. What I need for this is to select 1000 movies, and within this set look for movies without netflix_id.
For now, I simply looked for all movies without a netflix_id and divided it by the number of all movies. I posted the question nonetheless because I'd generally like to know how to use sub-queries.
The following MQL query:
[{
"type": "/film/film",
"mid": null,
"name": null,
"netflix_id": {
"optional": "forbidden",
"return": "count"
},
"limit": 1000
}]
... returns up to 1000 films that have no netflix_id property set. In other words, what you had was mostly correct, except for that last "return": "count", which was then aggregating the result to a single count.
Edit
Based on the updated explanation/requirement, you can use the following MQL query:
[{
"type": "/film/film",
"mid": null,
"name": null,
"netflix_id": [],
"limit": 1000
}]
... to list up to 1000 films and, if they have a netflix_id, the associated IDs. You can tell whether there are any IDs present by examining the size of the returned "netflix_id" array.

How to get aliase of something in freebase

There is a similar question here but I don't get my answer from there.
Suppose we want to get any other names for MID=m/0220q6 (which is ETH-Zurikh). We want all the aliases for ETHZ which are :
ETHZ
ETH Zürich
Swiss Federal Institute of Technology Zurich
...
Basically everything related to this MID, via "/common/topic/alias".
I tried the following and similar MQL. But it does seem to work. Any idea?
[{
"id": null,
"/common/topic/alias": null,
"type": "/en/eth_zurich"
}]
or
[{
"id": null,
"/common/topic/alias": null,
"mid": "m/0220q6"
}]
Your 2nd query should work except you're missing a / at the start of the MID. It should be:
[{
"id": null,
"/common/topic/alias": [],
"mid": "/m/01dyk8"
}]

How to gather Freebase Aliases for type location/location?

I'd like to pull information (MID and US English name) about all locations in Freebase AND also their Korean names and any Korean aliases via an MQL query. This is as far as I've gotten:
[{
"id": null,
"name": null,
"mid": null,
"type": "/location/location",
"Korean:name": [{
"lang": "/lang/ko",
"value": null
}]
}]
I'm only getting the Korean name, but not any Korean aliases. I don't know how to write a query that outputs properties of 2 different types in the same query. Can you get data about both /location/location AND common/topic/alias for the same entity in the same MQL query/output? Is my approach just wrong here?
Any help appreciated.
When you need to combine properties from many different types you need to use the fully qualified property ID like this:
[{
"id": null,
"name": null,
"mid": null,
"type": "/location/location",
"Korean:name": [{
"lang": "/lang/ko",
"value": null
}],
"/common/topic/alias": [{
"lang": "/lang/ko",
"value": null,
"optional": true
}]
}]
Whenever you use shortened property IDs they are assumed to be in the same type as the type you specify in your query (or /type/object if no type is given). So for example, if you were to use "geolocation" in your query it would be interpreted as "/location/location/geolocation". The only excepts are "id", "name" and "type" which you can use without using the full IDs eg. "/type/object/name".
You'll also note that I made aliases "optional" so that it would return results for locations that don't have any aliases.

Query for all Nobel Peace Prize recipients in Freebase

I want to query all recipients of the Nobel Peace Prize and the date (year) from Freebase. I looked at the site, which shows me all winners, but if I do the query here, I do only get "null" results!
What I have so far:
[{
"id": "/m/05f3q",
"/award/award_category/winners": []
}]
If you look at the schema for the information that you're trying to query, you can see that what you are getting back is actually an Award Honor object which has a schema like this. It's got a bunch of different properties, but it doesn't have any meaningful name which is why it's coming back as null.
Try something more along the lines of the below (add additional properties as needed):
[{
"type": "/award/award_honor",
"award": {
"id": "/m/05f3q"
},
"award_winner": [{
"id": null,
"name": null
}],
"year": null
}]
[{
"id": "/en/nobel_prize_in_economics",
"/award/award_category/winners": [{
"/award/award_honor/award_winner": [],
"/award/award_honor/year": null,
"/award/award_honor/award": null,
"/award/award_honor/honored_for": []
}]
}]
I cannot do it in just one call, so I do the same for "/en/nobel_prize_in_physiology_or_medicine", "/en/nobel_prize_in_chemistry", "/en/nobel_peace_prize", "/en/nobel_prize_in_literature".

List properties of several types in MQL query

Good day!
I want to obtain information about several disasters. So, I ask this query:
[{
"type": "/event/disaster",
"*": null,
"limit": 10
}]
Ok, but I also need /time/event properties such as start_date. I'm trying this:
[{
"type": "/event/disaster",
"type": "/time/event",
"*": null,
"limit": 10
}]
and again got only /event/disaster properties because type : time/event inherently translated to "ns0:type". I've tried also this:
[{
"type": ["/event/disaster", /time/event"],
"*": null,
"limit": 10
}]
but got error. How I should formulate the query?
The MQL property wildcard (*) can only be applied to one type so you'll need to individually list the properties that you want to see like this:
[{
"type": "/event/disaster",
"/time/event/start_date": null,
"*": null,
"limit": 10
}]
Another way to do this would be to use the Search API to specify which property values to return (by type or domain) like this:
?filter=(all type:/event/disaster)
&output=(all:/event/disaster all:/time/event)

Resources