Extract the names of the named entities using MID in Freebase - freebase

How can I obtain the names from the mids in Freebase? In the following table_row in music/album table we have the following album names(?) provided in mid.
music|artist|name id origin active_start active_end genre label home_page acquire_webpage album contribution track track_contributions concert_tours supporting_artists|Jimmy Johnson /m/01wz6jx Rock music,Jazz fusion,Jazz,Folk rock /m/01wz6kq,/m/01wz6kx,/m/01wz6l8,/m/01wz6kj,/m/01wz6kb,/m/01wz6l2,/m/01wz6lg /m/0fjw1yt,/m/0dt2p4t,/m/0fbpmv2,/m/0ffbzh3,/m/0f7y3jb,/m/0fgb1g1,/m/0dy5n14,/m/0fgn9xv,/m/0dzbwfr,/m/0f6hyd3,/m/0fj70dm,/m/0ff_qzm,/m/0f9_cm4,/m/0f7l2cj,/m/0fkhd4j,/m/0flf7j8,/m/0flr1z_,/m/0fl3c6q,/m/0ffp8g9,/m/0f64lc8,/m/0fgzlz2,/m/0f885wn,/m/0fktd7t,/m/0d_j0p6,/m/0dv915z,/m/0fm0 _t2
If I query Freebase like this: [{
"mid": "/m/01wz6kq",
"name": null
}]​
then I obtain a "null" for name. How can I obtain the names? Are these mids at all pointing to named entities? If I use the freebase website like this: http://www.freebase.com/view/m/01wz6kq then I obtain Contributor: Jimmy Johnson
Album: All Night Wrong meaning that the album name exists.
However, if I use: http://api.freebase.com/api/experimental/topic/standard?id=/m/01wz6kq i.e. the TOPIC API, then the information is "extractable" from the text field. Is this the way to do it? or is there any other easier way?

A better view of this data if you're doing programming is the explore/inspect view:
http://www.freebase.com/inspect/m/01wz6kq
As a matter of fact, it even gives you a little shortcut for building a query. If you click on the arrow to the left of the /music/recording_contribution/album property, you'll get a pre-built query which you can modify to fetch the name instead of the ID:
{
"id": "/m/01wz6kq",
"/music/recording_contribution/album": {
"name": null
}
}​
If you click on the Link button in the Query Editor you'll get an MQLRead link that gives you back JSON you can parse to get the name.
Of course if you were doing this in the program, you'd construct the URL on the fly from a template with the ID of interest inserted.
NOTE: you do not want to be doing anything that references api.freebase.com because that's going away soon. You should be using the googleapis.com endpoint.

This entity has no /type/object/name property
BTW
If you want to extract entity names, there are some properties:
/type/object/name
/common/topic/alias
and wikipedia keys, which need to be processed in some way (replace "_" with space, "&" with "&", "$1234" with some unicode symbol)

Related

Firebase Search Query startAt endAt

I am having a problem when querying for search process with Firebase Rest api. I use the startAt and endAt parameters for the first and last search, but it still doesn't list it.
https://myprojectdemo.firebaseio.com/posts.json?orderBy="title"&startAt="Car"&endAt="Car\uf8ff"&print=pretty
I make a GET request this way.
"-WE2QEYJx8gaOUkOsvWkV": {
"title" : "Red Car",
"category" : "Other"
},
"-WE2KSBJx8gaOUkOsvWkV": {
"title" : "White Car",
"category" : "Other"
}
I have an output like above.
There are two shipments titled White Car and Red Car. When I search for car, I want both of them to come out. Where am I making a mistake?
It looks like what you're trying to do is find strings the end with some substring. You can only search for strings that begin with some substring. Realtime Database does not support substring queries in any other way except for string prefixes.
If you want to be able to search for items that are cars, consider adding another piece of data to each child indicating that it is a car type object, and use that to filter your result set. Using the title as you have it now will not work.

Riak: searchable list of maps (with CRDTs)

I have a use-case which consist in storing several maps under an attribute. It's the equivalent JSON list:
[
{"tel": "+33123456789", "type": "work"},
{"tel": "+33600000000", "type": "mobile"},
{"tel": "+79001234567", "type": "mobile"}
]
Also, I'd like to have it searchable at the object level. For instance:
- search entries that have a mobile number
- search entries that have a mobile number and whose number starts with the string "+7"
Since Riak doesn't support sets of maps (but only sets of registers), I was wondering if there is a trick to achieve it. So far I've had 2 ideas
Map of maps
The idea is to generate (randomly?) keys for the objects, and store each object of the list in a parent map whose keys are the ones generated for this only purpose to have a key.
It seems to me that it doesn't allow to search the object (maps inside the parent map) because Riak Solr search requires the full path to the attribute. One cannot simply write the following Solr query: phone_numbers.*.tel:+7*. Also composed search (eg. search entries that have a mobile number and whose number starts with the string "+7") seem hard to achieve.
Sets with simulated multi-valued attributes
This solution consists in using a set and insert all the values of the object as a single string, with separators between them. Yes, it's a hack. An attribute value would look like: $tel:+79001234567$type:mobile$ with : as the attribute name-value separator and $ as the attribute separator.
Search could be feasible using the * wildcard (ugly, but still), except the problem with escaping the separators: what if the type attribute includes a :? Are they some separators that are accepted by Riak and would not be acceptable in a string (I'm thinking of control characters)?
In a nutshell
I'm looking for a solution whatever the hackiness of it, as long as it works. Any idea is welcome.

Loop in Visual Query (or other solution)

Hello 2sxc / SIC fans!
A little help would be appreciated on that ...
I use JavaScript Kendo UI components to display data in a grid. These data are transcribed in Json in order to benefit from the connection on the data source of a hierarchical grid.
On the one side, I have an "employees" table with their attributes { id, lastName, firstName, email }. On the other hand, I have a list of training "events" { id, date, title, level }.
So, I would like to add the date and title of the last training received into the attributes of each person. So I would like the output Json to be after processing { id, lastName, firstName, email, dateLastTraining, titleLastTraining }.
One solution would be to re-manipulate the Json objects once I retrieve them in Razor but I would like to know if it was possible to do it directly at the source in the Visual Query.
I doubt this can be done because there should be a concept of loop (for each employee, filter the trainings according to the Id, sort them in order of date and take the Top1) and I think that there is no such possibility.
Am I wrong or would there be a solution to do that in Visual Query?
Thanks for your help !
Basically what you want is a kind of join-operation. ATM (2sxc 9.14) this isn't possible in visual query.

Get peoples surnames or christian names from freebase?

Is it possible to get a users first name or surname from a freebase query?
For example, I have a person entry I have the id of, but I just want to extract their first name.
{
"id": "/en/paul_thomas_anderson",
"name" : null
}​
How would I modify this query, its something I've found nothing about by googling or searching here on S.O.? I know this kind of thing is possible in dbpedia for most people entries.
No, it's not possible directly. The name is stored as a single unit. There are topics for given names and surnames (e.g. http://www.freebase.com/view/base/givennames/given_name), so you could split the name and see which list(s) it appears in, but that's indirect and doesn't tell you about the specific person you are querying.

asp.net mvc 2, select content by routing string

I am having trouble to what i should name this in the title field...
Question is. I want to select a blogpost by entering its title, like this:
http://localhost:3254/blog/2010/10/net-programming
The title of the blogpost should be ".net programming". So i have setup a route to look for a year a month and finally a string. But how should i save this in the database to be able to search for it?
Should i add a field, like id, that contains asp-programming? or should i parse the title for every search? or should i convert the title and then convert it back before displaying it to the user?
The standard method is to create a separate column in the database (usually called 'slug' or permalink) that stores the html-friendly name that may be used by Urls. Then, if the title of the post changes you would normally keep the slug the same so that anyone who has bookmarked the link can still find the post. The value us usually defaulted from the blog title, replacing spaces with - and removing any non url friendly characters.
http://en.wikipedia.org/wiki/Slug_%28web_publishing%29
There are two possible solutions I can think of
Create your own Route handler and within its code, search for the actual record in the database
Create an action method in a Controller that accepts a string parameter and call that parameter id (or whatever the default is in your MapRoutes method).

Resources