Skip to content

Instantly share code, notes, and snippets.

Avatar

Anders Nawroth nawroth

View GitHub Profile
@nawroth
nawroth / ImportDbPedia.java
Created Feb 15, 2013
Importing dbpedia into Neo4j.
View ImportDbPedia.java
package y;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
View tutorial-graphgist
= The Neo4j GraphGist Console =
This is a sample GraphGist explaining some of the base concepts of sharing graphs using http://docs.neo4j.org/chunked/milestone/cypher-query-lang.html[the Cypher query language].
[source,cypher]
----
CREATE ({name:'you'})-[:SEE]->({name:'This GraphGist'})-[:FORK_ON_GITHUB]->(your_gistfile{name:'Your Gist'})
CREATE (your_gistfile)-[:INSERT_ID_HERE]->({name:'Your GraphGist'})
----
View tutorial-test
= The Neo4j GraphGist Console =
This is a sample GraphGist explaining some of the base concepts of sharing graphs using http://docs.neo4j.org/chunked/milestone/cypher-query-lang.html[the Cypher query language].
// The following is a placeholder for a Cypher console.
//console
[source,cypher]
----
View DocGist Example.adoc

DocGist Example

DocGist is a tool that renders AsciiDoc documents fetched from GitHub gists or other sources. The rendering is performed in the browser using the asciidoctor.js library. The original use case for this was http://gist.neo4j.org/ which has additional features to create examples for the Neo4j graph database.

How To Use

  • Create/locate a gist on GitHub (or use a file in Dropbox).

    • Write text using AsciiDoc syntax in it.

View GraphGist-intro.adoc

Neo4j GraphGist

Neo4j GraphGists are a way to share documents including Cypher queries. The queries can be executed in an online console. GraphGists can be used to share examples or ideas or outline a question you have.

See also the GraphGist Collection and check out the GraphGist Challenge!

You create a GraphGist by creating a GitHub Gist in AsciiDoc and enter the URL to it in the form on this page. The GraphGist is just as private as the GitHub Gist you created.

View GraphGist-simple.adoc

A simple GraphGist

You create a GraphGist by creating a GitHub Gist in AsciiDoc and enter the URL to it in the form on this page.

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

Include a query console

//console

View GraphGist-syntax.adoc

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.

View GraphGist-create-nodes-and-rels.adoc

Create nodes and relationships

Create a node for the actor Tom Hanks:

CREATE (n:Actor {name:"Tom Hanks"});
View asciidoctor.js-test
`CREATE UNIQUE` will make sure we don't create duplicate patterns.
Using this: `[r:ACTED_IN]` lets us return the relationship.
View Business Rule Recommendation gist
= Business Rule / Recommendation gist =
Let's see if I can create a graphgist for business rules/simple recommendations.
//console
First, lets create the graph:
//setup
[source,cypher]
You can’t perform that action at this time.