Skip to content
jadell edited this page Sep 22, 2011 · 3 revisions

GEOFF (Graph Export Object File Format) is a text representation of a graph (a set of nodes and relationships between them). The format is heavily based on Neo4j's Cypher syntax.

Plenty of great information on GEOFF is available at the py2neo site.

GEOFF and Neo4jPHP

Neo4jPHP provides functionality for both importing from and exporting to GEOFF files.

Importing from GEOFF

Importing a GEOFF file (or string) results in a Batch object representing all the create node, create relationship and index operations in the file. The batch can be committed, or it can be used to import another GEOFF file. If the latter is the case, operations from each additional file will be appended to the original batch.

$geoff = new Everyman\Neo4j\Geoff($client);

// Import from a file
$handle = fopen('/path/to/file.geoff', 'r');
$singleBatch = $geoff->load($handle);
$singleBatch->commit();

// Import from a string
$geoffString = '(Liz)	{"name": "Elizabeth", "title": "Queen of the Commonwealth Realms"}\n';
$multiBatch = $geoff->load($handle);

// Append to an existing batch
$multiBatch = $geoff->load(fopen('/path/to/yet_more.geoff', 'r'), $multiBatch);
$multiBatch->commit();

The final Batch::commit() call will commit all the operations from the second and third Geoff::load() calls.

Clone this wiki locally