Skip to content

Instantly share code, notes, and snippets.

@jexp
Last active March 21, 2022 08:16
Show Gist options
  • Select an option

  • Save jexp/d98c43afadaa0421adaf6493832a7620 to your computer and use it in GitHub Desktop.

Select an option

Save jexp/d98c43afadaa0421adaf6493832a7620 to your computer and use it in GitHub Desktop.
Stackoverflow API to CSV Scripts
create constraint on (q:Question) assert q.id is unique;
create constraint on (u:User) assert u.id is unique;
create constraint on (t:Tag) assert t.name is unique;
create constraint on (a:Answer) assert a.id is unique;
create index on :Question(title);
create index on :User(display_name);
WITH "https://api.stackexchange.com/2.2/questions?pagesize=100&order=desc&sort=creation&tagged=neo4j&site=stackoverflow&filter=!5-i6Zw8Y)4W7vpy91PMYsKM-k9yzEsSC1_Uxlf" AS url
CALL apoc.load.json(url) YIELD value
UNWIND value.items AS q
MERGE (question:Question {id:q.question_id})
ON CREATE SET question.title = q.title,
question.share_link = q.share_link,
question.favorite_count = q.favorite_count
FOREACH (tagName IN q.tags | MERGE (tag:Tag {name:tagName}) MERGE (question)-[:TAGGED]->(tag))
FOREACH (a IN q.answers |
MERGE (question)<-[:ANSWERS]-(answer:Answer {id:a.answer_id})
MERGE (answerer:User {id:a.owner.user_id}) ON CREATE SET answerer.display_name = a.owner.display_name
MERGE (answer)<-[:PROVIDED]-(answerer)
)
WITH * WHERE NOT q.owner.user_id IS NULL
MERGE (owner:User {id:q.owner.user_id}) ON CREATE SET owner.display_name = q.owner.display_name
MERGE (owner)-[:ASKED]->(question);
user_id title created id view_count
18284317 Neo4j Desktop Error: PowerShell was not found 1647843329 71553455 6
3709953 Creating property-less nodes in Neo4j 1647781791 71547037 13
11340160 Routing error when trying to connect neo4j using python 1647770638 71545766 8
18517283 can&#39;t set relationship with neomodel in python 1647743771 71543625 6
8987062 how to return relationship in spring data neo4j 1647705318 71539680 9
18489271 ImportError:no module named py2neo 1647689318 71537763 31
2022081 named query spring-boot neo4j 1647660781 71535158 17
14677129 Neo4j Cypher Query - return counts of relationships in separate columns 1647625126 71531098 25
12345830 Neo4j Browser Connection 1647599777 71525713 11
15673412 (Neo4j / py2neo) Update relationship after it&#39;s been created 1647535609 71516107 16
18419685 Gremlin: Read edge GraphML file and node GraphML file in separate queries 1647517997 71511865 22
2168690 No procedure with the name `gds.beta.node2vec.stream` 1647517867 71511842 14
14312058 How to remotely access an neo4j community container running on azure with python(neo4j module)? 1647502987 71508617 22
8798127 Neo4j - GDS - FastRP Algorithm - Same values but different embeddings 1647502133 71508464 12
18490599 Couldn&#39;t load file in neo4j 1647498822 71507932 12
18438558 Cannot connect to database with Neo4j 1647475391 71505607 41
14486803 Grails 5 upgrade using Neo4j database receives ResultConsumedException on database queries 1647459534 71503313 23
14347713 neo4j DatabaseNotFoundError, with status &quot;offline&quot; 1647447005 71500507 16
11582749 Neo4j Browser - Bug on create node? 1647436536 71497761 11
18482037 How can i connect the three DBMS mysql, neo4j, and MongoDB, in GraphQl in the same time? 1647430159 71496306 17
8862235 Counting the occurences of value in array 1647429510 71496162 14
18463782 GraphQL query in Neo4j DataBase missing data 1647427177 71495595 7
15233037 Co-occurence analysis in Neo4j database 1647411360 71492521 19
11225821 Neo4j query really slow when using collect(distinct) and order by 1647405590 71491874 26
18477594 Issue connecting to Noe4j Aura with Python &#39;neo4j&#39; driver 1647391430 71490589 10
8701077 neo4j adding a return changes the amount of nodes matched 1647341996 71481115 23
18468507 Given (name, series) pair with a unique name list, use APOC.DO.WHEN to conditionally create &quot;UnknownName&quot; if not present but create edge in neo4j 1647318801 71477107 10
5749159 Convert bipartite graph to monopartite for community detection with GDS library 1647275597 71471159 23
18463782 Can not query on ID property graphQL Neo4j Databases 1647269490 71469701 23
1604072 How can I return multiple node types in a single query with Neo4j GraphQL? 1647140266 71454070 40
9606828 How to connect to Neo4j database hosted on Virtual Machine 1647108314 71452072 17
5632400 What it means to connect two nodes without a relation? 1647048637 71446295 36
18327369 Spring Boot neo4j query param 1647030388 71444286 23
15275654 Create a relationship between nodes based on existing relationship between the nodes 1647006992 71439636 30
14451710 FIlter the list with a condition in Neo4J 1646989916 71436160 27
5632400 How to find an actor having max earnings per movie in Neo4j db? 1646973911 71433746 38
18430891 Neo4j creating nodes and relationships from Bus route CSV 1646935637 71428829 20
15673412 Neo4j / Cypher: Matching &quot;Triangles&quot; 1646930113 71427658 18
10755618 Retrieving incoming edges in Neo4j query 1646929549 71427524 24
8478721 Depth first search on Neo4j with filtering on node properties 1646923964 71426175 22
10768865 How to force NEO4j Garbage Collection? 1646885395 71418741 31
5632400 &#39;optional match&quot; not returning null values within Neo4j 1646878848 71418122 26
18419685 Gremlin: Return new edges created in a query without saving them (equivalent to APOC vRelationship) 1646866511 71416932 49
5632400 Do we have &#39;groupby&#39; clause in Neo4j? 1646864322 71416635 26
4788979 Can&#39;t retrieve identity and labels after collect + unwind in cypher 1646819109 71407284 19
1487994 CypherGremlinClient query runs very slow 1646791019 71403487 24
18298239 Deploy ReactJS application on CentOS 7 server using Docker and VirtualHost 1646749316 71396558 43
13977239 Cypher/Neo4j – Storing bracketed variable in global scope 1646735318 71393448 34
9007303 How to map mongodb data to neo4j 1646734392 71393247 15
9007303 sync mongodb data to neo4j using neo4j connector 1646683885 71386738 16
2241766 Parenthesis-style query equivalence 1646663900 71382719 20
11366906 Filtering on pattern using NOT deprecated 1646588024 71372678 29
10480992 Neo4j error: Project failed to create: Error: EISDIR: illegal operation on a directory, symlink 1646574909 71370891 39
15557421 How to add a unique constraint for a label in a Neo4J database using Spring? 1646545612 71367971 27
16924872 APOC/Neo4j: match variable length of relationships in between 1646510612 71365582 28
3978694 Neo4j Rest API datetime data types 1646412805 71354650 27
15367126 Not able to connect to bolt in Neo4j through browser (deployed on AWS EC2) 1646323964 71340295 29
18363976 Generate UUID key using CypherdslStatementExecutor 1646312657 71337691 14
5026199 creating nodes in Neo4j using neo4j python driver not working 1646303329 71335593 27
18361850 How to speed up neo4j bloom SEARCH PHRASE? 1646294280 71333788 31
4279739 How to write neo4j cypher dsl for below query 1646234270 71325087 37
6074455 How to refactor neo4j cypher aggregation with implicit grouping keys 1646232898 71324770 14
18351743 Multiple Values for a property on a node - Neo4j 1646217307 71321199 32
9919764 PPI-based DB on a mouse protein interaction 1646184719 71316476 11
2915383 How to view in-memory graph in Neo4j? 1646171954 71315082 20
10415047 neo4j index memory utilisation CALL db.indexes() size? 1646166611 71314288 10
7369265 How to implement Gremlin query corresponding to Neo4j cypher query? 1646158210 71312875 26
1604072 How can I add a property to a new node when using onConnectOrCreate in Neo4j GraphQL? 1646098091 71302798 27
3600709 How can I convert a node property into a virtual node and generate a [virtual] relationship? 1646085304 71301487 25
1604072 How can I dynamically set a SortDirection for Neo4j Graphql in javascript? 1646027740 71291089 9
7978792 Is it possible to connect to AuraDB with neomodel? 1646023673 71290699 51
12090525 Neo4j Browser bolt connection through reverse proxy can&#39;t connect 1646014391 71289969 40
12802152 Traversing Relationships a Variable Number of Times in Cypher 1645996165 71288479 46
18314616 How to map the result to java entity class under relational query? 1645861572 71274924 17
6005852 How to get a hierarchical list of nodes and relations as json in Neo4j 1645791841 71265824 48
3709953 Identifying nodes with many, but thin connections 1645767640 71261517 14
748376 neo4j graphql with multiple users 1645689360 71248749 27
2915383 Looking for Path Finding Algorithm with Neo4j 1645637542 71241614 29
18287254 How to do BFS from multiple sources in Neo4j 1645610008 71234731 12
14347713 Efficiency of String.equals or STARTS WITH in neo4j 1645583659 71230702 32
6641174 neo4j graphql mutating with empty array 1645535293 71221904 27
10178679 Neo4J How to visualize clusters obtained with Cypher queries 1645533976 71221585 24
1797200 Vaadin 22 ComboBox with Lazy Loading and Filtering 1645533348 71221428 22
12078469 How to visualize Neo4J graph in Neo4J Bloom the same as in Neo4J Browser 1645532313 71221163 20
5825739 JS Neo4jError: Cannot run query in this transaction, because it has been rolled back either because of an error or explicit termination 1645501046 71215629 26
14524588 Neo4j - Update relationship properties dynamically from JSON 1645476287 71212820 87
3552975 (How) can I search a graph on arrows.app for a string? 1645432387 71203277 24
2011076 How to configure Neo4j to use JDK 11 on Windows? 1645394577 71199203 26
17551958 How Do I Connect to a Neo4J AuraDB Instance from R Studio 1645363144 71194810 32
18252390 Neomodel: ValueError: Can&#39;t install traversal &#39;source&#39; exists on NodeSet 1645277825 71185508 13
11855512 Neo4j issue during running the merge syntax how can it be solved? 1645248625 71182444 26
11855512 Syntax Error In Create Unique Neo4j How Can I Solve This? 1645245649 71182228 17
15277539 Get error when run cypher query multi line in php 1645223879 71180642 22
10088238 How create a graph importing from csv and filter date by dates in neo4j cypher? 1645199282 71176241 26
10178679 Neo4J Node&#39;s ego network with python 1645136406 71166089 28
10088238 Query to obtain one graph in neo4j instead of two 1645125992 71164268 20
7200524 Is MERGE safe to use when creating a new relationship in Cypher ( Neo4j )? 1645120932 71163215 9
4414246 Neo4j Full Text Index: Term(s) found 1645117731 71162486 13
4540866 Python neo4j Result object hangs forever 1645105542 71159316 19
9007303 Can we use neo4j and mongodb same time? 1645074837 71152826 32
# https://api.stackexchange.com/2.2/questions?pagesize=100&order=desc&sort=creation&tagged=neo4j&site=stackoverflow&filter=!5-i6Zw8Y)4W7vpy91PMYsKM-k9yzEsSC1_Uxlf
curl -L -o - 'https://dev.neo4j.com/so-api' | gzip -d > so.json
jq -r '["user_id", "title", "created", "id", "view_count" ], \
(.items[] | [.owner.user_id, .title, .creation_date, .question_id, .view_count]) | \
@csv' so.json > questions.csv
jq -r '["user_id", "display_name", "reputation"], \
(.items[] | .owner | [.user_id, .display_name, .reputation]) | \
@csv' so.json > users.csv
user_id display_name reputation
18284317 gczo 1
3709953 Sanjay Singh 237
11340160 Anshika Sahay 1
18517283 John Walker 1
8987062 Arrow.Tao 33
18489271 lelouny 1
2022081 m.zemlyanoi 267
14677129 MGipson 21
12345830 Narayana 1
15673412 Sala 57
18419685 asdf777 15
2168690 Dimitrios Panagopoulos 148
14312058 KLAS R 44
8798127 Berkay Coşkuner 21
18490599 Sharon Hsu 1
18438558 Maha Messaoud 21
14486803 Mike 1
14347713 shopkeeper 77
11582749 Manila 1
18482037 Meriem Bou 1
8862235 Filip 99
18463782 John 1
15233037 user15233037 1
11225821 Linh Nguyen 2654
18477594 Nekoken 1
8701077 Simon 349
18468507 daryl178 1
5749159 Matt 324
18463782 John 1
1604072 Thingamajig 3281
9606828 Pedro Silva 1
5632400 meallhour 11089
18327369 Gambanishu Habbeba 23
15275654 tomcajot 131
14451710 Shreya B 152
5632400 meallhour 11089
18430891 Carmanders 11
15673412 Sala 57
10755618 Erdem Tuna 335
8478721 NathJ 49
10768865 Stephanie 63
5632400 meallhour 11089
18419685 asdf777 15
5632400 meallhour 11089
4788979 Dominus 637
1487994 Jigar Gajjar 183
18298239 Rahma 11
13977239 chocojunkie 321
9007303 Vishakh .K.V 15
9007303 Vishakh .K.V 15
2241766 lenhhoxung 2317
11366906 jjrz 137
10480992 Muhammad Anas Patel 1
15557421 MEDES 11
16924872 Echo 1
3978694 Prabudda Sri Rahal 259
15367126 Ashish Joshi 1
18363976 Hardu 1
5026199 Nesma Zaki 57
18361850 Jan Nowacki 3
4279739 Creature 57
6074455 MichaelE 669
18351743 Avinash Singh 11
9919764 J31Q 1
2915383 Marcel 319
10415047 R2D2 4648
7369265 Ranjit Soni 440
1604072 Thingamajig 3281
3600709 ctwheels 20439
1604072 Thingamajig 3281
7978792 eburairu 23
12090525 leveraction 1
12802152 Parsa Safavi 100
18314616 bin huang 1
6005852 Pratheesh Russell 505
3709953 Sanjay Singh 237
748376 Mithir 2125
2915383 Marcel 319
18287254 Ninh Nguyen 1
14347713 shopkeeper 77
6641174 Matt 25
10178679 Stefano Leone 271
1797200 Chris 690
12078469 Kim Tang 1761
5825739 solar 31
14524588 py-r 367
3552975 Lerner Zhang 5036
2011076 Maxime Vernier 308
17551958 Idiaye 21
18252390 qi zuo 16
11855512 Aaditya Ghimire 58
11855512 Aaditya Ghimire 58
15277539 Mmmm 11
10088238 Dimitri 97
10178679 Stefano Leone 271
10088238 Dimitri 97
7200524 Amel Amc&#235; Muminovic 260
4414246 David A Stumpf 683
4540866 Vlad Gheorghe 400
9007303 Vishakh .K.V 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment