Skip to content

Instantly share code, notes, and snippets.

View cskardon's full-sized avatar
🧵
Sewing a lot at the moment

Charlotte Skardon cskardon

🧵
Sewing a lot at the moment
View GitHub Profile
@cskardon
cskardon / neo4j-advanced-ifthen.cql
Last active November 7, 2024 13:51
A gist of the queries used in the Advanced Neo4j course for conditional logic
//001 - Deceased
MATCH (person:Person)
WHERE NOT person.died IS NULL
SET person:Deceased;
//002 - Alive
MATCH (person:Person)
WHERE person.died IS NULL
SET person:Alive;
@cskardon
cskardon / neo4j-advanced-movies-setup.cql
Last active November 7, 2024 14:32
A gist of the queries used in the Advanced Neo4j course setting up the movies DB
//Extra Setup for the course
MATCH (n)
SET n.id = elementid(n);
//Adding releaseyear as a property for ease of querying later
MATCH (m:Movie) WHERE m.released IS NOT NULL
SET m.released = date(m.released)
SET m.releaseyear = m.released.year
@cskardon
cskardon / neo4j-advanced-projection.cql
Last active October 30, 2024 14:24
A gist of the projection queries used in the Advanced Neo4j course
MATCH (actor:Person)-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(coactor:Person)
WHERE actor.name = "Tom Hanks" AND actor <> coactor
WITH
actor.name AS actor,
m.title AS title,
coactor.name AS movieCoactors
RETURN
actor, title, movieCoactors
@cskardon
cskardon / neo4j-advanced-subqueries.cql
Last active November 5, 2024 13:39
A gist of the queries used in the Advanced Neo4j course
//001 - How many movies has Tom Hanks acted in, how many has he directed?
MATCH (p:Person WHERE p.name = "Tom Hanks")-[:ACTED_IN]->(m:Movie)
WITH p, count(DISTINCT m) AS acts
MATCH (p)-[:DIRECTED]->(m:Movie)
WITH p, acts, count(DISTINCT m) AS directs
RETURN p.name AS name, acts, directs;
//002 - How many movies has each person acted in, how many have they directed?
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
--------------------------------------------------------------------------------
-- WORKSHOP BASICS NEO4J
-- https://tinyurl.com/workshop-neo4j-basics-ita
--------------------------------------------------------------------------------
--------------------------------------------------------------------- CONTRAINTS
/// constraint unique on movie title
CREATE CONSTRAINT title_uniqueness ON (m:Movie) ASSERT m.title IS UNIQUE;
@cskardon
cskardon / MonitorFolder.ps1
Created February 1, 2018 15:12
A PowerShell script to monitor a folder and executing Cypher when a new file is added
$global:folder = 'c:\temp\imports' # The root folder being monitored.
$filter = '*.csv' # File types we're looking for.
$global:archiveFolder = 'c:\temp\imports\archive' # The archive root folder
$global:cypherShellLocation = 'd:\databases\neo4j\enterprise\neo4j-enterprise-3.3.0\bin\cypher-shell.bat' # The location of the cypher-shell.bat file
$global:user = "neo4j"
$global:password = "neo"
# A watcher to watch
$fsw = New-Object IO.FileSystemWatcher $folder, $filter -Property @{IncludeSubdirectories = $false;NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'}

Keybase proof

I hereby claim:

  • I am cskardon on github.
  • I am cskardon (https://keybase.io/cskardon) on keybase.
  • I have a public key ASAJ4USySBXduTD99vwlOImo80TpjNQ_2Yzc0g5D1HPCzgo

To claim this, I am signing this object:

@cskardon
cskardon / ActorProcedures.java
Created June 1, 2017 10:27
An example proc for a blog post on xclave.co.uk - proper link will pop up soon
package movie;
import common.MapResult;
import org.neo4j.procedure.Context;
import org.neo4j.procedure.Name;
import org.neo4j.procedure.Procedure;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@cskardon
cskardon / Neo4jClient.Tx.Rest.Bolt.cs
Created March 8, 2017 15:00
LinqPad Transactions with Neo4jClient - using REST and BOLT
/*
LinqPad available from: https://www.linqpad.net/
Settings:
- Language = 'C# Program'
- Nuget
- Neo4jClient (min: 3.0.0-Bolt-Driver00026) [Use Development MyGet: https://www.myget.org/F/cskardon/api/v3/index.json]
- Neo4j.Driver (min: 1.1.2)
- System.Net.Http (min: 4.3.1)
*/
@cskardon
cskardon / Neo4jClientIsBack.md
Last active August 12, 2024 11:13
Neo4jClient 1.1.0.1 -> 1.1.0.5

#Neo4jClient - It's Back!

###The Past

For those in the know - the main .NET client for Neo4j is Neo4jClient - it was developed by Tatham Oddie for the last few years and had reached a nice stable point. Tatham has had to take a more off-hand role - something called 'LIFE' has happened :) So, I (Charlotte - Hello!) have taken over the management of the Neo4jClient.

###The Now

The last Neo4jClient version prior to my taking over was 1.0.0.665 - which was stable and included a large amount of Cypher functionality, but crucially was missing Transaction support. As luck would have it the Transaction code (written by Arturo Sevilla) was sitting in a pull request.