Google Knowledge Graph

If you search for “Italy” on Google (, not you’ll have a kind of infobox on the right hand side of the result page with some infos about the country. What is interesting is that you can follow the links on that side to other objects related to Italy, for example the Colosseum that shows a map of the place with more links. You might not be aware but you’re following a different kind of search. In the same page you can follow the usual pattern from a document to another document about the country (left hand side) or a new one from an object to another object (right hand side). On the right hand side you can also follow some meaningful (semantic) properties that relate one object to the other. For instance ‘Architects’ is a relation that links the Colosseum to the roman emperor Vespasian. It is easy to imagine what other (paid) relationships can be added to those objects in the very near future.

Introducing the Knowledge Graph: things, not strings

Viewing the CIA World Factbook

The CIA World Factbook provides a lot of data about  geography, people, government, economy, communications, transportation, military and transnational issues of each country in the world and also of some other entities like the European Union. The data are constantly updated. The CIA World Factbook does not provide maps for the data that I think would help the user that want to understand some issues that are in front of us in the years to come. To begin the job I wanted to put on a map of the world the population of each contry in the year 2009, the growth rate and the total area of the country. The CIA World Factbook provides the data in the html file and also in machine-readable csv format for some entries like the ones needed for my purposes so I did not need to scrape their site. In fact I think I did not have started neither in that case. Anyway I also found the D2R Server for the CIA Factbook that provides a SPARQL endpoint and client to be queried in order to get the data so I decided to use this service and then put the data in a Google Fusion Table in order to view the data in a world map. The job has been quite easy. I made the  SPARQL query

PREFIX factbook: <;
SELECT ?country ?population ?growthrate ?capital_city ?area
?x  factbook:name ?country ;
factbook:population_total ?population ;
factbook:populationgrowthrate ?growthrate ;
factbook:capital_name ?capital_city ;
factbook:area_total ?area .

I wrote few lines of PHP code to parse the data returned in the JSON format. I put the data in a five columns Google spreadsheet to be imported in a  fusion table for the countries, populations, growth rates, capital name and total areas and I was instantly able to view the populations and the growth rates in two world maps with intensity degree to take account of the values. Before that, Google needs to geocode the countries, but it takes one minute to do that. After that I made some calculations using the spreadsheet in order to get the density of the population in each country, number of people per km², in the year 2009, the expected population at the end of the decade and again the density. The expected population was carried out using the formula

p2 = p1(1 + g)^y

where p2 is the population expected after y = 10 years, p1 is the population in the year 2009 and g is the growth rate of the country. I created three more columns for the calculated data. At the end of the job I had my fusion table with all the data viewable in a map of the world. A lot of considerations can be made viewing the maps, more easily than simply reading the data in a csv file or in a html page, one for each country. I do not want to enter the demographic issues here, but I think we are facing more problems in the years to come since the populations in countries in the southern side of the world are growing rapidly without a  strong enough economy to support that. China and India have a smaller growth rate than most african countries but their population are already big and so their contribution to the population growth for the decade will be big. This means that migration from these countries will go on. Going back to the technical arguments I have put all the maps in a page with the population maps side by side and the same for the density maps.

Appunti di logica modale

Le logiche modali sono estensioni della logica classica per il trattamento di enunciati che esprimono una modalità di essere diversa dal semplice valore vero o falso come possibile, necessario, permesso, obbligatorio.
La semantica della logica classica ha a che fare con il mondo reale così com’è, hic et nunc. La semantica delle logiche modali ha invece a che fare con i mondi possibili, che non sono ma che potrebbero essere. Un mondo è l’insieme delle proposizioni vere in quel mondo. Un mondo possibile è un mondo che differisce dall’attuale per il valore di verità di qualcuna di queste proposizioni. Qual’è dunque il significato di un enunciato che contempla frasi del tipo “è possibile che A” o “è necessario che B”. Che relazione ci deve essere tra un mondo dove A è vero e uno dove è solo possibile ?
E’ possibile accedere ad un mondo, poniamo w2, diverso da quello attuale w1 se esiste una relazione binaria di accessibilità o visibilità da w1 a w2. La relazione può essere asimmetrica, riflessiva, simmetrica, transitiva. Possiamo definire un modello M come un insieme W di mondi possibili, una relazione R di accessibilità tra mondi e una funzione di interpretazione I che associa un valore nell’insieme {Vero, Falso} a ciascuna proposizione in ogni mondo di W. Se qualcosa è vero nel nostro mondo allora è possibile in uno dei mondi possibili che sono raggiungibili a partire dal nostro, se è falso nulla può essere detto ne che sia possibile ne che sia impossibile. Se qualcosa è falso nel nostro mondo allora non è necessariamente vero, se è vero non lo è comunque necessariamente in tutti i mondi possibili.