Finding only exact matches using Freebase api - freebase

I would like to use the Freebase Api to determine if a certain thing refers to an entity (e.g. person, tv show, ...). For instance "how i met your mother" refers to a TV show, "lana del rey" is a singer. However if something is not an entity, I would like to know that as well.
Unfortunately the Freebase search api gives me quite a few false positives for things that are not clear entities, even with the parameter exact=true and prefix=false:
For instance: https://www.googleapis.com/freebase/v1/search?query=girl&exact=true
[
{
"mid": "/m/0ytdbkr",
"name": "Naked girl",
"notable": {
"name": "Film character",
"id": "/film/film_character"
},
"lang": "en",
"score": 5.222793
},
{
"mid": "/m/0y4k26c",
"name": "Sexy girl",
"notable": {
"name": "Film character",
"id": "/film/film_character"
},
"lang": "en",
"score": 4.754522
},
{
"mid": "/m/0yg73tt",
"name": "Call girl",
"notable": {
"name": "Film character",
"id": "/film/film_character"
},
"lang": "en",
"score": 4.567947
},
{
"mid": "/m/0w1sb51",
"name": "Gorgeous girl",
"notable": {
"name": "Film character",
"id": "/film/film_character"
},
"lang": "en",
"score": 4.526981
},
{
"mid": "/m/03p0tvg",
"id": "/user/girl",
"name": "girl",
"lang": "en",
"score": 4.465735
},
{
"mid": "/m/05p197",
"id": "/en/bad_girl_movies",
"name": "Bad girl movies",
"notable": {
"name": "Film genre",
"id": "/film/film_genre"
},
"lang": "en",
"score": 4.464571
},
....
]
}

What's an "exact" match in this context?
If you simply want an exact name & type match, you can get that using the MQLRead API instead of the Freebase Search API. If you're looking for something different, you need to be more specific about what you seek...

Related

Getting the LABEL_DETECTION results from Google Vision API in another language

More specifically I would like to get the labels in french, so instead of:
"labelAnnotations": [
{
"mid": "/m/019sc",
"description": "black",
"score": 0.95744693
},
{
"mid": "/m/07s6nbt",
"description": "text",
"score": 0.9175479
},
{
"mid": "/m/01zbnw",
"description": "screenshot",
"score": 0.8477094
}]
I would like to get:
"labelAnnotations": [
{
"mid": "/m/019sc",
"description": "noir",
"score": 0.95744693
},
{
"mid": "/m/07s6nbt",
"description": "texte",
"score": 0.9175479
},
{
"mid": "/m/01zbnw",
"description": "capture d'écran",
"score": 0.8477094
}]
Or is Google Translate API my only solution currently?
Google Cloud Vision API LABEL_DETECTION are returned in English only. The Cloud Translate API can translate English labels into any of a number of other languages.
Reference Detect Labels

OpenRefine reconciliation service not working - mutliple vs single queries

I have been using OpenRefine 2.6 Beta 1 w/o problems since its release, and later, with the reconciliation service at:
http://reconcile.freebaseapps.com/reconcile
However, in the past fee days, I have not been able to use it all. If I go to the URL:
http://reconcile.freebaseapps.com/
and type the multiple query:
{
"query": "Ford",
"type": "/people/person",
"properties": [
{
"pid": "/people/person/place_of_birth",
"v": "Detroit"
}
]
}
I obtain:
{
"result": [
{
"id": "/m/0j8pb6y",
"name": "Ford",
"type": [
{
"id": "/people/person",
"name": "Person"
},
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/geography/mountaineer",
"name": "Mountaineer"
}
],
"notable": [],
"score": 1.1546246,
"match": false
},
{
"id": "/m/01vd3gv",
"name": "Ford",
"type": [
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/music/artist",
"name": "Musical Artist"
}
],
"notable": [],
"score": 1.0330245999999998,
"match": false
},
{
"id": "/m/0cmdhzt",
"name": "James Meredith",
"type": [
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/people/person",
"name": "Person"
},
{
"id": "/military/military_person",
"name": "Military Person"
},
{
"id": "/people/deceased_person",
"name": "Deceased Person"
}
],
"notable": [],
"score": 0.0681692,
"match": false
}
],
"duration": 369
}
But if I try a simple query:
{
"query": "Ford"
}
I get:
Status: error Error:undefined
Any insights into what's happening with the reconciliation service? Is there any other service I could use to replace freebaseapps.com?
Thanks
Try this in Queries Parameter at http://reconcile.freebaseapps.com/
{
"q0": {
"query": "Ford"
}
}
For some reason, single queries are not accepted in Query Parameter but in Queries Parameter in the format above. I have not tested this in OpenRefine, so you might have to modify it.
I don't know for certain about the date, but Freebase was announced earlier this year as being shutdown by Jun 30, 2015, for some services. Maybe service is intermittent until full shutdown? Sorry, this answer probably doesn't help much.

"OpenID2 for Google accounts is going away on April 20, 2015". Do I need to worry?

I am developing a website by using ASP.NET and I use Oauth feature to register users to my website. I downloaded DontNetOpenOauth from nuget packages for the Visual studio 2013.
Up to now I implemented facebook authentication. I hope to use google authentication as well. But when I go to there website it says that.
"OpenID2 for Google accounts is going away on April 20, 2015."
When I go to detail page of this warning it says
"Some applications and websites use OpenID 2.0 for authentication when you're signing in, and to access data that you've given them permission to access. Starting April 20, 2015, OpenID 2.0 will no longer work for Google Accounts.
If you've seen a warning that's brought you to this page, it means that you're using an application or website with OpenID 2.0 and may be affected by this change. For more information, we recommend you visit that application's help center, or contact its support team."
Here is the link.
https://support.google.com/accounts/answer/6135882
Honest with you guys I am not familiar with this oauth authentication process.
What is this warning message? Do I need to worry about this? Is there any changes should I need to do or any packages should I need to install?
No you don't need to worry, it just means that developers # Stackoverflow will have to change their code a little bit but it should work fine.
EDIT:
You have to change your code from OpenID to OAuth 2 use http://developers.google.com/accounts/docs/OAuth2WebServer with a minimal scope developers.google.com/+/api/oauth#login-scopes which is profile and from that profile you can determine which user is that and log them in
You don't have to save the token returned because you won't be needing it again until the next login which you will be automatically handed the new or same token by Goole
My Advice is to use the ID can be found using this document
{
"kind": "plus#person",
"etag": "\"RqKWnRU4WW46-6W3rWhLR9iFZQM/hGBwxYeYt07li9hNmxa2J7GE_0c\"",
"nickname": "GreYFoX",
"occupation": "Computer Engineer",
"skills": "iOS Developement, Android Developement",
"birthday": "0000-09-20",
"gender": "male",
"emails": [
{
"value": "##^$%#^##gmail.com",
"type": "account"
}
],
"urls": [
{
"value": "http://www.myspace.com/Shereef",
"type": "otherProfile",
"label": "Shereef"
},
{
"value": "http://Shereefz.spaces.live.com",
"type": "otherProfile",
"label": "shereefz"
},
{
"value": "http://www.plaxo.com/profile/showPublic/Shereef",
"type": "otherProfile",
"label": "shereef"
},
{
"value": "http://cid-c74ed9e76d675051.profile.live.com",
"type": "otherProfile",
"label": "#&#$%&##%^$#live.com"
},
{
"value": "http://www.plaxo.com/profile/showPublic/null",
"type": "otherProfile",
"label": "null"
},
{
"value": "http://pulse.yahoo.com/_VMZ2QYN3AWG57HS5IUW4T2KHRM",
"type": "otherProfile",
"label": "Shereef Marzouk"
},
{
"value": "http://about.me/Shereef",
"type": "otherProfile",
"label": "About.me"
},
{
"value": "http://www.youtube.com/user/Shereefz",
"type": "otherProfile",
"label": "Shereef Marzouk"
},
{
"value": "http://www.youtube.com/user/Shereefz",
"type": "otherProfile",
"label": "Shereef Marzouk"
},
{
"value": "http://www.myspace.com/Shereef",
"type": "otherProfile",
"label": "Shereef"
},
{
"value": "http://Shereefz.spaces.live.com",
"type": "otherProfile",
"label": "shereefz"
},
{
"value": "http://profiles.google.com/17F648F7-5C7D-42D4-A40F-CAC12280C712",
"type": "otherProfile",
"label": "SheefoPad"
},
{
"value": "http://www.youtube.com/user/Shereefz",
"type": "otherProfile",
"label": "Shereef Marzouk"
},
{
"value": "http://Shereefz.spaces.live.com",
"type": "otherProfile",
"label": "shereefz"
},
{
"value": "http://www.myspace.com/Shereef",
"type": "otherProfile",
"label": "Shereef"
},
{
"value": "http://profiles.google.com/17F648F7-5C7D-42D4-A40F-CAC12280C712",
"type": "otherProfile",
"label": "SheefoPad"
},
{
"value": "https://profiles.google.com/104183538590490028018/buzz",
"type": "contributor",
"label": "Buzz"
},
{
"value": "https://developers.google.com/groups/chapter/103706763079402130148/",
"type": "contributor",
"label": "GDG Alexandria (Google Developers Group Alexandria)"
},
{
"value": "http://www.shereef.net",
"type": "contributor",
"label": "Shereef"
},
{
"value": "http://shereef.net/resume",
"type": "other",
"label": "Resume"
},
{
"value": "http://shereef.net/blog",
"type": "other",
"label": "Blogger"
},
{
"value": "http://about.me/shereef",
"type": "other",
"label": "About.me"
},
{
"value": "http://pulse.yahoo.com/sheefoz",
"type": "other",
"label": "sheefoz"
},
{
"value": "http://facebook.com/Shereefz",
"type": "other",
"label": "shereefz"
},
{
"value": "http://www.linkedin.com/in/shereef",
"type": "other",
"label": "shereef"
}
],
"objectType": "person",
"id": "104183538590490028018",
"displayName": "Shereef Marzouk",
"name": {
"familyName": "Marzouk",
"givenName": "Shereef"
},
"tagline": "Senior Mobile Developer / Team lead at X Digital Group",
"braggingRights": "XDG Hero",
"aboutMe": "<span>Shereef Marzouk is an Egyptian mobile applications developer who enjoys his work very much, with many years of experience of development in mobile and general development, Shereef also loves helping people and love sharing, He also develops free-lance applications under his personal company name Tools Era (ToolsEra), Shereef is an Egyptian with his own cultural views and politic, Shereef is not your typical Egyptian nor Developer.</span>",
"relationshipStatus": "engaged",
"url": "https://plus.google.com/+ShereefMarzouk",
"image": {
"url": "https://lh3.googleusercontent.com/-P9UMptk6e5U/AAAAAAAAAAI/AAAAAAAFzp0/v3ArGL-l8Tg/photo.jpg?sz=50",
"isDefault": false
},
"organizations": [
{
"name": "Alexandria Higher Institute of Engineering and Technology",
"title": "Computer Engineering",
"type": "school",
"startDate": "2005",
"endDate": "2011",
"primary": false
},
{
"name": "English Lycee Liberity",
"title": "School",
"type": "school",
"startDate": "1994",
"endDate": "2004",
"primary": false
},
{
"name": "Sidi Gaber Language School",
"title": "K.G.",
"type": "school",
"startDate": "1992",
"endDate": "1994",
"primary": false
},
{
"name": "X Digital Group",
"title": "Senior Mobile Developer / Team Lead",
"type": "work",
"startDate": "2012",
"primary": true
},
{
"name": "X Digital Group",
"title": "Interactive Touch Screen and Mobile Core Developer",
"type": "work",
"startDate": "2012",
"endDate": "2013",
"primary": false
},
{
"name": "Health-Insights",
"title": "Android / iOS / C#.NET Developer",
"type": "work",
"startDate": "2011",
"endDate": "2012",
"primary": false
}
],
"placesLived": [
{
"value": "Alexandria, Egypt",
"primary": true
},
{
"value": "KSA"
},
{
"value": "Lybia"
},
{
"value": "Egypt"
},
{
"value": "Qatar"
}
],
"isPlusUser": true,
"language": "en",
"ageRange": {
"min": 21
},
"circledByCount": 707,
"verified": false,
"cover": {
"layout": "banner",
"coverPhoto": {
"url": "https://lh3.googleusercontent.com/-kp8ALVVOa1o/U-Bo2sjE9GI/AAAAAAAFkaA/PWKY2q2e9lY/s630-fcrop64=1,0000208effb2f94e/_MG_0344-SMILE.jpg",
"height": 626,
"width": 940
},
"coverInfo": {
"topImageOffset": -294,
"leftImageOffset": 0
}
}
}
search for "id": "104183538590490028018" in the json i pasted here
P.S. Open all links in this answer because they will benefit you.
Also remember when requesting profile to use the id as me because you won't have the logging in user profile

Controlling output on MQL query -- search by a field, but not output it

I am curious if I can control the results of a query so that it will not display the a particular field in the query. For instance...
query:
[{
"id": null,
"name": null,
"type": "/people/person"
}]
result:
{
"result": [
{
"type": "/people/person",
"id": "/en/jack_abramoff",
"name": "Jack Abramoff"
},
{
"type": "/people/person",
"id": "/en/bob_ney",
"name": "Bob Ney"
},...
I have tried this...
[{
"id": null,
"name": null,
"type": [{
"id": "/people/person",
"limit": 0
}]
}]
Which gives me ...
{
"result": [
{
"type": [],
"id": "/en/jack_abramoff",
"name": "Jack Abramoff"
},
{
"type": [],
"id": "/en/bob_ney",
"name": "Bob Ney"
},...
I am wondering if there is a way to just get this
{
"result": [
{
"id": "/en/jack_abramoff",
"name": "Jack Abramoff"
},
{
"id": "/en/bob_ney",
"name": "Bob Ney"
},...
No, there is no way to do this. Why would you need to do this? Once you parse the JSON data in your application its very easy to just ignore any values that you don't need. The APIs support using gzip compression so you don't have to worry about the response size either. If you're really optimizing for speed you might consider switching to the Search API which looks like this:
https://www.googleapis.com/freebase/v1/search?filter=(all+type:/people/person)

What would the freebase MQL query for this?

I want to find the ceo of IBM. What would be the MQL query for this?
The MQL for this search looks like the following.
This particular instance may be a tat more complicated than necessary because I got it initially produced from a Freebase interactive search and then simply added/improved the filters manually.
I verified it with various company names with relative success, i.e. it works provided that the underlying data is properly codified in Freebase (some companies are missing, for some companies the leadership data is incomplete etc.)
There are a few tricks to this query:
the company name in u0 fitler needs to match precisely the company name as recorded in Freebase. You could use a contains predicate rather than an equal one, but that could introduce many irrelevant hits. For example you need to use "IBM", "Apple Inc.", "General Motors" rather than common alternatives to these names ("International Business Machines", "Apple", "GM"...")
the u1 filter, on the leadership role is expressed in a extensive One of predicate because unfortunately the nomenclature for these roles is relatively loose, with duplicates (e.g. could be CEO or Chief Executive Officer) and with the fact that the role of CEO is often coupled with other corporate roles such as Chairman [of the board] and/or President etc. I hand picked this list by first looking up (in Freebase) the instances of Leadership Roles which contained "CEO" or "Chief Executive".
the u2 filter expresses that the to date should be empty, to select only the person currently in office, as opposed to former CEOs (for which hopefully Freebase recorded the end date of their tenure).
Depending on your application, you may need to test that the query returns one and exactly one record, and adapt accordingly if it doesn't.
Freebase MQL editor is a convenient tool test and edit with this kind of queries.
[
{
"from": null,
"id": null,
"limit": 20,
"organization": {
"id": null,
"name": null,
"optional": true
},
"person": {
"id": null,
"name": null,
"optional": true
},
"role": {
"id": null,
"name": null,
"optional": true
},
"s0:type": [
{
"id": "/organization/leadership",
"link": [
{
"timestamp": [
{
"optional": true,
"type": "/type/datetime",
"value": null
}
],
"type": "/type/link"
}
],
"type": "/type/type"
}
],
"sort": "s0:type.link.timestamp.value",
"title": null,
"to": null,
"type": "/organization/leadership",
"u0:organization": [
{
"id": null,
"name": "IBM",
"type": "/organization/organization"
}
],
"u1:role": [
{
"id": null,
"name|=": ["Chief Executive Officer", "President and CEO", "Chairman and CEO", "Interim CEO", "Interim Chief Executive Officer", "Founder and CEO", "Chairman, President and CEO", "Managing Director and CEO", "Executive Vice President and Chief Operating Officer", "Co-Founder, Chairman and Chief Executive Officer"],
"type": "/organization/role"
}
],
"u2:to": [
{
"value": null,
"optional": "forbidden"
}
]
}
]​
Sample return (for "IBM", specifically)
{
"code": "/api/status/ok",
"result": [{
"from": "2012-01-01",
"id": "/m/09t7b08",
"organization": {
"id": "/en/ibm",
"name": "IBM"
},
"person": {
"id": "/en/virginia_m_rometty",
"name": "Virginia M. Rometty"
},
"role": {
"id": "/en/chairman_president_and_ceo",
"name": "Chairman, President and CEO"
},
"s0:type": [{
"id": "/organization/leadership",
"link": [{
"timestamp": [{
"type": "/type/datetime",
"value": "2010-01-23T08:02:57.0006Z"
}],
"type": "/type/link"
}],
"type": "/type/type"
}],
"title": "Chairman, President and CEO",
"to": null,
"type": "/organization/leadership",
"u0:organization": [{
"id": "/en/ibm",
"name": "IBM",
"type": "/organization/organization"
}],
"u1:role": [{
"id": "/en/chairman_president_and_ceo",
"type": "/organization/role"
}],
"u2:to": []
}

Resources