Knowledge base. Part 2. Freebase: make requests to the Google Knowledge Graph

image
More than a year ago, Google announced that from now on in their search is the mysterious Knowledge Network (an official translation of the Knowledge Graph). Perhaps not everyone knows that a significant part of the data Network available for anyone to use and available via well described APIs. This part is the knowledge base Freebase, supported by Google and enthusiasts. In this article, we first a little nuts, and then try to do a few simple queries in MQL.
This article is the second of the knowledge Base. Stay tuned.

the
    the
  • Part 1 — Introduction
  • the
  • Part 2 — Freebase: we make requests to the Google Knowledge Graph
  • the
  • Part 3 — Dbpedia — a kernel of the world of Linked Data
  • the
  • Part 4 — Wikidata — semantic Wikipedia


Google Knowledge Graph from the point of view of an ordinary user


One of the visible manifestations of the Google Knowledge Graph is the information panel that briefly describes the object that you are looking for. They often arise from the search of personalities, a little less — geographical names. They often occur for queries that are specified in English in the English interface, but we will stick to the Russian language where possible.
For example, Roger waters gives the following result:
image

Policythe the links in the infobox and note the URL — it uses the setting stick, the contents of which is some kind of identifier of the form &stick=H4sIAAAAAAAAAONg[VuLQz9U3]<ID>AAAA
When the Knowledge Graph has just appeared, it is possible to demonstrate to the uninitiated street magic, for example, add &stick-parameter from Marilyn Monroe to the request from Stephen king:
image

Now this possibility is covered, and to what she'll give us a better look at something useful. For example, recently there the ability to compare multiple objects with the help of keywords vs:

image

Google promises to add many more Goodies related to smart search and the answers to the questions, and the Knowledge Graph is one of the pillars on which this intelligence is kept. What is especially great for us is the fact that the Graph'a piece of Knowledge is open for anyone to use.

Freebase — GNG subgraph


Let's start with the historical perspective. The company Metaweb began work on his knowledge base in 2005. According to the method of data filling Freebase most like to Dbpedia the lion's share of the knowledge represented in Freebase, the data was from Wikipedia. Difference from Dbpedia was, first, the possibility to correct the entered data manually, and secondly the fact that Freebase did not hesitate, and other data sources. In contrast to the DBpedia team, representatives Metaweb't cared too much about how to publish a scientific article (although recently started, here an interesting list), and priznalisthat the code of the main component, graphd, is unlikely to ever see the light of day.
In 2010, the company Metaweb was bought by Google but, according to the newsletter Freebase, the search giant is not too interfered in the Affairs svezhepriobretennoy team. After the release of the colorful video, which Google tears of the competitors, as pioneer truth through its new intelligent semantic technologies, representatives Metaweb (Google) have confirmed that Freebase is a very important part of the Knowledge Network, along with Wikipedia and base of the CIA fact. During the big cleanup for the unification of all hohlovyh API programming interface to Freebase drastic changes to expose did not, and his explanation was moved to developers.google.com. In order to ask something from the knowledge base we still use a query language MQL (pronunciation. "Mickle", Metaweb Query Language). !

the First query and editor


Let's start with a simple question: ask Freebase some fact, such as date of birth, Leonardo da Vinci:
www.googleapis.com/freebase/v1/mqlread?query={"/type/object/id":"/en/leonardo_da_vinci","/people/person/date_of_birth":null}
Get quite a reasonable result:
the
{
"result": {
"/type/object/id": "/en/leonardo_da_vinci", 
"/people/person/date_of_birth": "1452-04-15"
}
}

To us it was easier to exercise, we will use query editor, kindly provided by Freebase.
image
The editor of this terribly convenient and has a wonderful feature auto-completion of queries — in case of difficulty, just hit Ctrl+Enter and you get a great contextual clues. In the lower panel of the editor located useful tools which are described in detail in guide. In the self-study particularly suggest you look at the button examples, containing examples of queries, clarifying many of the features of MQL.

Well, that's our request, but the answer is:
the the
Request Response
{
"id": "/en/leonardo_da_vinci",
"/people/person/date_of_birth" : null
}
{
"id": "/en/leonardo_da_vinci"
"/people/person/date_of_birth": "1453-04-15",
}

Let us examine this query in detail. We have specified the ID of the object in Freebase is to use the term id. The identifiers of all objects, and id is short for /type/object/id. There are many other /type/object of properties possessed by all entities of the Freebase, they will be considered later.
The object with ID /en/leonardo_da_vinci may have a property /people/person/date_of_birth whose values we do not know. We put this value instead of the special word null, which place in response to the Freebase record the value from the database.
As you can see, the request and response are symmetric.

Complex query


Now, in order to have any more questions, we will make a rather complicated MQL query and briefly explain it to you. After that you can proceed to the detailed study of the structure of Freebase and review language features.

So here's our request (taken from the guide to MQL):
the the
Request Response

    [{

    "type": "/music/album",

    "name": null,

    "name!=": "Greatest Hits",

    "release_date|=": [

    "1978",

    "1979"

    ],

    "genre":[],

    "a:genre": "New Wave",

    "b:genre|=": [

    "Punk Rock",

    "Post-punk",

    "Progressive rock"

    ],

    "artist": {

    "name": null,

    "type": {

    "id": "/people/person",

    "optional": "forbidden"

    }

    },

    "limit":2,

    "sort":"name",

    }]


[{
"type": "/music/album",
"name": "Dawn of the Dickies",
"a:genre": "New Wave",
"artist": {
"name": "Television",
"type": null
},
"genre": [
"Punk rock",
"New Wave",
"Post-punk",
"Protopunk"
],
"ns0:name": "Adventure",
"ns1:type": "/music/album"
},
{
"a:genre": "New Wave",
"artist": {
"name": "The Dickies",
"type": null
},
"genre": [
"New Wave",
"Punk rock"
]
}]


Will try to briefly describe that for MQL tools used in this query.
First, as you can see, the entire query is wrapped in a [ { } ], which means that the results you expect an array of objects, not one object, as in the case of { }.
Rows 2-4 should not cause any problems: we are looking for an object of type album (/music/album), we want to get his name and we are not interested in albums, called "Greatest Hits".
In lines 5-8 and 11-15 of a provider OR |= we are interested in the album, whose release date is equal to 1978 or 1979. We now turn to the genre:
"genre":[],
"a:genre": "New Wave",
"b:genre|=": [
"Punk Rock",
"Post-punk",
"Progressive rock"
],

The first line says that we want to get the list of genres of these albums in the response. To do this, we added to the query, an empty list [ ]. Then we say that we are only interested in the albums in the genres which indicated a New Wave from the list "Punk Rock", "Post-punk", "Progressive rock".
Finally, lines 23-24 contain directives MQL: I am interested in only two outcomes (limit), and I want to sort them by name (sort).

JSON MQL


MQL queries and responses are JSON objects, so for the little ones (or those who are not among the web developers) will talk about JSON.
General information about JSON
JSON (JavaScript Object Notation) is a language designed for data exchange in the format "key-value". Initially, JSON was used to serialize JavaScript objects, but it quickly became asianization and due to its simplicity, has become a very loved and respected by programmers for different languages and platforms.
The most simple JSON object, empty object. It is written as follows:
the
{}

Now let's create the object that stores information about Leonardo da Vinci. First restrict only his name. To do this, enclose the key and the value in quotation marks, separated by a colon
"name" : "Leonardo di ser Piero da Vinci" }
Add a few facts about Leonardo, separated by commas:
the
{
"name" : "Leonardo di ser Piero da Vinci",
"date_of_birth": "1453-04-15",
}

Now it is necessary to determine that the profession was at da Vinci. And professions-these were many: a sculptor, and a painter and architect and a lot of people. In order to assign one key to multiple values in the JSON uses a list of values enclosed in square brackets, the values separated by commas:
the
{
"name" : "Leonardo di ser Piero da Vinci",
"date_of_birth": "1453-04-15",

"profession": [
"Architect",
"Engineer",
"Anatomist",
"Inventor",
"Artist",
"Sculptor"
],
}

One more thing about JSON which should know, is a subobject. They are very simple: after the key, you simply insert a new set of couples keys-values in curly brackets. In the case of Leonardo we can try to display the data on place of birth of Leonardo — the village Anchiano located in Italy. We say that the key is "place_of_birth" corresponds to object named Anchiano, which is in Italy:
the
{
"name" : "Leonardo di ser Piero da Vinci",
"date_of_birth": "1453-04-15",
"profession": [
"Architect",
"Engineer",
"Anatomist",
"Inventor",
"Artist",
"Sculptor"
],

"place_of_birth": {
"name": "Anchiano",
"containedby": "Italy",
},
}



it is Not JSON


In General, MQL queries are not valid JSON objects. MQL is a strict superset of JSON, and it allowed all sorts of liberties. One of the ideas products Metaweb is that the program should be able to forgive user mistakes and errors that they make. This idea exists in other languages and programs, but first and foremost — the World Wide Web — it's okay that some parts of html is misspelled, you should still try to display the document.
For example, the correct JSON request looking for people with rare and valuable profession:
the
{
"id": "/en/pope",
"/people/profession/people_with_this_profession": [{
"name": null,
"limit": 4
}]
}

We can remove the quotation marks and the query will continue to work:
the
{
id: /en/pope,
/people/profession/people_with_this_profession: [{
name: null,
limit: 4
}]
}

Close parenthesis and split pairs with a colon, too, do not have, so here is an example of absolutely outrageous:
the
 id /en/pope
/people/profession/people_with_this_profession [{
name is null
limit 4


Device Freebase


The official guide gives a very good introduction to how data is stored inside Freebase. Us is not too important because it is used in Freebase of the four objects are fully hidden behind the object paradigm. If you are interested, can turn to the appropriate page manual
So, Freebase allows us to think about what's inside him lay the objects. Each object is limited to curly braces { } and consists of pairs "property-value", separated by colons. Objects that Freebase gives an answer to the MQL queries are valid JSON objects, but they are not similar to objects in OOP paradigm. It is best to think of them as unordered sets of pairs.
As properties (i.e. what is before the colon) in MQL can stand IDs. As values can be identifiers, literals, arrays, and, finally, the nested objects.Freebase has rules, which must be based identifiers. An identifier consists of a namespace and a key separated by a forward slash /. Consider, for example, the identifier /people/person/date_of_birth — in this date_of_birth is the key, and /people/person namespace.
The IDs are unique. They are not required to carry the semantic load, but often the object identifier is easy to understand what was going on.
image
Generic properties

All objects in Freebase have the following reserved (universal properties):
the
    the
  • name — /type/object/name
  • the
  • key — the /type/object/key
  • the
  • (usually more than one) — /type/object/type
  • the
  • creation time of /type/object/timestamp
  • the
  • Creator — /type/object/creator
  • the
  • access mode: /type/object/permission
  • the
  • global identifier /type/object/guid
  • the
  • machine — ID /type/object/mid

We consider here the properties that are most often used in MQL queries: names, identifiers and types.

IDs

In Freebase like a lot of identifiers. The main of them is /type/object/guid is given once and for all. Is it the short form /type/object/mid. Well, I use in queries usually /type/object/id — it is often chelovekochitaemye. The most important thing is that no two objects with the same identifiers. For example, look how many people named Adam Smith (Adam Smith): article in English Wikipedia. Only a moral philosopher Adam Smith is the proud identifier /en/adam_smith. All the other Adam Smith would be identified differently if they policies (/en/adam_smith_1965), players (/en/adam_smith_huddersfield) or anyone else.

You can enter the ID into the search box on Freebase.com and to the page object properties:
image

Property /type/object/name

Each object has a name. The name is not unique, the object has usually several names — one for each language. Most interesting is that it does not complicate queries — you will notice that when you request names, you will only be given the name in the language set in Freebase as current. So it is possible to address with objects of type name as ordinary strings.

Property /type/object/type

This property specifies the type of the object. One object can have multiple types — it usually is.
If the query you specified the property type, you need a namespace for this type can be omitted. Which properties are of type /film/director? Of course, those who are in the namespace of this type, that is, those that begin with /film/director. For example, consider a query for all movies of Stanley Kubrick. The left side shows the query in an abbreviated form, which we will use further, and on the right is how it could look, don't be Metaweb developers are so good to us.
the the
Request Query in full form
[{
"name": "Stanley Kubrick",
"type": "/film/director",
"film": [],
}]
[{
"/type/object/name": "Stanley Kubrick",
"/type/object/type": "/film/director",
"/film/director/film" : []
}]

Secondly, all properties from a namespace /type/object can be omitted — that's why we have the right to write just id, name, type, etc? Because all objects in Freebase have type Object.

Different types of MQL queries


We have already discussed quite a lot of queries, but so far did not focus on the language itself. First, let's look at how MQL retrieves the desired values. There are the following cases:
the
    the
  • I need to request a single literal value. For example, the date of birth of the person
  • the
  • I need to query an array of values. For example, a list of the albums of the musical group.
  • the
  • I need to query a single object c its main properties: ID, key type and name
  • the
  • I need to query an array of objects
  • the
  • I need to know everything about the object

Request one

If you want to Freebase returned object is of the same structure as the request object, but with the filled unknown field in the query this field is necessary to substitute null. We saw quite a lot of such examples, here's another. Ask the musician Keith Emerson, where he came from:

the the
Request Response
{
"name": "Keith Emerson",
"type": "/music/artist",
"origin": null
}

{

"name": "Keith Emerson",
"origin": "England",
"type": "/music/artist"
}
}



Request array of values

If we try to use a null to query for all music albums of the group, we will get an error. If you are expecting an array of objects, use square brackets []. Freebase will fill this array with the rows listed with a comma. Examples of albums muscarinic groups fully and in the official guide, and we'll find a list of books written by Hawking:

the the
Request Response
{
"name": "Stephen Hawking",
"type": "/book/author",
"works_written": []
}

{
"result": {
"name": "Stephen Hawking",
"works_written": [
"The Universe in a Nutshell",
"A Brief History of Time",
"George's Secret Key to the Universe",

There are lots
 "Computer Resources for People With Disabilities?"
"The Nature of Space and Time",
"On the Shoulders of Giants",
"Black Holes and Baby Universes and Other Essays",
"George's Cosmic Treasure Hunt",
"The Theory of Everything",
"The Grand Design",
"A Briefer History of Time",
"God Created the Integers",
"George and the Big Bang",
"The Large Scale Structure of Space-Time",
"The Illustrated Brief History of Time",
"The Singularities of Gravitational Collapse and Cosmology",
"Gravitational Radiation from Colliding Black Holes",
"Black Holes in General Relativity",
"Black Hole Explosions?",
"The Development of Irregularities in a Single Bubble Inflationary Universe",
"Wave Function of the Universe",
"Information Loss in Black Holes",
"The large scale structure of space-time",
"General Relativity; an Einstein Centenary Survey"
"Is the end in sight for theoretical physics?",
"Black holes and baby universes and other essays",
"A brief history of time",
"My Brief History",
"Vector Fields in Holographic Cosmology",
"Inflation with Negative Lambda",
"Accelerated Expansion from Negative Lambda",
"The Dreams That Stuff Is Made Of: The Most Astounding Papers of Quantum Physics and How They Shook the Scientific World",
"Local Observation in Eternal inflation",
"The No-Boundary Measure in the Regime of Eternal Inflation",
"The Classical Universes of the No-Boundary Quantum State",
"No-Boundary Measure of the Universe",
"Volume Weighting in the No Boundary Proposal",
"The Measure of the Universe",
"Populating the Landscape: A Top Down Approach",
"A Non Singular Universe",


the
 "Black Holes and the Information Paradox"
],
"type": "/book/author"
}
}



If you do the opposite, query the array instead of single value – in this there are no problems – Freebase converts the results and give an array with only one value.

Request objects

Well but for my application I'm interested to know not only the names of the books of Hawking, but also their release dates, and pictures would be nice! This is also possible. The fact that the array of books we received in the last request, just looks like a string array. Actually, it's an array of objects, just Freebase turns objects into strings, leaving only their property name.

Also England, where our musician, it's not just the string "England", and the object. To get an object representation of the query, you use { }, like so:

the
{
"name": "Keith Emerson",
"type": "/music/artist",
"origin": { }
}


As a result, we will give the most important information about the object: its identifier, name and type list:
query result
{
"result": {
"origin": {
"id": "/en/england",
"name": "England",
"type": [
"/common/topic",
"/location/location",
"/film/film_subject",
"/book/book_subject",
"/location/administrative_division",
"/film/film_location",
"/location/uk_constituent_country",
"/user/xleioo/winning_night/option_list",
"/location/statistical_region",
"/location/dated_location",
"/symbols/name_source",
"/m/04kp2w0",
"/user/robert/military/military_power",
"/symbols/flag_referent",
"/user/skud/flags/topic",
"/user/skud/names/topic",
"/user/robert/military/topic",
"/base/petbreeds/topic",
"/m/04mp17s",
"/user/xleioo/winning_night/topic",
"/organization/organization_scope",
"/base/charities/geographic_scope",
"/sports/sports_team_location",
"/base/thoroughbredracing/thoroughbred_racehorse_origin",
"/user/tsegaran/random/taxonomy_subject",
"/base/authors/country_of_origin",
"/base/authors/topic",
"/biology/breed_origin",
"/fictional_universe/fictional_setting",
"/government/political_district",
"/olympics/olympic_participating_country",
"/base/summermovies2009/topic",
"/base/leicester/topic",
"/base/popstra/location",
"/location/country",
"/base/england/topic",
"/base/ontologies/ontology_instance",
"/event/speech_topic",
"/user/skud/legal/treaty_signatory",
"/government/governmental_jurisdiction",
"/base/masterthesis/topic",

"/base/horticulture/cultivar_origin",
"/base/horticulture/topic",
"/base/localfood/food_producing_region",
"/base/localfood/topic",
"/sports/sport_country",
"/base/todolists/topic",
"/base/tagit/concept",
"/food/beer_country_region",
"/periodicals/newspaper_circulation_area",
"/location/uk_statistical_location",
"/base/biblioness/bibs_location",
"/base/biblioness/bibs_topic",
"/base/aareas/schema/gb/constituent_country",
"/base/aareas/schema/administrative_area",
"/base/uncommon/topic",
"/base/schemastaging/statistical_region_extra",
"/people/place_of_interment",
"/base/allthingsnewyork/topic",
"/base/events/topic",
"/base/events/geographical_scope",
"/base/tonyfranksbuckley/topic",
"/base/piratesofthewirralpeninsula/topic",
"/military/military_combatant",
"/military/military_post",
"/organization/organization_member"
]
},
"name": "Keith Emerson",
"type": "/music/artist"
}
}


Nested queries

You can get any other information about the country of origin of our musician, forming, thus, a subquery. For example, I want to know what language is spoken in the country where I came from Emerson. Please note, I added type for the country to get hints from the query editor:
the the
Request Response
{
"name": "Keith Emerson",
"type": "/music/artist",
"origin": {
"type": "/location/country",
"official_language": null
}
}
{
"result": {
"name": "Keith Emerson",
"type": "/music/artist",
"origin": {
"type": "/location/country",
"official_language": "English Language"
}
}
}


Down: to which language family is the language spoken in the country where I came from Emerson?
the the
Request Response
{
"name": "Keith Emerson",
"type": "/music/artist",
"origin": {
"type": "/location/country",
"official_language": {
"type": "/language/human_language",
"language_family": []
}
}
}
{
"result": {
"type": "/music/artist",
"name": "Keith Emerson",
"origin": {
"type": "/location/country",
"official_language": {
"language_family": [
"West Germanic languages",
"Indo-European languages",
"Anglo-Frisian languages"
],
"type": "/language/human_language"
}
}
}
}


These are pretty stupid queries can easily be generalized into something more useful. For example, a request to retrieve a list of musicians who come from English-speaking countries. Please note that I often use the output in an array. Well, even the word limit, which limits the output to three results:

the the
Request Response
[{
"name": null,
"type": "/music/artist",
"origin": [{
"type": "/location/country",
"official_language": "English Language"
}],
"limit": 3
}]
{
"result": [
{
"origin": [{
"type": "/location/country",
"official_language": "English Language"
}],
"name": "The Katinas",
"type": "/music/artist"
},
{
"origin": [{
"type": "/location/country",
"official_language": "English Language"
}],
"name": "Shermain Jeremy",
"type": "/music/artist"
},
{
"origin": [{
"type": "/location/country",
"official_language": "English Language"
}],
"name": "Patsy Moore",
"type": "/music/artist"
}
]
}


Query all properties of an object

Useful when you construct a query to obtain all properties of the object. The design used for this is very simple and easy: the asterisk in the title properties and an empty array which is filled with values "*" : []
the the
Request Response
{
"name": "Keith Emerson",
"type": "/music/artist",
"origin": {
"type": "/location/country",
"*": []
}
}
England number of properties
{
"result": {
"origin": {
"fifa_code": [
"ENG"
],
"second_level_divisions": [
"Rutland",
"Leicestershire",
Leicester,
"Derbyshire",
"Derby",
"Northamptonshire",
"Nottinghamshire",
Nottingham,
"Lincolnshire",
"London Borough of Wandsworth",
"London Borough of Bromley",
"London Borough of Hounslow",
"London Borough of Croydon",
"London Borough of Sutton",
"London Borough of Enfield",
"London Borough of Hillingdon",
"London Borough of Lambeth",
"London Borough of Redbridge",
"City of Westminster",
"London Borough of Merton",
"London Borough of Brent",
"London Borough of Waltham Forest",
"London Borough of Camden",
"Royal Borough of Kingston upon Thames",
"London Borough of Haringey",
"London Borough of Bexley",
"London Borough of Lewisham",
"London Borough of Southwark",
"London Borough of Harrow",
"City of London",
"London Borough of Newham",
"London Borough of Barking and Dagenham",
"London Borough of Richmond upon Thames",
"London Borough of Barnet",
"London Borough of Hammersmith and Fulham",
"London Borough of Islington",

"Royal Borough of Kensington and Chelsea",
"Royal Borough of Greenwich",
"London Borough of Tower Hamlets",
"London Borough of Hackney",
"London Borough of Ealing",
"Lancashire",
"Blackburn with Darwen",
"Blackpool",
"Greater Manchester",
"Cheshire",
"Cheshire West and Chester",
"Borough of Halton",
"Cheshire East",
"Warrington",
"Cumbria",
"Merseyside",
"Cornwall",
"Isles of Scilly",
"The Wiltshire",
"Borough of Swindon",
Devon,
"Torbay",
"Plymouth",
Bristol,
"Somerset",
"North Somerset",
"Bath and North East Somerset",
"Dorset",
"Poole Borough Council",
"Bournemouth Borough Council",
"Gloucestershire",
"South Gloucestershire",
"Middlesbrough Borough Council",
"Borough of Stockton-on-Tees",
"Tyne and Wear",
"Redcar and Cleveland",
"North Yorkshire",
"County Durham",
"Borough of Darlington",
"Borough of Hartlepool",
"Northumberland",
"Cambridgeshire",
"Peterborough",
"Essex",
"Thurrock",
"Southend-on-Sea",
"Hertfordshire",
Suffolk,
"Norfolk",
"Bedford",
"Luton",
"Central Bedfordshire",
"West Midlands",
"Shropshire",
"Telford and Wrekin",
"Worcestershire",
"Warwickshire",
"Herefordshire",
"Staffordshire",
"Stoke-on-Trent",
"South Yorkshire",
"North East Lincolnshire",
"East Riding of Yorkshire"
],
"national_anthem": [],
"permission": [
"/boot/all_permission"
],
"guid": [
"#9202a8c04000641f8000000000014381"
],
"name": [
"England"
],
"creator": [
"/user/metaweb"
],
"type": "/location/country",
"languages_spoken": [
"Old English",
"Early Modern English",
"English Language"
],
"calling_code": [
44
],
"id": [
"/en/england"
],
"iso_alpha_3": [],
"iso3166_1_alpha2": [],
"currency_formerly_used": [],
"gdp_nominal": [],
"form_of_government": [
"Constitutional monarchy",
"Constituent country"
],
"iso_numeric": [],
"administrative_divisions": [
"North East England",
"North West England",
"Yorkshire and the Humber",
"West Midlands",
"East Midlands",
"East of England",
"Greater London",
"South East England",
"South West England",
"Little Gidding",
"Dominion of New England",
"Chilton",
"Selby District",
"Wakefield",
"Dalvíkurbyggð",
"Manor",
"Upleadon"
],
"third_level_divisions": [],
"timestamp": [
"2006-10-22T08:58:48.0043 Z"
],
"key": [
"9316",
"england",
"ENG",
"01Yg6fA3mG5Bf",
"0080-5673",
"190404",
"66705302048946451041",
"$0410$043D$0433$043B$0438$044F",
"27953",
"3003238",
"713477",
"Inglaterra",
"$30A4$30F3$30B0$30E9$30F3$30C9",
"8690",
"Inghilterra",
"10342",
"Inglaterra",
"England",
"16627",
"1023",
"Angleterre",
"4925",
"$0410$043D$0433$043B$0438$044F",
"Angleterre",
"$0410$043D$0433$043B$0438$044F",
"$0410$043D$0433$043B$0438$044F",
"Inglaterra",
"Inglaterra",
"Inghilterra",
"England",
"$30A4$30F3$30B0$30E9$30F3$30C9",
"England",
"E92000001",
"england$002F942213",
"England",
"$0625$0646$062C$0644$062A$0631$0627",
"252",
"281",
"$067E$0627$062F$0634$0627$0647$06CC_$0627$0646$06AF$0644$0633$062A$0627$0646",
"Anglija",
"$C601$B780",
"Anglia",
"England",
"England",
"England",
"Anglia",
"13531",
"$C601$AE38$B9AC",
"England",
"Engeland",
"$0410$043D$0433$043B$0456$044F",
"$0627$0646$062C$0644$062A$0631$0627",
"Inggeris",
"Anglia",
"2353",
"Anglija",
"England",
"$0130ngiltere",
"Inggris",
"England",
"372",
"England",
"$0907$0902$0917$094D$0932$0945$0923$094D$0921",
"$0627$0646$0643$0644$062A$0631$0629",
"$0627$0646$062C$0644$062A$0640$0640$0631$0627",
"Mellemengland",
"GB-ENG",
"$0907$0902$0917$094D$0932$0948$0923$094D$0921",
"$0628$0625$0646$062C$0644$062A$0631$0627",
"Engelske",
"X$1EE9_Anh",
"England",
"$0391$03B3$03B3$03BB$03AF$03B1",
"$0386$03B3$03B3$03BB$03BF$03B9",
"Anh_C$00E1t_L$1EE3i",
"Englanti",
"Anglia",
"Engelse",
"$0E41$0E04$0E27$0E49$0E19$0E2D$0E31$0E07$0E01$0E24$0E29",
"Anglija",
"$0627$0644$0625$0646$062C$0644$064A$0632$064A",
"11799",
"$82F1$683C$5170",
"Anglija",
"England",
"801",
"$0625$0646$0643$0644$062A$0631$0647",
"$0E0A$0E32$0E15$0E34$0E2D$0E31$0E07$0E01$0E24$0E29",
"Anh",
"Inglesa",
"3812",
"$05D0$05E0$05D2$05DC$05D9$05D4",
"$0391$03B3$03B3$03BB$03AF$03B1",
"$0627$0646$062C$0644$064A$0632$064A",
"$0625$0646$0643$0644$062A$0631$0627",
"England",
"$0627$0646$06AF$0644$0633$062A$0627$0646",
"$0625$0646$0643$0644$062A$0631$0651$0627",
"Anglesa",
"$0410$043D$0433$043B$0438$0439$0441$043A$0430"
],
"official_language": [
"English Language"
],
"currency_used": [
"UK £"
],
"first_level_divisions": [
"East Midlands",
"Greater London",
"North West England",
"South West England",
"North East England",
"East of England",
"West Midlands",
"Yorkshire and the Humber",
"South East England"
],
"search": [],
"fourth_level_divisions": [],
"gdp_nominal_per_capita": [],
"iso3166_1_shortname": [],
"capital": [
"London"
],
"attribution": [
"/user/metaweb"
],
"fips10_4": [],
"mid": [
"/m/02jx1",
"/m/071yqyc",
"/m/071yqqb",
"/m/07xyh0z"
],
"internet_tld": [
"uk"
]
},
"type": "/music/artist",
"name": "Keith Emerson"
}
}

How to request objects

For those who managed to get lost in the brackets, here's a summary of how in Freebase can be queried objects:
the meaning the
"property" : null
the requested property's value as a single string. As this string will be given a default value-object properties: value (literal) or name (for objects). If the value is an array, an error is thrown! the
"property" : []
requested an array of strings. The result may be empty array, array with one value or an array with multiple values the
"*" : []
for each property of the object is queried for an array of values the
"property" : {}
requested brief information about the object. For ordinary objects is given their name, ID and type the
"property" : [{}]
requested an array of objects in a summary form. Works like {}, but for arrays the
"property" : {subquery}
the object property values the question is all that is specified in the query the
"property" : [{subquery}]
a nested query applies to all objects in the array of property values. The effect is similar to the previous array.

Enough to start. It is clear that in MQL there are different Comparators, regular expressions, there are all sorts of AND, OR, and NOT. Even the beautiful language of Acre, which allows you to format the results of queries similar to how it's done in Semantic MediaWiki. Well ahead of the story about Dbpedia and Wikidata. What would you be interested in reading in the first place?
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

Fresh hay from the cow, or 3000 icons submitted!

Group edit the resources (documents) using MIGXDB