Neo4j and Tableau getting started with the Panama Papers

14
パパパパパパパパパパパ Neo4j パ Tableau パパパパパ 2016/6/29 パパパパ Masabumi Furuhata

Transcript of Neo4j and Tableau getting started with the Panama Papers

Page 1: Neo4j and Tableau getting started with the Panama Papers

パナマ文書解析のためのNeo4j と Tableau の初期設定

2016/6/29古幡征史

Masabumi Furuhata

Page 2: Neo4j and Tableau getting started with the Panama Papers

はじめに

• ゴール:  Tableau を利用してパナマ文書解析用の設定をできるようにする。

• 利用するもの:– 可視化ツール : Tableau 10– グラフデータベース: Neo4j 3.01– コネクタ: Tableau Web Data Connector

WDC

Cypher query

Page 3: Neo4j and Tableau getting started with the Panama Papers

Neo4j とパナマ文書の入手• Neo4j で読み込める形式のデータを利用 (csv 版もある )• 以下のサイトの windows version を利用

– https://www.occrp.org/en/panamapapers/database• 自分が利用していたのは panama-papers-windows-2016-05-17.zip• 展開して、インストールすると Neo4j を利用して分析できる。• panama-papers-windows フォルダの中の Launch Neo4j で起動

– 1. panama paper がある folder を指定 \panama-papers-windows-2016-05-17\panama-papers-windows\neo4j.data\panama.graphdb

– 2. start ボタンを押す

1 choose panama paper folder

2 press start

Page 4: Neo4j and Tableau getting started with the Panama Papers

Neo4j を起動• ブラウザで以下にアクセス

– http://localhost:7474/browser/• 以下の画面が立ち上がるので、パスワードなどを設定

して Cypher Query 言語でグラフデータベースにアクセス

Page 5: Neo4j and Tableau getting started with the Panama Papers

Neo4j を起動• Database Information をクリックすると登録されて

いる Node Labels と Relation Types が表示される

Page 6: Neo4j and Tableau getting started with the Panama Papers

Neo4j でクエリ実行• ノード数を調べてみる

– MATCH (n) RETURN count(n);– () でくくられているのは、ノードに対する指定– 以下のように約84万ノードと返ってくる

Page 7: Neo4j and Tableau getting started with the Panama Papers

Neo4j でクエリ実行• ノード間のネットワーク関係を調べる

– MATCH (n1:Officer)-[r]-(n2:Intermediary) RETURN n1, r, n2;– Officer ノードと Intermediary ノードでつながっているものを表示– [] でくくられているものはリレーション(エッジ)で、 ()-[]-() は

ノード間がエッジでつながっているもの– n1, r, n2 はクエリ内での変数名

Page 8: Neo4j and Tableau getting started with the Panama Papers

Tableau の入手

• データ可視化用に Tableau を利用• 有償ソフト• 14 日間の無償トライアルもある• http://www.tableau.com/

Page 9: Neo4j and Tableau getting started with the Panama Papers

Tableau Web Data Connector の入手

• Tableau と Neo4j を接続するために web data connector を以下の git から入手– https://github.com/ralfbecher/tableau-neo4j-wdc

• 起動– tableau-neo4j-wdc-master\website のフォルダにて、以下

の python スクリプトでサーバ起動 ( このフォルダのNeo4jWdc.html)

– python -m SimpleHTTPServer 8888– あるいは、 startHttpServer.bat をダブルクリックして起動

Page 10: Neo4j and Tableau getting started with the Panama Papers

WDC 接続

• Tableau から Web Data Connector 経由で Neo4j に接続

• 接続>その他のサーバ> web データコネクタ

Page 11: Neo4j and Tableau getting started with the Panama Papers

WDC 接続

• Web Data Connector で以下にアクセス– http://localhost:8888/Neo4jWdc.html

Page 12: Neo4j and Tableau getting started with the Panama Papers

抽出条件の設定• 以下の画面が表示されるので、 Cypher Query を記述

してデータを取り出す• 例• MATCH (n1:Officer)-[r]-(n2:Intermediary) RETURN n1, r, n2;

Page 13: Neo4j and Tableau getting started with the Panama Papers

Tableau で可視化の例

Page 14: Neo4j and Tableau getting started with the Panama Papers

今後

• 分析に役立つ Query 条件の設定例• Tableau と連携させるべきこと、 Neo4j

内で完結すべきこと、その他のやり方のメリットをまとめる

• Tableau のメリット–地図情報が使いやすい