Skip to content

Instantly share code, notes, and snippets.

View TIAGOOOLIVEIRA's full-sized avatar

Tiago Oliveira TIAGOOOLIVEIRA

View GitHub Profile
@TIAGOOOLIVEIRA
TIAGOOOLIVEIRA / 1-importscript
Created October 29, 2019 17:44 — forked from rvanbruggen/1-importscript
Browser History - Clickstream Analysis with Neo4j
// this script uses the neo4j-shell-tools
// create personal nodes
import-cypher -d ; -i ./IMPORT/INPUT/PersonalNodes.csv -o ./IMPORT/OUTPUT/personalnodeout.csv create (n:url {id:{id}+1000,name:{name},type:{type}}) return n.name as name
// create indices
CREATE index on :url(name);
CREATE index on :url(id);
CREATE index on :url(type);
#######
# GENERAL NOTES
#######
* Node labels are case-sensitive. Customer and customer are different!
* Relationship names are case-sensitive. OWNS and owns are different!
* You can create nodes/relationships iff they don't exist using UNIQUE: http://docs.neo4j.org/chunked/snapshot/query-create-unique.html.
#######
# ADMIN QUERIES
package prizedraw;
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
import org.joda.time.DateTime;
import java.util.Collections;
import java.util.stream.Collectors;
@TIAGOOOLIVEIRA
TIAGOOOLIVEIRA / hierarchy.cql for 2.0
Created May 30, 2018 23:24 — forked from rvanbruggen/hierarchy.cql for 2.0
A gist to demonstrate the power of Neo4j for dealing with hierarchical data.
//Let's create the top of the tree, the PRODUCT
create (n1:PRODUCT {id:1});
//Let's create 100 children of the PRODUCT, COST_GROUPS connected to the top of the tree
match (n1:PRODUCT {id:1})
with range(1,100) as RANGE, n1
foreach (r in RANGE | create (n2:COST_GROUP {id:r})-[:PART_OF {quantity:round(rand()*100)}]->(n1) );
//for every COST_GROUP, let's connect 100 children at a 3rd level, the COST_TYPEs
match (n2:COST_GROUP)
@TIAGOOOLIVEIRA
TIAGOOOLIVEIRA / neo4j-kakfa-demo.md
Created March 20, 2018 23:22 — forked from graphadvantage/ neo4j-kakfa-demo.md
Neo4j GraphGist: Enterprise Architectures - Real-time Neo4j Graph Updates using Kafka Messaging

##Neo4j GraphGist - Enterprise Architectures: Real-time Graph Updates using Kafka Messaging

Neo4j Use Case: Low Latency Graph Analytics & OLTP - Update 1M Nodes in 90 secs with Kafka and Neo4j Bolt

Introduction

A recent Neo4j whitepaper describes how Monsanto is performing real-time updates on a 600M node Neo4j graph using Kafka to consume data extracted from a large Oracle Exadata instance.

This modern data architecture combines a fast, scalable messaging platform (Kafka) for low latency data provisioning and an enterprise graph database (Neo4j) for high performance, in-memory analytics & OLTP - creating new and powerful real-time graph analytics capabilities for your enterprise applications.