Skip to content

Instantly share code, notes, and snippets.

@stevehenderson
Created November 17, 2016 00:27
Show Gist options
  • Save stevehenderson/3350c755f8a94d50b1873f4480d0adda to your computer and use it in GitHub Desktop.
Save stevehenderson/3350c755f8a94d50b1873f4480d0adda to your computer and use it in GitHub Desktop.
Boot the Analyst Ubuntu VM
Open Advanced REST client in chrome
Send these examples
--------------
GET
http://192.168.125.129:7474/db/data/
--------------------
GET
http://192.168.125.129:7474/user/neo4j
-------------------
##General Form
#Use the following which will make a change to the
# graph while also committing it
Type: POST
URL: http://192.168.125.129:7474/db/data/transaction/commit
Set content type to JSON
Paste this in RAW PAYLOAD
{
"statements" : [ {
"statement" : "CREATE (n {props}) RETURN n",
"parameters" : {
"props" : {
"name" : "My Node"
}
}
} ]
}
##RETURN ALL PEOPLE
{
"statements" : [ {
"statement" : "MATCH (n:Person) RETURN n",
"parameters" : {
}
}
} ]
}
##CREATE AFFORDANCE
{
"statements" : [ {
"statement" : "CREATE (n:affordance {props}) RETURN n",
"parameters" : {
"props" : {
"affordance_id" : "1378212",
"name" : "Affordance3",
"label" : "CCP102",
"unit" : "CMT54(1CAV)",
"type" : "1",
"html" : "<b>Hello!</b>",
"location_x": 1.2,
"location_y": 2.2,
"location_z": 5.6
}
}
} ]
}
##CREATE SCENE
{
"statements" : [ {
"statement" : "CREATE (n:scene {props}) RETURN n",
"parameters" : {
"props" : {
"scene_id" : "61178212",
"name" : "Scene1"
}
}
} ]
}
##LINK SCENE AND AFFORDANCE
{
"statements" : [ {
"statement" : "MATCH (a:affordance { affordance_id: '6378212' }) MATCH (s:scene { scene_id: '61178212' }) CREATE (a)-[r:LOCATED_IN ]->(s) RETURN a,r,s"
} ]
}
##Delete a relatoinship
MATCH (a:affordance)-[r:LOCATED_IN]->(s:scene { scene_id: '61178212' }) delete r
##Delete a scene
MATCH (s:scene { scene_id: '61178212' }) delete s
##Update an affordance
{
"statements" : [ {
"statement" : "MATCH (a:affordance { affordance_id: '6378212' }) SET a.location_x=888.8 RETURN a"
} ]
##Get a node by id
MATCH (s)
WHERE ID(s) = 65110
RETURN s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment