freebase - get description of person - freebase

I have the following MQL query which successfully returns the record for William Shakespeare.
[{
"/type/object/name": null,
"/type/object/id": "/en/william_shakespeare"
}]​
http://tinyurl.com/cnpma3f
I am trying to get the description attribute. When I add "description": null, I get a 'no description attribute found' error. Yet, looking at the record in freebase, it should be there:
http://www.freebase.com/experimental/topic/standard/en/william_shakespeare

The topic API aggregates results across a number of Freebase services; the descriptions are stored separately from the other data about a topic and you'll have to use the text service to fetch them, rather than MQL directly.
As an aside, you should probably consider changing to the new Freebase APIs; those hosted at (www|api).freebase.com are deprecated and will (allegedly) be turned off in October.

Related

Querying for exact match in Kibana

In my Kibana, when I search my document I need to look for exact match:
In my document I have a field named message.
So If I search (Using Kibana) something like:
message: "Provider replied with error code 2006"
I get all the documents that have one instance of those words.
I would like to have exact match.
I am running Kibana: 5.3.2. and Elasticsearch is 5.3.2
In Elasticsearch are two Types of "Strings".
Keyword:
They are typically used for filtering (Find me all blog posts where status is published), for sorting, and for aggregations. Keyword
fields are only searchable by their exact value.
See the docs
Text
field to index full-text values, such as the body of an email or the description of a product. These fields are analyzed, that is they are passed through an analyzer to convert the string into a list of individual terms before being indexed.
See the docs
Sometimes it is possible to access to the Keyword by adding ".keyword" to your field. So try this one:
message.keyword: "Provider replied with error code 2006"
Otherwise you have to check your mapping and change it to Keyword.

How do I query unique documents from a meteor collection and avoid duplicates?

I have a collection that contains thousands of documents in this form:
{
"_id": "wMRHDpb53RhhjxXj4",
"institution": "uw.edu",
"campus": "seattle",
"quarter": "SUMMER",
"department": "CHEM",
"course": "CHEM321",
"section": "A",
"ISBN": "",
"createdAt": {
"$date": "2017-08-13T18:20:40.923Z"
},
"ilendBooksId": "none",
"ilendbooksId": "none"
}
Each document represents a course at my school.
EDIT: I have multiple documents that share every field except the date created. Based on that, what is the best solution?
I only want one document of each document that may exist of a different course. Can someone please help me? Thank you!
There is a mongo query identifier, called .distinct() that supports retrieving unique entries. So you can e.g. retrieve all possible names of courses without duplicates.
Unfortunately it is only implemented in more recent mongo versions and yet not supported in minimongo (the client side implementation of mongodb in meteor).
If there is progress on that, this answer will be updated. Please comment, if this is deprecated.
However, there is already an open github feature request on that.

Freebase query - 10000 most popular people

I am looking for a way to construct a freebase mql query that will return a list of names of popular ('commonly searched on google') people.
Currently, if I do a simple query like:
{
"type" : "people/person",
"name" : [],
"limit" : 5
}
I get
"Jack Abramoffa"
"Bob Ney"
"David Safavian"
"Kåre Kristiansen"
"Adam Murimuth"
Is there a way to modify the query in a way that will sort the elements by their google search rank, or any other measure of popularity?
You can't do it via MQL, but the Freebase Search API returns topics in ranked fashion. The default scoring algorithm uses how well linked a topic is https://developers.google.com/freebase/v1/search-cookbook#scoring-and-ranking. Google doesn't provide search query popularity rankings through any of the Freebase APIs.

Getting wiki summary in freebase

Here is a tv show query. How do I get the request to pull in the wiki summary?
[{
"id" : "/m/0d68qy",
"name": null
}]​
The topic summary is linked to a topic via the /common/topic/article property. You can retrieve this data in one API call using the new Topic API like this:
https://www.googleapis.com/freebase/v1/topic/m/0d68qy?filter=/common/topic/article

Sorting Order of Freebase MQL Read Service results

I am trying to get a list of items using a list of MIDs
Previously I asked this question Array of Freebase MIDs and sending multiple queries to freebase
So my MQL query looks like this now:
[{
"mid": null,
"name": null,
"topics:mid|=":[
"/m/045c7b",
"/m/0d6lp",
"/m/021ympy",
...
]
}]
Sample MQL Query URL
However, the default order seems to be based on something like index or timestamp. I would like the order of the results to mirror the order the MIDs are listed in the query - is this possible? If so, any hints on what the MQL would look like would be awesome :)
Not possible with MQL - you'll have to do the sorting client-side. For what it's worth, the default order is undefined, so don't rely on it for anything.

Resources