Database Reference
In-Depth Information
Querying with a Label
To get nodes that use a specific label, use the function called getNodes. This function returns value as a result Row
object, which can be iterated over like an array.
Listing 8-13. Querying with a Label
<?php
// Neo4jClient class
// ...omitted...
// Create Neo4j client
// ...omitted...
// get the label
$devLabel = $client->makeLabel('Developer');
// return the nodes
$devNodes = $devLabel->getNodes();
// Only return nodes that have whose name property value is "Greg"
$nodes = $devLabel->getNodes("name", "Greg");
Developing a PHP and Neo4j Application
Preliminary to building out your first PHP and Neo4j application, this section covers the basics of configuring a
development environment.
Again, if you have not worked through the installation steps in Chapter 2, please take a few minutes to install it.
Preparing the Graph
In order to spend more time highlighting code examples for each of the more common graph models, we will use a
preloaded instance of Neo4j including necessary plugins, such as the spatial plugin.
To quickly set up a server instance with the sample data and plugins for this chapter, go to graphstory.com/
practicalneo4j . You will be provided with your own free trial instance, a knowledge base, and email support from Graph
Story. Alternatively, you may run a local Neo4j database instance with the sample data by going to graphstory.com/
practicalneo4j, downloading the zip file containing the sample database and plugins, and adding them to your
local instance.
Tip
Using the Sample Application
If you have already downloaded the sample application from graphstory.com/practicalneo4j for PHP and
configured it with your local application environment, you can proceed to the “Slim Application Configuration”
section. Otherwise, you will need to go back to the “PHP and Neo4j Development Environment” section and set up
your local environment in order to follow the examples in the sample application.
 
 
Search WWH ::




Custom Search