Last active
August 29, 2015 14:01
-
-
Save dirkschumacher/c0c1d78c721aa4fe2adc to your computer and use it in GitHub Desktop.
News Reads Us
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= The news reads us data in Neo4J | |
Data by: http://newsreadsus.okfn.de/ | |
== Intro | |
Interesting data created by http://newsreadsus.okfn.de/. | |
I converted the data from the links.json file and converted it into two simple csv files. | |
//setup | |
[source,cypher] | |
---- | |
LOAD CSV FROM "https://dl.dropboxusercontent.com/s/riz5hp32mz0jzed/sites.csv?dl=1" AS csvline | |
MERGE (n:NewsSite { domain: csvline[0]}) | |
MERGE (a:MetricService { domain: csvline[1]}) | |
CREATE n-[:USES]->a | |
---- | |
//setup | |
[source,cypher] | |
---- | |
LOAD CSV FROM "https://dl.dropboxusercontent.com/s/fpbjo01j0bhek6v/networks.csv?dl=1" AS csvline | |
MERGE (c:Company { name: csvline[1]}) | |
MERGE (a:MetricService { domain: csvline[0]}) | |
CREATE c-[:OWNS]->a | |
---- | |
== Some Numbers | |
=== Used metric services by news site | |
[source,cypher] | |
---- | |
MATCH (n:NewsSite)-[:USES]->(a:MetricService) | |
Return n.domain AS NewsSite,count(a) as NoUsedMetricServices | |
ORDER BY NoUsedMetricServices DESC | |
---- | |
//table | |
=== Number of owned metric services by company | |
[source,cypher] | |
---- | |
MATCH (c:Company)-[:OWNS]->(a:MetricService) | |
Return c.name AS Company,count(a) as NoOfOwnedMetricServices | |
ORDER BY NoOfOwnedMetricServices DESC | |
---- | |
//table | |
== To who news sites report | |
[source,cypher] | |
---- | |
MATCH (n:NewsSite)-[:USES]->(a:MetricService)<-[:OWNS]-(c:Company) | |
Return n.domain as NewsSite,c.name as Company, count(a) As NoOfUsedMetricServicesOfThatCompany | |
ORDER BY NewsSite, Company, NoOfUsedMetricServicesOfThatCompany DESC | |
---- | |
//table | |
== Small example: all services used by spiegel.de | |
(tried to display that as a graph, but the system always shows the full graph regardles of any where expressions) | |
[source,cypher] | |
---- | |
MATCH (n:NewsSite {domain: "spiegel.de"})-[:USES]->(a:MetricService)<-[:OWNS]-(c:Company) | |
Return c.name AS Company, a.domain AS MetricService | |
ORDER BY Company, MetricService | |
---- | |
//table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment