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, etherpad, pastebin or google doc, and enter the public URL in the URL-box top-right.
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. Read below to get the full details.
The metadata is optional, it is partially used when submitting a GraphGist.
To select a particular version, the neo4j-version
attribute can be used.
To provide custom styling to the graph visualization the style
attribute provides means to set the color/[border-color]/[text-color] for a label and to pre-select a property.
The general syntax is: :style: color:Label1(property1), color/border-color/text-color:Label2(property2),…
Here are the settings for this document.
:neo4j-version: 2.3 :author: Anders Nawroth :twitter: @nawroth :style: red:Person(name), #54A835/#1078B5/white:Database(name)
Define a Cypher query
[source,cypher] ---- MATCH (who:Person {name:'Me'})-[likes:LIKES]->(what) RETURN who,likes,what ----
becomes:
MATCH (who:Person {name:'Me'})-[likes:LIKES]->(what)
RETURN who,likes,what
Queries are executed in the order they appear on the page during rendering, so make sure they can be performed in that order. Each query has a green or red button to indicate if the query was successful or not. The console is set up after the executions, with an empty database, for the reader to play around with the queries.
There’s three additional settings you can use for queries. They all go as comments, on their own lines, before the query. The settings are:
|
Hide the query. The reader can still expand it to see it. Useful for long queries like setting up initial data. |
|
Initialize the console with this query. |
|
Show the output from the query. The output is always there, but this option makes it visible at page load for this query. |
Let’s try all the settings together, which means this query will be used to initialize the console, it will be hidden, and the raw output will be shown:
//hide //setup //output [source,cypher] ---- CREATE (me:Person {name:'Me'})-[r:LIKES]->(neo4j:Database {name:'Neo4j',link:'http://neo4j.com'}) RETURN me.name, r, neo4j ----
which becomes:
CREATE (me:Person {name:'Me'})-[r:LIKES]->(neo4j:Database {name:'Neo4j',link:'http://neo4j.com'})
RETURN me.name, r, neo4j
The visualization is based on the database contents after the preceding query in the page.
//graph
becomes:
MATCH (who:Person {name:'Me'})-[likes:LIKES]->(what)
RETURN who,likes,what
The visualisation is based on the results returned by the preceding query in the page.
//graph_result
becomes:
This will show a result table for the preceding query. Properties/Cells that are URLs are rendered as links and image URLs are rendered as inline images.
MATCH (who:Person {name:'Me'})-[likes:LIKES]->(what)
RETURN who,likes,what, who.name, what.name, what.link
//table
becomes:
This is what happens if a query causes an error:
CREATE (n:QueryLanguage {name:'cypher'}
A console button will be included anyway to hide or show the console. This will place the cypher-console where you want it and open it by default.
//console
becomes:
|
Italic |
|
Bold |
|
|
Document Info:
= Graph Gist Title :neo4j-version: 2.3 :author: Author Name :twitter: twitterhandle
Headings:
= Heading 1 == Heading 2 === Heading 3
Images:
image::http://assets.neo4j.org/img/still/cineasts.gif[]
* Item 1 ** Item 1.1 * Item 2
-
Item 1
-
Item 1.1
-
-
Item 2
. First . Second
-
First
-
Second
Monospaced block: indent lines with one space.
Tables are well supported. See AsciiDoc Quick Reference for information on that and more.