Database Reference
In-Depth Information
$app->view()->setData(array('usersWithMatchingTags'=>$usersWithMatchingTags,
'title'=>'Consumption Console'));
$app->render('graphs/consumption/console.mustache');
})->name('consumption-console');
// products that share any tag with a user
public static function getProductsHasATagAndUserUsesAMatchingTag(){
$queryString = " MATCH (p:Product)-[:HAS]->(t)<-[:USES]-(u:User) " .
" RETURN p.title as title , collect(u.username) as users, " .
" collect(distinct t.wordPhrase) as tags ";
$query = new Everyman\Neo4j\Cypher\Query(Neo4Client::client(), $queryString, null);
$result = $query->getResultSet();
return $result;
}
// products that share a specific tag with a user
public static function getProductsHasSpecificTagAndUserUsesSpecificTag($tag){
$queryString = " MATCH (t:Tag { wordPhrase: {wp} }) " .
" WITH t " .
" MATCH (p:Product)-[:HAS]->(t)<-[:USES]-(u:User) " .
" RETURN p.title as title,collect(u) as u, collect(distinct t) as t ";
$query = new Everyman\Neo4j\Cypher\Query(Neo4Client::client(), $queryString, array(
'wp' => $tag
));
$result = $query->getResultSet();
return $result;
}
Location Graph Model
This section explores the location graph model and a few of the operations that typically accompany it. In particular, it
looks at the following:
The spatial plugin
Filtering on locationProducts based on location
The example demonstrates how to add a console to enable you to connect products to locations in an ad hoc
manner (Listing 8-40).
Listing 8-40. Location Route for Showing Locations or Locations with Specific Product
// show locations nearby or locations that have a specific product
$app->get('/location', $isLoggedIn, function() use ($app){
// get the user's locations
$userlocations = UserLocation::getUserLocation($_SESSION['username']);
 
Search WWH ::




Custom Search