<?php /** * Include the API PHP file */ require 'php-neo-rest.php'; /** * Create a graphDb connection * Note: this does not actually perform any network access, * the server is only accessed when you use the database */ $graphDb = new GraphDatabaseService('http://localhost:7474/'); /** * Lets create some nodes * Note: Unlike the java API, these nodes are NOT saved until you call the save() method (see below) */ $firstNode = $graphDb->createNode(); $secondNode = $graphDb->createNode(); $thirdNode = $graphDb->createNode(); /** * Assign some attributes to the nodes and save the, */ $firstNode->message = "Hello, "; $firstNode->blah = "blah blah"; $firstNode->save(); $firstNode->blah = NULL; // Setting to null removes the property $firstNode->save(); $secondNode->message = "world!"; $secondNode->someOtherAttribute = 'blah blah blah'; $secondNode->save();
<?php /** * Include the API PHP file */ require 'php-neo-rest.php'; /** * Create a graphDb connection * Note: this does not actually perform any network access, * the server is only accessed when you use the database */ $graphDb = new GraphDatabaseService('http://localhost:9999/'); /** * Lets create some nodes * Note: Unlike the java API, these nodes are NOT saved until you call the save() method (see below) */ $firstNode = $graphDb->createNode(); $secondNode = $graphDb->createNode(); $thirdNode = $graphDb->createNode(); /** * Assign some attributes to the nodes and save the, */ $firstNode->message = "Hello, "; $firstNode->blah = "blah blah"; $firstNode->save(); $firstNode->blah = NULL; // Setting to null removes the property $firstNode->save(); $secondNode->message = "world!"; $secondNode->someOtherAttribute = 'blah blah blah'; $secondNode->save();
public static function inflateFromResponse(GraphDatabaseService $neo_db, array $response) { $start_id = end(explode("/", $response['start'])); $end_id = end(explode("/", $response['end'])); $start = $neo_db->getNodeById($start_id); $end = $neo_db->getNodeById($end_id); $relationship = new Relationship($neo_db, $start, $end, $response['type']); $relationship->_is_new = FALSE; $relationship->_id = end(explode("/", $response['self'])); $relationship->setProperties($response['data']); return $relationship; }