Skip to content

Instantly share code, notes, and snippets.

View danlentz's full-sized avatar

Dan Lentz danlentz

View GitHub Profile

Social Movie Database

Our example graph consists of movies with title and year and actors with a name. Actors have ACTS_IN relationships to movies, which represents the role they played. This relationship also has a role attribute.

So far, we queried the movie data; now let’s update the graph

Movie Database

Our example graph consists of movies with title and year and actors with a name. Actors have ACTS_IN relationships to movies, which represents the role they played. This relationship also has a role attribute.

cineasts

We’ll go with three movies and three actors:

Orienteering Gist

This is the Orienteering Dataset based on the blog.neo4j.org post.

BR6XWd4ZbbfPu9Bm2c IFYWdhzACwwxLJOS3ZpAR7gmUSZE6ldzwwlcp4GnR9YR2cwdNT6AuXiUESf B5YQOy4BEDYgpEKtBRCMCbkBOwc9Q9GpriAklzO9pqg

It’s a simple, three-leg training course in an Antwerp park. Setting this up as a graph in neo4j was easy enough:

@danlentz
danlentz / GraphGist-Guide.adoc
Last active December 22, 2015 22:39 — forked from nawroth/GraphGist-Guide.adoc
GraphGist-Guide

Develop a Graph

There are Three APIs…​

Neo4j has a trio of programming interfaces, focused on different kinds of interaction.

api trio
  • Work with the Cypher query language over HTTP.

  • Discover raw graph primitives over REST.

Create nodes and relationships

Create a node for the actor Tom Hanks:

CREATE (n:Actor {name:"Tom Hanks"});

How to create a GraphGist

You create a GraphGist by creating a GitHub Gist in AsciiDoc and enter the URL to it in the form on this page. Alternatively, you can put an AsciiDoc document in Dropbox and enter the public URL in the form.

This GraphGist shows the basics of using AsciiDoc syntax and a few additions for GraphGists. The additions are entered as comments on their own line. They are: //console for a query console; //hide, //setup and //output to configure a query; //graph and //table to visualize queries and show a result table.

Click on the Page Source button in the menu to see the source for this GraphGist.

@danlentz
danlentz / list.owl
Created September 12, 2013 13:47
owl:List
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY swrl "http://www.w3.org/2003/11/swrl#" >
<!ENTITY swrlb "http://www.w3.org/2003/11/swrlb#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
@danlentz
danlentz / slime-plz-use-asdf-cache.el
Created September 12, 2013 10:12 — forked from bhyde/slime-plz-use-asdf-cache.el
(defun setup-to-save-swank-fasls-in-asdf-cache ()
;;; elisp that instructs slime/swank to use the ASDF cache for fasl files.
;;; add this to your emacs init file; and the magic happens.
(defun setup-to-save-swank-fasls-in-asdf-cache ()
;; based on http://article.gmane.org/gmane.lisp.slime.devel/11080
(slime-eval-print "
(flet ((find-fasl (path options)
(declare (ignore options))
(let ((fasl-path
(asdf:apply-output-translations
(compile-file-pathname path))))
@danlentz
danlentz / setup-clojure.sh
Created September 12, 2013 08:53 — forked from jakemcc/setup-clojure.sh
clojure-quick-install
#!/usr/bin/env bash
CLOJURE_DIR=$HOME/opt/clojure
JAR_DIR=$HOME/opt/clojure/jars
mkdir -p $CLOJURE_DIR
cd $CLOJURE_DIR
# Get latest version of clojure and compile it
git clone git://github.com/richhickey/clojure.git
cd clojure
;; scratch buffer created 2012-10-31 at 20:48:06
(in-package #:cl)
;;; the goal is to enable #+ and #- to ignore multiple expressions by
;;; supplying an additional numeric prefix
;;; zero is kind of pointless, but would be accepted, possibly with a
;;; warning, one is the default