Skip to content

Instantly share code, notes, and snippets.

View nawroth's full-sized avatar

Anders Nawroth nawroth

View GitHub Profile

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.

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:

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:

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

Finding Paths

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.

We queried and updated the data so far, now let’s find interesting constellations, a.k.a. paths.

@nawroth
nawroth / case.adoc
Last active December 24, 2015 15:58

The case for CASE

This is how you might model Premier League managers tenures at different clubs in Neo4j:

managers tiff

The date modeling is based on an approach described in more detail in Return partly shared path ranges.

this is the title
MATCH (n) RETURN n

Using labels

Labels is a convenient way to group nodes together. They are used to enhance queries, define constraints and indexes.

The following will give an example of how to use labels. Let’s start out adding a constraint — in this case we decided that all Movie nodes should have a unique title.

@nawroth
nawroth / attributes.adoc
Last active December 31, 2015 06:19
attributes test

Testing document attributes

{my-attribute}

{someattribute}

@nawroth
nawroth / doctests.adoc
Last active August 29, 2015 13:56
location of doc tests in neo4j

Neo4j Documentation

The Neo4j Manual is versioned and released together with the product. An overview of parts of the documentation workflow is found in the manual itself, in the chapter Writing Neo4j Documentation. We use several different approaches to verify our documentation by tests running in CI when the product is built. Testing as much as possible of examples especially makes sense, as we also provide ways to interactively play with Neo4j, see for example Create nodes and relationships.

The documentation toolchain also makes sure that all cross references have valid targets.

The core tools for our documentation are AsciiDoc and DocBook.