Permalink
Browse files

first steps to improved docs

  • Loading branch information...
1 parent 63892cc commit fd351c0307ad840908b97910de79cfcbe1523741 @technige technige committed Jun 1, 2012
Showing with 72 additions and 16 deletions.
  1. +1 −1 doc/conf.py
  2. +63 −7 doc/index.rst
  3. +8 −8 doc/py2neo.rst
View
@@ -110,7 +110,7 @@
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
-#html_logo = None
+html_logo = '../art/py2neo.200x128.back.png'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
View
@@ -1,12 +1,68 @@
-.. py2neo documentation master file, created by
- sphinx-quickstart on Sat Feb 4 23:41:38 2012.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
+py2neo
+======
-Welcome to py2neo's documentation!
-==================================
+Py2neo provides a clean and simple interface from Python to Neo4j via its
+REST API.
-Contents:
+Requirements
+------------
+
+Py2neo has been built against the following software:
+
+* Python 2.6+ <http://python.org/>
+* Tornado 2.2.1 <http://www.tornadoweb.org/>
+* Neo4j 1.6+ <http://neo4j.org/>
+
+Earlier versions of these may work but are not guaranteed to do so.
+
+Installation
+------------
+
+TODO
+
+Quick Start
+-----------
+
+If you want to jump in and start coding, the following short programme
+illustrates a simple usage of the py2neo library::
+
+ #!/usr/bin/env python
+
+ """
+ Simple example showing node and relationship creation plus
+ execution of Cypher queries
+ """
+
+ from __future__ import print_function
+
+ # Import Neo4j modules
+ from py2neo import neo4j, cypher
+
+ # Attach to the graph db instance
+ graph_db = neo4j.GraphDatabaseService("http://localhost:7474/db/data/")
+
+ # Create two nodes
+ node_a, node_b = graph_db.create(
+ {"name": "Alice"},
+ {"name": "Bob"}
+ )
+
+ # Join the nodes with a relationship
+ rel_ab = node_a.create_relationship_to(node_b, "KNOWS")
+
+ # Build a Cypher query
+ query = "START a=node({A}) MATCH a-[:KNOWS]->b RETURN a,b"
+
+ # Define a row handler...
+ def print_row(row):
+ a, b = row
+ print(a["name"] + " knows " + b["name"])
+
+ # ...and execute the query
+ cypher.execute(graph_db, query, {"A": node_a.id}, row_handler=print_row)
+
+Contents
+--------
.. toctree::
:maxdepth: 4
View
@@ -9,6 +9,14 @@ py2neo Package
:undoc-members:
:show-inheritance:
+:mod:`neo4j` Module
+-------------------
+
+.. automodule:: py2neo.neo4j
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
:mod:`cypher` Module
--------------------
@@ -33,14 +41,6 @@ py2neo Package
:undoc-members:
:show-inheritance:
-:mod:`neo4j` Module
--------------------
-
-.. automodule:: py2neo.neo4j
- :members:
- :undoc-members:
- :show-inheritance:
-
:mod:`rest` Module
------------------

0 comments on commit fd351c0

Please sign in to comment.