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
/** | |
* Define a custom procedure to determine true/false if a database is online. | |
* That in itself is complicated, so we'll define "online" to mean that across | |
* all cluster members, the database has only 1 status (online) and they all | |
* agree. There is no "partially online" in this formulation. | |
*/ | |
CALL apoc.custom.asProcedure('isDatabaseOnline', | |
'CALL apoc.systemdb.execute("SHOW DATABASES") | |
YIELD row WITH row.name as name, row.currentStatus as status | |
WHERE name = $name |
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
const neo4j = require('neo4j-driver'); | |
// Always use bolt+routing in your Aura Endpoint. Customize your details here. | |
const AURA_ENDPOINT = process.env.NEO4J_URI || 'bolt+routing://aaaaaaa.databases.neo4j.io'; | |
const USERNAME = process.env.NEO4J_USER || 'neo4j'; | |
const PASSWORD = process.env.NEO4J_PASSWORD || 'superSecret'; | |
const writeHobby = (driver, person, hobby) => { | |
const query = ` | |
MERGE (p:Person { name: $person }) | |
MERGE (h:Hobby { name: $hobby }) |
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
const GraphDatabase = require('neo4j-driver') | |
// always use bolt+routing so that your queries can served by the best instance? | |
// replace your connection details, username and password | |
const auth = GraphDatabase.auth.basic('neo4j', 'neo') | |
const driver = new GraphDatabase.driver('bolt://localhost:7687', auth) | |
function main() { | |
const writeSession = driver.session(GraphDatabase.session.WRITE) | |
writeSession.writeTransaction(tx => createRelationshipToPeople(tx, 'Alice', 'David')) | |
.then(res => { | |
res.records.forEach(row => { |
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
#!/bin/bash | |
# Quick script to start an instance for testing. | |
docker stop neo4j-empty | |
PASSWORD=admin | |
CWD=`pwd` | |
NEO4J=neo4j/neo4j-experimental:4.0.0-rc01-enterprise | |
DESIRED_USERNAME=neo4j | |
DESIRED_PASSWORD=admin |
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
#***************************************************************** | |
# Neo4j Enterprise configuration | |
# | |
# For more details and a complete list of settings, please see | |
# https://neo4j.com/docs/operations-manual/current/reference/configuration-settings/ | |
#***************************************************************** | |
# The name of the database to mount | |
#dbms.active_database=graph.db |
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
#!/bin/bash | |
# | |
# This startup script replaces the normal neo4j startup process for cloud environments. | |
# The purpose of the script is to gather machine IP and other settings, such as key/value | |
# pairs from the instance tags, and use that to configure neo4j.conf. | |
# | |
# In this way, neo4j does not need to know ahead of time what it's IP will be, and | |
# can be controlled by tags put on the instance. | |
###################################################################################### | |
echo "pre-neo4j.sh: Fetching AWS instance metadata" |
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
/** | |
* This query calls 3 key procedures in Neo4j, | |
* gets transaction, connection, and query information and | |
* joins their information, and packs the results | |
* into a more compact single record structure. | |
* | |
* The result is one record per thing happening on the server, | |
* with full visibility into the details of that thing. | |
*/ | |
CALL dbms.listTransactions() |
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
-- format for below is: <dataSourceName>.<schemaName> | |
SET SCHEMA CENSUS.CENSUS; | |
-- ================================================================= | |
CREATE LABEL LicensedDog | |
PROPERTIES ( | |
licence_number STRING? | |
) | |
KEY |
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
/* | |
* Load all of Trump's tweets today and do some basic analysis on them. | |
*/ | |
UNWIND [ | |
'http://www.trumptwitterarchive.com/data/realdonaldtrump/2017.json', | |
'http://trumptwitterarchivedata.s3-website-us-east-1.amazonaws.com/data/realdonaldtrump/2016.json', | |
'http://trumptwitterarchivedata.s3-website-us-east-1.amazonaws.com/data/realdonaldtrump/2015.json', | |
'http://trumptwitterarchivedata.s3-website-us-east-1.amazonaws.com/data/realdonaldtrump/2014.json', | |
'http://trumptwitterarchivedata.s3-website-us-east-1.amazonaws.com/data/realdonaldtrump/2013.json', | |
'http://trumptwitterarchivedata.s3-website-us-east-1.amazonaws.com/data/realdonaldtrump/2012.json', |
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
<style type="text/css" media="screen"> | |
/* | |
.nodes-image { | |
margin:-100; | |
} | |
*/ | |
@import url("//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"); | |
.imageblock .content img, .image img {max-width: 900px;max-height: 300px;} | |
.deck h3, .deck h4 {display: block !important;margin-bottom:8px;margin-top:5px;} |