Database Reference
In-Depth Information
try {
ResultSet rs = cypher.resultSetQuery(
"MATCH (p:Product)-[:HAS]->(t)<-[:USES]-(u:User) " +
" RETURN p.title as title, " +
" collect(u.username) as users, " +
" collect(distinct t.wordPhrase) as tags", null);
ResultSetMapper<MappedProductUserTag> resultSetMapper =
new ResultSetMapper<MappedProductUserTag>();
return resultSetMapper
.mapResultSetToListMappedClass(rs, MappedProductUserTag.class);
}
catch (Exception e) {
log.error(e);
return null;
}
}
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 location
Products 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 12-40).
Listing 12-40. location Method for Showing Locations Nearby or Locations with Specific Product
// show locations nearby or locations that have a specific product
@Action(value = "location",results = {
@Result(name = "success", type = "mustache", location =
"/mustache/html/graphs/location/index.html")
})
public String location() {
setTitle("Location");
try {
mappedUserLocation = graphStoryDAO.getUserDAO()
.getUserLocation(cookiesMap.get(GraphStoryConstants.graphstoryUserAuthKey));
if (distance != null) {
if ( StringUtils.isNotBlank(productNodeId )) {
 
Search WWH ::




Custom Search