Skip to content

Instantly share code, notes, and snippets.

View nicysneiros's full-sized avatar

Nicolle Cysneiros nicysneiros

View GitHub Profile
CREATE (john:User {name:'John', gender:'M', age:'28'})
RETURN john
{ "results": [
{...
"graph": {
"nodes": [
{
"id": "1",
"labels": [
"User"
],
"properties": {
MATCH (john:User), (mary:User)
WHERE john.name="John" AND mary.name="Mary"
CREATE (john)-[f:FRIENDS_WITH]->(mary)
RETURN john, f, mary
{ "results": [
{...
"graph": {
"nodes": [
{ "id": "1",
"labels": [ "User" ],
"properties": {
"gender": "M",
"name": "John",
"age": "28"
MATCH (:User {name: "John"}) -[:LIKES]-> (pages)
RETURN pages
{ "results": [{
...
"data": [
{"row": [
{ "gender": "M",
"name": "John",
"age": "28" },
{},
{ "name": "The Beatles",
"category": "Musician/Band" }
from py2neo import Graph, Node, Relationship
g = Graph(password="admin")
tx = g.begin()
john = Node("User", name="John", gender="M", age="28")
tx.create(john)
mary = Node("User", name="Mary", gender="F", age="26")
tx.create(mary)
from py2neo import Graph, Node, NodeSelector
g = Graph(password="admin")
selector = NodeSelector(g)
john = selector.select("User", name="John").first()
john_likes = g.match(start_node=john, rel_type="LIKES")
for like in john_likes:
page = like.end_node()
MATCH (User {name: “John”}) -[:LIKES]-> (pages)
RETURN pages
MATCH (:User {name: “John”}) -[:LIKES]-> (pages)
RETURN pages