-
Notifications
You must be signed in to change notification settings - Fork 6
Small Cypher and Neo4j Tutorial
mariamoritz edited this page Nov 21, 2014
·
2 revisions
The application uses the graph data base neo4j to store textual data. Next to the API of the application, a great tool for administration purposes of these data is the neo4j API that comes with the database. You can either use it under:
localhost:7474/browser
or you can use the data browser of the old, but more performant interface under:
localhost:7474/webadmin
Both interfaces work with cypher (http://neo4j.com/docs/2.1/cypher-refcard/
and http://neo4j.com/docs/stable/
).
CREATE (n)
CREATE (n:Document)
CREATE (n:Document {author: 'Thucydides', title : 'Pentecontaetia' })
MATCH (n:`Document`) RETURN n LIMIT 25
MATCH (a)-[s]->(b) RETURN s LIMIT 25
MATCH (a)-[s]->(b) RETURN a, b LIMIT 25
MATCH (a:`Document`)-[s:`sentences`]->(b:`Sentence`) RETURN a, b LIMIT 25
MATCH (d:`Document`)-[sr:`sentences`]->(s:`Sentence`)-[wr:`words`]->(w:`Word`) RETURN d, s, w LIMIT 25
MATCH (n:Document {title : `Pentecontaetia`})
DELETE n
MATCH (n:`Document` {author : 'authorname'})-[r]-() RETURN n LIMIT 25
DELETE n,r
MATCH (n {title : 'Pentecontaetia'})
SET n.title = 'Neu'
RETURN n
MATCH (n:`Document`)
WHERE HAS (n.title) AND n.title = 'Pentecontaetia'
RETURN n
CREATE INDEX ON :Document(CTS)
CREATE INDEX ON :Document(ID)
CREATE INDEX ON :Document(author)
The API of the application uses a neo4j REST client written in python. A general tutorial folloes. Please use: http://neo4j-rest-client.readthedocs.org/en/latest/info.html
for further details.
from neo4jrestclient.client import GraphDatabase
gdb = GraphDatabase("http://localhost:7474/db/data/")
d = gdb.nodes.create(author="Thucydides", name="Pentecontaetia")
s = gdb.nodes.create(CTS="urn:cts...s", sentence="This is a sentence string .")
d = gdb.labels.create("Document")
d.labels.add("Document")
d.sentences(s) d.relationships.create("sentences", s)
- Developer tools and workflow
- API
- Neo4j-powered
- Postgres-powered
- Data
- Internationalization
- General information
- Developer tools and workflow
- Project structure overview
- Frontend vs. Backend Templates
- Backbone.js app structure
- Internationalization for JS
- Guidelines for creating content
- Adding a locale to Phaidra
- Postgres Database
- Neo4j
- Django
- "The server"
- Git
- UI