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
Mute these words in your settings here: https://twitter.com/settings/muted_keywords | |
ActivityTweet | |
generic_activity_highlights | |
generic_activity_momentsbreaking | |
RankedOrganicTweet | |
suggest_activity | |
suggest_activity_feed | |
suggest_activity_highlights | |
suggest_activity_tweet |
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
create constraint user_key if not exists for (u:User) require (u.key) is unique; | |
// add nodes | |
call apoc.load.json("https://bsky.jazco.dev/exported_graph_minified.json","$.nodes") | |
yield value as nv | |
call { with nv | |
merge (n:User {key:nv.key}) | |
on create set n += apoc.map.clean(nv.attributes,["key"],[]) | |
} in transactions of 10000 rows; |
On July 22, Github announced the 3rd Annual Github Data Challenge presenting multiple sources of data available.
This sounded to me a good opportunity to use their available data and import it in Neo4j in order to have a lot of fun at analyzing the data that fits naturally in a graph.
As I work mainly offline or behind military proxies that do not permit me to use the ReST API, I decided to go for the Github Archive available here, you can then download json files representing Github Events on a daily/hour basis.
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
// CSV file can be downloaded here: | |
// https://wiki.nci.nih.gov/download/attachments/147193864/GI50.zip?version=2&modificationDate=1649214698000&api=v2 | |
LOAD CSV WITH HEADERS FROM 'file:///GI50.csv' AS row | |
MERGE (chem:Chemical {nsc: toInteger(row.NSC)}) | |
MERGE (cell:CellLine {name: row.CELL_NAME}) | |
MERGE (dis:Disease {name: row.PANEL_NAME}) | |
WITH chem, cell, dis, row | |
MERGE (chem)-[:GI50 {concentration: row.AVERAGE, research: "NCI60", unit: row.CONCENTRATION_UNIT, experiment_id: row.EXPID, count: row.COUNT}]->(cell) | |
MERGE (cell)-[:CELL_LINE_OF]->(dis); |
This is a Neo4j 1.9 (pre-2.0) query:
START user=node:nodes(type='user')
MATCH user <-[:follows]- follower -[?:follows]-> other
WITH user, follower, 1.0 / COUNT(other) AS weighted
WITH user, COUNT(follower) AS numFollowers, SUM(weighted) as totalWeighted
RETURN user, numFollowers,
ROUND(totalWeighted * 100) / 100.0 AS totalWeighted,
ROUND(totalWeighted * 100 / numFollowers) / 100.0 AS avgFollowerWeight
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
CREATE CONSTRAINT word_name IF NOT EXISTS ON (w:Word) ASSERT w.name IS UNIQUE; | |
CREATE CONSTRAINT cap_idx_char IF NOT EXISTS FOR (cap:CharAtPos) REQUIRE (cap.idx, cap.char) IS NODE KEY; | |
LOAD CSV FROM | |
"https://gist.githubusercontent.com/jexp/b1882301adb95a8015d6c29d3e24e341/raw/6fe6ac31b9ed46900451e17b5215e9088ec09a6e/wordle.csv" as row | |
MERGE (w:Word {name:row[0]}); | |
:auto MATCH (w:Word) | |
CALL { WITH w |
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
function import_extract_first { | |
echo "name:ID(Concept)" > concepts.txt | |
cat data-concept-instance-relations.txt | cut -d $'\t' -f 1 | sort | uniq >> concepts.txt | |
echo "name:ID(Instance)" > instances.txt | |
cat data-concept-instance-relations.txt | cut -d $'\t' -f 2 | sort | uniq >> instances.txt | |
echo $':END_ID(Concept)\t:START_ID(Instance) relations:int' > is_a.hdr | |
$NEO4J_HOME/bin/neo4j-import --into concepts.db --id-type string --delimiter TAB --bad-tolerance 13000000 --skip-duplicate-nodes true --skip-bad-relationships true \ |
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
create index on :Partei(name); | |
create index on :These(name); | |
create constraint if not exists on (p:Partei) assert p.id is unique; | |
create constraint if not exists on (t:These) assert t.id is unique; | |
load csv with headers from | |
"https://gist.github.com/jexp/189e9d7a47095ff96ff522fe350f0d36/raw/fa2f356514ec981067856ad7a5f6dfb017122c8d/wom-sa-2021.csv" | |
as row | |
merge (p:Partei {id:toInteger(row.`Partei: Nr.`)}) on create set p.text = row.`Partei: Name`, p.name = row.`Partei: Kurzbezeichnung` |
NewerOlder