Wednesday 20 November 2013

My Cinema Knowledge: "my movies" aka Multi-language reconciliation using Freebase


In this first episode of " My Cinema Knowledge" I will try to describe my film catalog mixing private information (my disk folders) with public ones (Freebase)
I will use Ubuntu, Open Refine, a little python script and a RDF store, Virtuoso.




Step By Step How-to

  • Build a csv with all the folders names in my disk using a linux command ( find . -type d > myMovies.csv )
  • import in open refine (I used lod refine, a package including open refine and the rdf extension)
  • Extracted movie name from folder name taking only the last part of the location
  • Added a reconciliation service based on the freebase dump created previously (the making of is described in This post) imported in a Virtuoso triple store
    For this I used the SPARQL based reconciliation service feature of the RDF extension
    Using a custom reconciliation service over freebase I will not be limited to the english languages provided by the Freebase reconciliation service
  • After 10 minutes on a 8gb Ram machine, this the results (out of about 310):
    • 138 movies automatically recognized 
    • 66 movies with multiple choices (semi automatic)
    • 109 without a match
  • Reason for the missing matches are:
    • Missing in Freebase (mostly italina movies)
    • Missing italian title in Freebase
    • Missing in my Freebase copy
    • Some intermediate folder (about 15)
  • I also got a severe BUG in selecting new matches: https://github.com/fadmaa/grefine-rdf-extension/issues/82 (grrrr)
  • UPDATE!!!
    There is also a cloud based reconciliation service for freebase, now working also with italian language. It should be included in open refine but it does not work for this bug https://github.com/OpenRefine/OpenRefine/issues/805. You can make it work creating a new standard one using this address:

    http://reconcile.freebaseapps.com/reconcile 
  • Copy reconciled data in a new column 
  • Exported csv. on raw for example is:
    ./doppiati/1984 , 1984, http://rdf.freebase.com/ns/m.03kp2l
  • Transformed the csv to rdf using a Python script as simple as this  using python-rdflibsudo apt-get install python-pip (ubuntu)
    sudo pip install rdflib
    To use in this way:
    python myMoviesToRDF.py myMovies-csv.csv myMovies.ttl
  • Upload data into my RDF store
  • Enjoy data analysis NOW!
    In the first attemp i used SPARQL queries in order to get the genre ranking, the directors ranking and the director nationality ranking. A first attemp now, some more will come soon!


    An interactive version here



Monday 11 November 2013

Fact checking : Fassina vs wallstreetitalia


who : viceministro dell'Economia, Stefano Fassina:

 Il taglio delle pensioni d'oro, anche nell'ipotesi di considerare 'd'oro' le pensioni superiori a 3500 euro netti mensili, implica risparmi di alcune centinaia di milioni di euro all'anno".

source:
http://www.repubblica.it/politica/2013/11/08/news/reddito_di_cittadinanza_la_proposta_di_grillo_copertura_con_imu_su_immobili_della_chiesa_e_taglio_pensioni_d_oro-70523273/

who: wallstreetitalia

Nel 2011, il 5,2% dei pensionati (861mila persone in tutto), che percepisce un assegno mensile superiore ai tremila euro, ha assorbito in tutto 45 miliardi, vale a dire il 17% della spesa previdenziale. Poco meno di quanto sborsato per i 7,3 milioni di italiani, il 44% del totale, il cui reddito non supera i mille euro al mese. In cifre 51 miliardi in tutto, pari al 19,2% della spesa complessiva.

source: 
http://www.wallstreetitalia.com/article/1641597/le-pensioni-d-oro-costano-45-miliardi.aspx

Io:
Mi sono perso qsa?

Wednesday 30 October 2013

The best open dataset about Cinema: Freebase. aka "how I fight with Freebase in order to push it in my database"


For my work about Linked Data in the Digital Library domain (and for personal passion in Cinema too) i investigated on how to have the most complete open dataset about movies in my local database.

After some quality evaluation I identified Freebase as my target.
These are the steps I used:

0) Try out freebase export by google. It does not work, their rdf has some syntactic problems.

1) Discovered :baseKb . Downloaded the most recent version (some month ago) :A copy of :BaseKB Lime derived from the 2012-02-10 Freebase RDF dump obtained using  this tool:
https://github.com/paulhoule/infovore/wiki/:BaseKB%20Lime
Thanks paul Houle!
This tool cleans the original dump and make it loadable in a database.

2) Realize that it's very big.
With my test machine (4 cpu and 16 gb RAM) and one of the best RDF triple stores, Virtuoso 7 I could not end the data loading.

3) Built a Virtuoso script (and some manual iteratio):
  • Load the dataset in parts (4)
  • Created the list of object types related to the Cinema domain, manually from the Freebase website
  • Get the IDs of all the resources related to the cinema domain.
  • Load the dataset in parts 
  • Export all the triples related to the IDs selected before.

LessonS learned:
  • The list of types is not complete (awards are not there for example)
  • Use a database for this kind of bulk processing is not ideal but it lets me use a tool I am familiar. Alternatives will be the topic of another source.
  • A lot of data are not usefull for me, the latest version of BaseKb is split in parts (see the news) and I could choose for which part to download. It's not free to download (someone has to pay for the big transfert!) but it will be the next step
Where I use it:
  • Used in this hackathon i organized. Very nice.
  • I will enrich the information of a video library
  • Just started to play with queries
  • Dreaming, some movies reccomendation.

Monday 14 October 2013

And the winner is.. Team Fungo! #hackindustry #hackathon #h-farm

Abbiamo vintoooooooo!
H-industry è il nuovo form di hackathon lanciato lo scorso weekend da H-farm Ventures, incubatore aziendale che opera a livello internazionale in ambito Web, Digital e New Media, favorendo lo sviluppo di startup basate su innovativi modelli di business.


Ho partecipato alla 24 ore questo weekend dedicandomi a un progetto nel settore Automotive che sfrutta componenti di Texa, azienda leader nella costruzione di strumenti per diagnosi e autodiagnosi.

La nostra idea è stata quella di sfruttare in un'ottica nuova il device fornitoci, considerando i benefici per il guidatore.
Semplificando, l'idea è quella di legare la musica ascoltata in macchina alla situazione in cui ci troviamo con la nostra quattro ruote.

Il mio ruolo nel team è stato variegato ma provo a riassumerlo qui:
  • Product design, legato allo sviluppo dell'idea iniziale
  • Software Architect, quindi studio di fattibilità tecnologica e design dell'architettura del sistema
  • Data Scientist: studio dei dati a disposizione e del miglior modo di utilizzarli
  • Presentatore: ho presentato l'idea davanti a un pubblico di un centinaio di persone, tra cui uno dei fondatori di Texa e molti dirigenti di H-Farm
Il nostro progetto è stato molto apprezzato e.. abbiamo vinto!

In particolare i punti che mi è parso siano stati più graditi:
  • L'idea originale, laterale rispetto all'usuale settore dell'azienda
  • La solida idea di business elaborata
  • Il design del brand e la conseguente coerenza grafica (Grazie Designer MAI DORMIENTE!)
  • La presentazione che ha mescoltato visioni aziendali a un video introduttivo accattivante e simpatico per il pubblico
  • La completa analisi tecnica
Più di tutto mi sono divertito e ho conosciuto persone interessanti partendo dal Team Fungo per arrivare ai ragazzi di H-Farm e alle persone di Texa.
Grazie a tutti!
Ps. Qui di seguito la presentazione che abbiamo portato

Monday 30 September 2013

The first Hackathon

During an internal activity in the place where I work i got the opportunity to organize a little hackathon about Open Data and Linked Data.

The activity was a use case in the "Cinema" domain where we used the Linked Data technologies in order to mix public and private Data with the aim to discover new insight in the Data and imagine new uses of these Graph of data.
I split the activity in many sub activity. In this way everyone could work on what preferred using the technologies one could.

Data Sources
We analyzed the domain and we discovered interesting source of data released as Open Data such as Freebase in RDF and the list of the "Cinema Theatre" of Milan.
Someone imported this data in the graph and created a sample link between a movie and the place where a person saw it.

We also tried to think about the private information the graph could contains and we realized that a lot of them are already in digital form, but are in the Social Network silos.
Someone else discovered this really cool open data release about cultural events in rome. We couldn't find the data at the end, what a pity!

Data Process
I described some methodology of simple data import, cleaning and reconciliation before the hackathon.
Someone in the group used Open Refine and the RDF extension in order to reconciliate a list of movies and places in data from an existing source.
In this way some movies from a local libray were linked to the freebase dataset.

Data Store
I presented a lab instance of the Virtuoso Store and the people used that in order to store and query the graph of data.

Data Queries
I presented some basic SPARQL queries useful in order to discover what's inside a triple store.
Someone edited that in order to get an idea of the Freebase graph and all the data linked to it.
Some interesting queries about "Genre of movies i am more interested in" were produced.
People with query skills found SPARQL very similar to SQL

Data View
I presented some tools useful in exploring a distribuited graph of data and for make a graph view from the result of a query.
Someone used lodlive for getting ispired and discover new relationship in the data.
Someone else used VisualBox in order to build a tag cloud of the genre linked with the movies he had in his library: take a look!




This basic hackathon has been appreciated by the public. They found the "Hands-on" session helpful in order to understand better the use case of the semantic web technologies and a good annex to the more theoretical courses we organized

Tuesday 16 July 2013

Parlare in pubblico, arrivooo!




Questa me la sono scampata.
O meglio, la mia bassa tolleranza ai motivatori all'americana #soTuttoIoFateComeMeDiventereteFamosi è stata sufficiente.

Per questo nella apparizzione in pubblico conclusiva del corso ho ringraziato.
Per questo e per il fatto che il corso mi ha insegnato molti trucchi che mi saranno utili nel mio lavoro.

Sta poi a me, alle singole persone, usare queste "tecniche" con cognizione e sopratutto con onestà.
"Il fatto che puoi convincere persone a fare cose che altrimenti non farebbero non vuol dire che devi spingerle a fare cose per loro dannose"


Dimenticavo, lo scorso weekend ho avuto la possibilità, grazie alla mia azienda, di partecipare ad un corso di "public speaking".

Come dice sempre mio nonno.. impara l'arte e mettila da parte!

Friday 28 June 2013

Better Open Data 1


Siamo all’alba dell’era degli open data.
Qualcosa inizia a muoversi e si iniziano ad intravedere dati interessanti all’orizzonte.
Come racconta Giuseppe Marini qui   non sono però tutte rose e fiori.
Le problematiche principali identificate nell’articolo sono:
  • formati dei file disparati
  • denominazione dei campi con significato implicito
  • contenuto dei campi con errori o difficilmente confrontabile
 Vediamo ora come si potrebbe migliorare questa situazione!
 La prima cosa da fare è utilizzare un formato di dati comune.
 Il candidato ideale è l’RDF in quanto:
  • E’ sufficientemente generico, si possono esprimere in rdf i dati di qualunque complessit
  • E’ possibile convertire in rdf qualsiasi tipo di dato (csv, xls..) piuttosto facilmente 
  • Ha diverse “serializzazioni” (xml, json, etc) in modo da poter usare quella che fa più comod
  • E’ supportato dalla comunità open e quindi dai tool utilizzati per analizzare i dati 
Per poter confrontare tra loro dati provenienti da fonti diverse (ad esempio il mio comune e quello a fianco) è indispensabile poi riuscire ad avere lo stesso tipo di informazioni.
Per fare questo ci sono due strade:
  • usare lo stesso formato e quindi gli stessi nomi dei campi
  • usare formati diversi ma spiegando il significato dei campi 
La prima opzione è comoda ma spesso irrealizzabile. Non si arriva mai a definire un formato che vada bene a tutti e in men che non si dica ogniuno inizia ad inventare il suo particolarissimo formato -> caos
La seconda soluzione è meno comoda, sopratutto se si vuole che anchè un software possa “capire” il significato delle tabelle, ma.. rullo di tamburi... si.
può. fareeee!
Come? Usando le ontologie. Calma (già vedo le facce impaurite)
Le ontologie (nelle loro forme pù semplici) non sono altro che un elenco di campi standardizzati.
Prima di pubblicare i dati (o anche dopo (RAW DATA NOW)) si cercano ontologie esistenti per il dominio dei dati che si sta trattando.
Per quanto è possibile si cerca di utilizzare campi esistenti e solo nel caso non esistano se ne creano di nuovi cercando comunque di spiegarne il significato.
 Spiegare il significato di nuovi termini in definitiva significa creare mapping tra i "propri" termini e altri standard
Una delle ontologie di base è ad esempio il “dublin core”. Questo definisce campi come “autore”, “titolo” etc..
Ogni campo ha un’indirizzo web al quale si puo accedere per avere informazioni quali: etichetta del campo in piu lingue -> è possibile confrontare dati “in lingue diverse” Campi correlati (ad esempio dice che autore è una specializzazione di contributor) -> si puo trattare l’autore come un contributor!!

Monday 27 May 2013

New Task: Linked Data in Digital Library Management System


I'm proud to announce that in the next months i will (also) work on the Digital Library project here in CINECA.
In this project, born with a collaboration with Sapienza, i will work on the Linked (Open) Data publishing.
A lot of NICE DATA for everyone!!
Ready for reuse!
Here the slideshow about the work we will do in the next months.
Stay tuned!





Ho il piacere di annunciare che nei prossimi mesi lavorerò (anche) al progetto Digital Library.
In questo progetto nato in collaborazione con Sapienza mi occuperò della pubblicazione dei dati in Linked (Open) Data.
Presto tanti BEI dati per tutti!!
Qui di seguito la presentazione su lavoro che faremo nei prossimi mesi.