Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
News Reads Us
= 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
You can’t perform that action at this time.