GraphGists

将 Buzzfeed 特朗普世界数据集导入 Neo4j

我看到了 Sanchez Castro (@SCHZCAS) 的这条推文,我非常乐意支持。

作为 Buzzfeed 文章 帮助我们绘制特朗普世界图谱 的一部分,四位调查记者 John Templon、Alex Campbell、Anthony Cormier 和 Jeremy Singer-Vine 请求公众帮助他们绘制和分析他们调查、确认并发布的数据

现在,我们请求公众使用我们的数据来找出我们可能遗漏的联系,并提供我们目前不了解的背景信息。我们希望您能帮助我们——以及公众——更多地了解特朗普世界以及这个前所未有的商业网络可能如何影响公共政策。

sub buzz 31493 1484333437 1

使用本地数据库进行设置

如果您想在本地处理这些数据,请下载并安装 Neo4j 3.1 或使用空白的 Neo4j Sandbox(当然,您也可以探索已经导入了特朗普世界的 Sandbox)。

查看数据

推文链接到的Buzzfeed 文章 指向一个Google 表格,其中收集并验证/研究了特朗普组织与其他组织之间的关系数据,截至今天,我们共有 770 个组织,以及 611 个关系。相同的数据以 CSV 和 GraphML 文件的形式在其GitHub 仓库中提供。

幸运的是,这些数据可以作为公共 Google 文档获取,因此我们可以使用我们以前的技巧,使用 LOAD CSV 加载 CSV 下载 URL 到 Neo4j 中。

让我们先来看看数据,这里是一个示例

WITH
'https://docs.google.com/spreadsheets/u/1/d/1Z5Vo5pbvxKJ5XpfALZXvCzW26Cl4we3OaN73K9Ae5Ss/export?format=csv&gid=1996904412' AS url
LOAD CSV WITH HEADERS FROM url AS row
RETURN row.`Entity A`,row.`Entity A Type`, row.`Entity B`,row.`Entity B Type`,row.Connection, row.`Source(s)`
LIMIT 5
╒════════════════════════════════════╤═════════════════════╤═══════════════════════════════╤═════════════════════╤════════════════╤══════════════════════════════════════════════════════════════════════════════════════╕
│"row.`Entity A`"                    │"row.`Entity A Type`"│"row.`Entity B`"               │"row.`Entity B Type`"│"row.Connection"│"row.`Source(s)`"                                                                     │
╞════════════════════════════════════╪═════════════════════╪═══════════════════════════════╪═════════════════════╪════════════════╪══════════════════════════════════════════════════════════════════════════════════════╡
│"4 SHADOW TREE LANE MEMBER CORP."   │"Organization"       │"4 SHADOW TREE LANE LLC"       │"Organization"       │"Ownership"     │"https://www.documentcloud.org/documents/2838696-Trump-2016-Financial-Disclosure.html"│
├────────────────────────────────────┼─────────────────────┼───────────────────────────────┼─────────────────────┼────────────────┼──────────────────────────────────────────────────────────────────────────────────────┤
│"40 WALL DEVELOPMENT ASSOCIATES LLC"│"Organization"       │"40 WALL STREET LLC"           │"Organization"       │"Ownership"     │"https://www.documentcloud.org/documents/2838696-Trump-2016-Financial-Disclosure.html"│
├────────────────────────────────────┼─────────────────────┼───────────────────────────────┼─────────────────────┼────────────────┼──────────────────────────────────────────────────────────────────────────────────────┤
│"40 WALL STREET LLC"                │"Organization"       │"40 WALL STREET COMMERCIAL LLC"│"Organization"       │"Ownership"     │"https://www.documentcloud.org/documents/2838696-Trump-2016-Financial-Disclosure.html"│
├────────────────────────────────────┼─────────────────────┼───────────────────────────────┼─────────────────────┼────────────────┼──────────────────────────────────────────────────────────────────────────────────────┤
│"40 WALL STREET MEMBER CORP."       │"Organization"       │"40 WALL STREET LLC"           │"Organization"       │"Ownership"     │"https://www.documentcloud.org/documents/2838696-Trump-2016-Financial-Disclosure.html"│
├────────────────────────────────────┼─────────────────────┼───────────────────────────────┼─────────────────────┼────────────────┼──────────────────────────────────────────────────────────────────────────────────────┤
│"401 MEZZ VENTURE LLC"              │"Organization"       │"401 NORTH WABASH VENTURE LLC" │"Organization"       │"Ownership"     │"https://www.documentcloud.org/documents/2838696-Trump-2016-Financial-Disclosure.html"│
└────────────────────────────────────┴─────────────────────┴───────────────────────────────┴─────────────────────┴────────────────┴──────────────────────────────────────────────────────────────────────────────────────┘

通过此查询找到的最常提及的组织

WITH
'https://docs.google.com/spreadsheets/u/1/d/1Z5Vo5pbvxKJ5XpfALZXvCzW26Cl4we3OaN73K9Ae5Ss/export?format=csv&gid=1996904412' AS url
LOAD CSV WITH HEADERS FROM url AS row
WITH row
WHERE row.`Entity A Type` = 'Organization' AND row.`Entity B Type` = 'Organization'
UNWIND  [row.`Entity A`, row.`Entity B`] AS org
RETURN org, count(*)
ORDER BY count(*) DESC LIMIT 10

我们看到最上面是常见的“嫌疑犯”。

╒══════════════════════════════╤══════════╕
│"org"                         │"count(*)"│
╞══════════════════════════════╪══════════╡
│"THRIVE CAPITAL"              │"84"      │
├──────────────────────────────┼──────────┤
│"MERCER FAMILY FOUNDATION"    │"41"      │
├──────────────────────────────┼──────────┤
│"40 WALL STREET LLC"          │"40"      │
├──────────────────────────────┼──────────┤
│"DJT HOLDINGS LLC"            │"35"      │
├──────────────────────────────┼──────────┤
│"KUSHNER COMPANIES"           │"30"      │
├──────────────────────────────┼──────────┤
│"TRUMP HOTELS & CASINO RESORTS│"28"      │
│, INC."                       │          │
├──────────────────────────────┼──────────┤
│"TRUMP TOWER COMMERCIAL LLC"  │"21"      │
├──────────────────────────────┼──────────┤
│"TRUMP ORGANIZATION LLC"      │"18"      │
├──────────────────────────────┼──────────┤
│"THE TRUMP ORGANIZATION, INC."│"13"      │
├──────────────────────────────┼──────────┤
│"TTTT VENTURE LLC"            │"8"       │
└──────────────────────────────┴──────────┘

数据中存在哪些关系

WITH
'https://docs.google.com/spreadsheets/u/1/d/1Z5Vo5pbvxKJ5XpfALZXvCzW26Cl4we3OaN73K9Ae5Ss/export?format=csv&gid=1996904412' AS url
LOAD CSV WITH HEADERS FROM url AS row
RETURN row.Connection AS type, count(*)
ORDER BY count(*) DESC
╒═══════════════════════════════════════════════════════...═╤══════════╕
│"type"                                                 ... │"count(*)"│
╞═══════════════════════════════════════════════════════...═╪══════════╡
│"President (as of 2016 FEC filing)"                    ... │"475"     │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Ownership"                                            ... │"323"     │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Director"                                             ... │"126"     │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Investor"                                             ... │"120"     │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Reported member"                                      ... │"103"     │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Former director"                                      ... │"66"      │
....                                                    ...
│"\"Kushner and Cui have had an extensive ongoing dialog...i│"1"       │
│te House official,\" per Bloomberg"                    ... │          │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Marino served as Barry's law clerk"                   ... │"1"       │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Former director of African American outreach"         ... │"1"       │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Former director of advance"                           ... │"1"       │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Executive vice president and special counsel to Donald... │"1"       │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Ziya \"awarded a series of multimillion-dollar contrac... │"1"       │
├───────────────────────────────────────────────────────...─┼──────────┤
│"Former deputy director member relations"              ... │"1"       │
└───────────────────────────────────────────────────────...─┴──────────┘

虽然其中一些关系,如 OwnershipInvestor 是直接的,但另一些关系(例如 Ziya \"awarded a series of multimillion-dollar contracts to Azarpassillo,\" per The New Yorker)则非常具体,可能不是一个好的关系类型来查询。

所以我们有两个选择:一种是使用一个通用的关系,并将所有的 Connection 信息放入一个属性中;或者另一种选择是进行一些清理/统一,从而拥有一个更丰富的关系集。

简单直接的数据导入

我们在这里查看更简单的变体,以快速获得结果。统一方法在此处进行了演示,适用于那些希望拥有更有趣的图模型的读者。

© . All rights reserved.